add scheme_jit_now()

This commit is contained in:
Matthew Flatt 2014-05-20 08:47:59 +01:00
parent 9b78847be0
commit a57e712ba3
11 changed files with 32 additions and 2 deletions

View File

@ -378,3 +378,12 @@ is @racket[#f] if the address cannot be inferred, which may be because
the given @var{p} does not refer to generated machine code.
@history[#:added "6.0.1.9"]}
@function[(void scheme_jit_now
[Scheme_Object* val])]{
If @var{val} is a procedure that can be JIT-compiled, JIT compilation
is forced immediately if it has not been forced already (usually
through calling the function).
@history[#:added "6.0.1.10"]}

View File

@ -634,3 +634,4 @@ EXPORTS
scheme_malloc_key
scheme_free_key
scheme_jit_find_code_end
scheme_jit_now

View File

@ -650,3 +650,4 @@ EXPORTS
scheme_malloc_key
scheme_free_key
scheme_jit_find_code_end
scheme_jit_now

View File

@ -651,3 +651,4 @@ scheme_register_process_global
scheme_malloc_key
scheme_free_key
scheme_jit_find_code_end
scheme_jit_now

View File

@ -658,3 +658,4 @@ scheme_register_process_global
scheme_malloc_key
scheme_free_key
scheme_jit_find_code_end
scheme_jit_now

View File

@ -1319,8 +1319,7 @@ static Scheme_Object *make_future(Scheme_Object *lambda, int enqueue, future_t *
/* JIT the code if not already JITted */
if (ncd) {
if (ncd->start_code == scheme_on_demand_jit_code)
scheme_on_demand_generate_lambda(nc, 0, NULL, 0);
scheme_jit_now(lambda);
if (ncd->max_let_depth > FUTURE_RUNSTACK_SIZE * sizeof(void*)) {
/* Can't even call it in a future thread */

View File

@ -645,6 +645,20 @@ void* scheme_jit_find_code_end(void *_p)
return NULL;
}
void scheme_jit_now(Scheme_Object *f)
{
if (SAME_TYPE(SCHEME_TYPE(f), scheme_native_closure_type)) {
Scheme_Native_Closure *nc;
Scheme_Native_Closure_Data *ncd;
nc = (Scheme_Native_Closure*)f;
ncd = nc->code;
if (ncd->start_code == scheme_on_demand_jit_code)
scheme_on_demand_generate_lambda(nc, 0, NULL, 0);
}
}
typedef void *(*Module_Run_Proc)(Scheme_Env *menv, Scheme_Env *env, Scheme_Object **name);
typedef void *(*Module_Exprun_Proc)(Scheme_Env *menv, int set_ns, Scheme_Object **name);
typedef void *(*Module_Start_Proc)(struct Start_Module_Args *a, Scheme_Object **name);

View File

@ -1223,3 +1223,4 @@ MZ_EXTERN Scheme_Object *scheme_malloc_key(void);
MZ_EXTERN void scheme_free_key(Scheme_Object *k);
MZ_EXTERN void* scheme_jit_find_code_end(void *p);
MZ_EXTERN void scheme_jit_now(Scheme_Object *f);

View File

@ -995,6 +995,7 @@ void *(*scheme_register_process_global)(const char *key, void *val);
Scheme_Object *(*scheme_malloc_key)(void);
void (*scheme_free_key)(Scheme_Object *k);
(*scheme_jit_find_code_end)(void *p);
void (*scheme_jit_now)(Scheme_Object *f);
#ifndef SCHEME_EX_INLINE
} Scheme_Extension_Table;
#endif

View File

@ -723,3 +723,4 @@
scheme_extension_table->scheme_malloc_key = scheme_malloc_key;
scheme_extension_table->scheme_free_key = scheme_free_key;
scheme_extension_table->scheme_jit_find_code_end = scheme_jit_find_code_end;
scheme_extension_table->scheme_jit_now = scheme_jit_now;

View File

@ -723,6 +723,7 @@
#define scheme_malloc_key (scheme_extension_table->scheme_malloc_key)
#define scheme_free_key (scheme_extension_table->scheme_free_key)
#define scheme_jit_find_code_end (scheme_extension_table->scheme_jit_find_code_end)
#define scheme_jit_now (scheme_extension_table->scheme_jit_now)
#ifdef MZ_PRECISE_GC
#pragma GC_VARIABLE_STACK_THOUGH_TABLE
#endif