make effect of JIT_EAGER_JIT
more complete
This commit is contained in:
parent
13cb9bfc06
commit
c9e3788d42
|
@ -6214,6 +6214,10 @@ void GC_dump_with_traces(int flags,
|
|||
num_immobiles++;
|
||||
|
||||
if (!(flags & GC_DUMP_SUPPRESS_SUMMARY)) {
|
||||
intptr_t accum_count = 0, accum_size = 0;
|
||||
#ifdef MZ_GC_BACKTRACE
|
||||
intptr_t accum_past_count = 0, accum_past_size = 0;
|
||||
#endif
|
||||
GCPRINT(GCOUTF, "Begin Racket3m" SUMMARY_SUFFIX "\n");
|
||||
#ifdef MZ_GC_BACKTRACE
|
||||
GCPRINT(GCOUTF, " tag live count live size past count past size\n");
|
||||
|
@ -6237,6 +6241,24 @@ void GC_dump_with_traces(int flags,
|
|||
tn, counts[i], gcWORDS_TO_BYTES(sizes[i])
|
||||
#ifdef MZ_GC_BACKTRACE
|
||||
, alloc_counts[i], alloc_sizes[i]
|
||||
#endif
|
||||
);
|
||||
}
|
||||
accum_count += counts[i];
|
||||
accum_size += sizes[i];
|
||||
#ifdef MZ_GC_BACKTRACE
|
||||
accum_past_count += alloc_counts[i];
|
||||
accum_past_size += alloc_sizes[i];
|
||||
#endif
|
||||
if (i == _scheme_values_types_) {
|
||||
GCPRINT(GCOUTF, " %20.20s: %10" PRIdPTR " %10" PRIdPTR
|
||||
#ifdef MZ_GC_BACKTRACE
|
||||
" %10" PRIdPTR " %10" PRIdPTR
|
||||
#endif
|
||||
"\n",
|
||||
"=BYTECODE-TOTAL=", accum_count, gcWORDS_TO_BYTES(accum_size)
|
||||
#ifdef MZ_GC_BACKTRACE
|
||||
, accum_past_count, accum_past_size
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4052,6 +4052,7 @@ static void on_demand_generate_lambda(Scheme_Native_Closure *nc, Scheme_Native_L
|
|||
case_lam = ((Scheme_Native_Lambda_Plus_Case *)nlam)->case_lam;
|
||||
if (case_lam->max_let_depth < max_depth)
|
||||
case_lam->max_let_depth = max_depth;
|
||||
((Scheme_Native_Lambda_Plus_Case *)nlam)->case_lam = NULL;
|
||||
}
|
||||
|
||||
while (gdata.patch_depth) {
|
||||
|
@ -4098,6 +4099,11 @@ Scheme_Object **scheme_on_demand(Scheme_Object **rs)
|
|||
|
||||
void scheme_force_jit_generate(Scheme_Native_Lambda *nlam)
|
||||
{
|
||||
#ifdef MZTAG_REQUIRED
|
||||
MZ_ASSERT(SAME_TYPE(nlam->iso.so.type, scheme_rt_native_code)
|
||||
|| SAME_TYPE(nlam->iso.so.type, scheme_rt_native_code_plus_case));
|
||||
#endif
|
||||
|
||||
if (nlam->start_code == scheme_on_demand_jit_code)
|
||||
on_demand_generate_lambda(NULL, nlam, 0, NULL, 0);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "schpriv.h"
|
||||
#include "schrunst.h"
|
||||
#include "schmach.h"
|
||||
|
||||
THREAD_LOCAL_DECL(static Scheme_Object *current_linklet_native_lambdas);
|
||||
static int force_jit;
|
||||
|
@ -420,14 +421,26 @@ Scheme_Object *scheme_case_lambda_jit(Scheme_Object *expr)
|
|||
((Scheme_Lambda *)val)->name = name;
|
||||
if (((Scheme_Lambda *)val)->closure_size)
|
||||
all_closed = 0;
|
||||
if (current_linklet_native_lambdas)
|
||||
current_linklet_native_lambdas = scheme_make_pair(val, current_linklet_native_lambdas);
|
||||
}
|
||||
|
||||
/* Generating the code may cause empty closures to be formed: */
|
||||
ndata = scheme_generate_case_lambda(seqout);
|
||||
seqout->native_code = ndata;
|
||||
|
||||
if (current_linklet_native_lambdas) {
|
||||
for (i = 0; i < cnt; i++) {
|
||||
val = seqout->array[i];
|
||||
{
|
||||
/* Force jitprep on body, too, to discover all lambdas */
|
||||
Scheme_Object *body;
|
||||
body = jit_expr(((Scheme_Lambda *)val)->body);
|
||||
((Scheme_Lambda *)val)->body = body;
|
||||
}
|
||||
val = (Scheme_Object *)((Scheme_Lambda *)val)->u.native_code;
|
||||
current_linklet_native_lambdas = scheme_make_pair(val, current_linklet_native_lambdas);
|
||||
}
|
||||
}
|
||||
|
||||
if (all_closed) {
|
||||
/* Native closures do not refer back to the original bytecode,
|
||||
so no need to worry about clearing the reference. */
|
||||
|
@ -555,6 +568,13 @@ Scheme_Object *scheme_jit_closure(Scheme_Object *code, Scheme_Object *context)
|
|||
|
||||
if (!context)
|
||||
data->u.jit_clone = data2;
|
||||
|
||||
if (current_linklet_native_lambdas) {
|
||||
/* Force jitprep on body, too, to discover all lambdas */
|
||||
Scheme_Object *body;
|
||||
body = jit_expr(data2->body);
|
||||
data2->body = body;
|
||||
}
|
||||
}
|
||||
|
||||
/* If it's zero-sized, then create closure now */
|
||||
|
@ -571,10 +591,33 @@ Scheme_Object *scheme_jit_closure(Scheme_Object *code, Scheme_Object *context)
|
|||
/* expressions */
|
||||
/*========================================================================*/
|
||||
|
||||
static Scheme_Object *jit_expr_k(void)
|
||||
{
|
||||
Scheme_Thread *p = scheme_current_thread;
|
||||
Scheme_Object *expr = (Scheme_Object *)p->ku.k.p1;
|
||||
|
||||
p->ku.k.p1 = NULL;
|
||||
|
||||
return jit_expr(expr);
|
||||
}
|
||||
|
||||
static Scheme_Object *jit_expr(Scheme_Object *expr)
|
||||
{
|
||||
Scheme_Type type = SCHEME_TYPE(expr);
|
||||
|
||||
#ifdef DO_STACK_CHECK
|
||||
{
|
||||
# include "mzstkchk.h"
|
||||
{
|
||||
Scheme_Thread *p = scheme_current_thread;
|
||||
|
||||
p->ku.k.p1 = (void *)expr;
|
||||
|
||||
return scheme_handle_stack_overflow(jit_expr_k);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (type) {
|
||||
case scheme_application_type:
|
||||
return jit_application(expr);
|
||||
|
@ -642,6 +685,9 @@ Scheme_Linklet *scheme_jit_linklet(Scheme_Linklet *linklet, int step)
|
|||
Scheme_Object *bodies, *v;
|
||||
int i;
|
||||
|
||||
if (force_jit)
|
||||
step = 2;
|
||||
|
||||
if (!linklet->jit_ready) {
|
||||
new_linklet = MALLOC_ONE_TAGGED(Scheme_Linklet);
|
||||
memcpy(new_linklet, linklet, sizeof(Scheme_Linklet));
|
||||
|
|
|
@ -502,6 +502,18 @@ static Scheme_Object *eval_linklet(int argc, Scheme_Object **argv)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MZ_USE_JIT
|
||||
if (linklet->native_lambdas) {
|
||||
Scheme_Object *l;
|
||||
l = linklet->native_lambdas;
|
||||
linklet->native_lambdas = NULL;
|
||||
while (SCHEME_PAIRP(l)) {
|
||||
scheme_force_jit_generate((Scheme_Native_Lambda *)SCHEME_CAR(l));
|
||||
l = SCHEME_CDR(l);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return (Scheme_Object *)linklet;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user