fix JIT bug
that caused incorrect compilation of a non-tail call as a self non-tail call (but why hasn't this deep and old bug caused more trouble over the years?)
This commit is contained in:
parent
69ad39d45c
commit
0025ff968d
|
@ -1513,7 +1513,7 @@ static int generate_branch(Scheme_Object *obj, mz_jit_state *jitter, int is_tail
|
||||||
GC_CAN_IGNORE jit_insn *ref2;
|
GC_CAN_IGNORE jit_insn *ref2;
|
||||||
int pushed_marks;
|
int pushed_marks;
|
||||||
int nsrs, nsrs1, g1, g2, amt, need_sync, flostack, flostack_pos;
|
int nsrs, nsrs1, g1, g2, amt, need_sync, flostack, flostack_pos;
|
||||||
int else_is_empty = 0, i, can_chain_branch, chain_true, chain_false;
|
int else_is_empty = 0, i, can_chain_branch, chain_true, chain_false, old_self_pos;
|
||||||
#ifdef NEED_LONG_JUMPS
|
#ifdef NEED_LONG_JUMPS
|
||||||
int then_short_ok, else_short_ok;
|
int then_short_ok, else_short_ok;
|
||||||
#else
|
#else
|
||||||
|
@ -1533,6 +1533,8 @@ static int generate_branch(Scheme_Object *obj, mz_jit_state *jitter, int is_tail
|
||||||
else_short_ok = (is_short(branch->fbranch, 32) > 0);
|
else_short_ok = (is_short(branch->fbranch, 32) > 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
old_self_pos = jitter->self_pos;
|
||||||
|
|
||||||
for_this_branch.addrs = addrs;
|
for_this_branch.addrs = addrs;
|
||||||
for_this_branch.addrs_size = NUM_QUICK_INFO_ADDRS;
|
for_this_branch.addrs_size = NUM_QUICK_INFO_ADDRS;
|
||||||
for_this_branch.addrs_count = 0;
|
for_this_branch.addrs_count = 0;
|
||||||
|
@ -1648,6 +1650,9 @@ static int generate_branch(Scheme_Object *obj, mz_jit_state *jitter, int is_tail
|
||||||
jitter->pushed_marks = pushed_marks;
|
jitter->pushed_marks = pushed_marks;
|
||||||
if (need_sync) mz_rs_sync_0();
|
if (need_sync) mz_rs_sync_0();
|
||||||
|
|
||||||
|
if (old_self_pos != jitter->self_pos)
|
||||||
|
scheme_signal_error("internal error: self position moved across branch");
|
||||||
|
|
||||||
/* False branch */
|
/* False branch */
|
||||||
mz_CLEAR_R0_STATUS();
|
mz_CLEAR_R0_STATUS();
|
||||||
scheme_mz_runstack_saved(jitter);
|
scheme_mz_runstack_saved(jitter);
|
||||||
|
@ -3190,7 +3195,7 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
|
||||||
? NATIVE_IS_SINGLE_RESULT
|
? NATIVE_IS_SINGLE_RESULT
|
||||||
: 0)));
|
: 0)));
|
||||||
if (SAME_OBJ(lr->procs[pos], (Scheme_Object *)data)) {
|
if (SAME_OBJ(lr->procs[pos], (Scheme_Object *)data)) {
|
||||||
self_pos = i;
|
self_pos = i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_FLONUM_UNBOXING
|
#ifdef USE_FLONUM_UNBOXING
|
||||||
|
|
|
@ -476,6 +476,9 @@ int scheme_mz_compute_runstack_restored(mz_jit_state *jitter, int adj, int skip)
|
||||||
c >>= 2;
|
c >>= 2;
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
amt += c;
|
amt += c;
|
||||||
|
else {
|
||||||
|
if (adj) jitter->self_pos += c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (c & 0x2) {
|
} else if (c & 0x2) {
|
||||||
/* single procedure */
|
/* single procedure */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user