From c39e4310ee200407281abf03ece47277d8886002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Thu, 2 Aug 2001 15:24:54 -0700 Subject: [PATCH] keep track of what functions can be addressed statically Rev: src/code/ia32.c:1.14 Rev: src/constants.c:1.32 Rev: src/constants.h:1.19 Rev: src/dynamic_load.c:1.53 --- src/code/ia32.c | 11 ++++++++++- src/constants.c | 5 ++++- src/constants.h | 7 +++++-- src/dynamic_load.c | 9 ++++++++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/code/ia32.c b/src/code/ia32.c index 16d1c9f90b..af00e5a5bf 100644 --- a/src/code/ia32.c +++ b/src/code/ia32.c @@ -1,5 +1,5 @@ /* - * $Id: ia32.c,v 1.13 2001/07/27 08:32:03 hubbe Exp $ + * $Id: ia32.c,v 1.14 2001/08/02 22:24:54 hubbe Exp $ * * Machine code generator for IA32. * @@ -412,12 +412,21 @@ void ins_f_byte_with_arg(unsigned int a,unsigned INT32 b) } break; + /* + * And this would work nicely for all non-dynamically loaded + * functions. Unfortunately there is no way to know if it is + * dynamically loaded or not at this point... + */ case F_MARK_CALL_BUILTIN: + if(Pike_compiler->new_program->constants[b].sval.u.efun->internal_flags & CALLABLE_DYNAMIC) + break; update_arg1(0); ia32_call_c_function(Pike_compiler->new_program->constants[b].sval.u.efun->function); return; case F_CALL_BUILTIN1: + if(Pike_compiler->new_program->constants[b].sval.u.efun->internal_flags & CALLABLE_DYNAMIC) + break; update_arg1(1); ia32_call_c_function(Pike_compiler->new_program->constants[b].sval.u.efun->function); return; diff --git a/src/constants.c b/src/constants.c index d076dc15e9..1536e195e7 100644 --- a/src/constants.c +++ b/src/constants.c @@ -17,7 +17,7 @@ #include "security.h" #include "block_alloc.h" -RCSID("$Id: constants.c,v 1.31 2001/07/02 04:09:47 hubbe Exp $"); +RCSID("$Id: constants.c,v 1.32 2001/08/02 22:24:53 hubbe Exp $"); struct mapping *builtin_constants = 0; @@ -74,6 +74,8 @@ PMOD_EXPORT void add_global_program(char *name, struct program *p) }while(0) BLOCK_ALLOC(callable,128) +int global_callable_flags=0; + /* Eats one ref to 'type' and 'name' */ PMOD_EXPORT struct callable *low_make_callable(c_fun fun, struct pike_string *name, @@ -90,6 +92,7 @@ PMOD_EXPORT struct callable *low_make_callable(c_fun fun, f->flags=flags; f->docode=docode; f->optimize=optimize; + f->internal_flags = global_callable_flags; #ifdef PIKE_DEBUG { struct pike_type *z = check_call(function_type_string, type, 0); diff --git a/src/constants.h b/src/constants.h index fffa9b3108..624cc28a7c 100644 --- a/src/constants.h +++ b/src/constants.h @@ -5,7 +5,7 @@ \*/ /* - * $Id: constants.h,v 1.18 2001/07/02 04:09:47 hubbe Exp $ + * $Id: constants.h,v 1.19 2001/08/02 22:24:54 hubbe Exp $ */ #ifndef ADD_EFUN_H #define ADD_EFUN_H @@ -18,13 +18,16 @@ typedef int (*docode_fun)(node *n); typedef node *(*optimize_fun)(node *n); +#define CALLABLE_DYNAMIC 1 + struct callable { PIKE_MEMORY_OBJECT_MEMBERS; c_fun function; struct pike_type *type; struct pike_string *name; - INT16 flags; + INT16 flags; /* OPT_* */ + INT16 internal_flags; #ifdef PIKE_DEBUG INT8 may_return_void; long compiles; diff --git a/src/dynamic_load.c b/src/dynamic_load.c index e29f11562e..722146a796 100644 --- a/src/dynamic_load.c +++ b/src/dynamic_load.c @@ -7,8 +7,9 @@ # include "stralloc.h" # include "pike_macros.h" # include "main.h" +# include "constants.h" -RCSID("$Id: dynamic_load.c,v 1.52 2001/03/28 15:07:38 grubba Exp $"); +RCSID("$Id: dynamic_load.c,v 1.53 2001/08/02 22:24:54 hubbe Exp $"); #endif /* !TESTING */ @@ -341,6 +342,12 @@ void f_load_module(INT32 args) new_module->exit=exit; start_new_program(); + + { + extern int global_callable_flags; + global_callable_flags|=CALLABLE_DYNAMIC; + } + #ifdef PIKE_DEBUG { struct svalue *save_sp=sp; #endif -- GitLab