Skip to content
Snippets Groups Projects
Commit c39e4310 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

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
parent 2898e61f
Branches
Tags
No related merge requests found
/*
* $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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment