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;
|
||||
int pushed_marks;
|
||||
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
|
||||
int then_short_ok, else_short_ok;
|
||||
#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);
|
||||
#endif
|
||||
|
||||
old_self_pos = jitter->self_pos;
|
||||
|
||||
for_this_branch.addrs = addrs;
|
||||
for_this_branch.addrs_size = NUM_QUICK_INFO_ADDRS;
|
||||
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;
|
||||
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 */
|
||||
mz_CLEAR_R0_STATUS();
|
||||
scheme_mz_runstack_saved(jitter);
|
||||
|
|
|
@ -476,6 +476,9 @@ int scheme_mz_compute_runstack_restored(mz_jit_state *jitter, int adj, int skip)
|
|||
c >>= 2;
|
||||
if (c > 0)
|
||||
amt += c;
|
||||
else {
|
||||
if (adj) jitter->self_pos += c;
|
||||
}
|
||||
}
|
||||
} else if (c & 0x2) {
|
||||
/* single procedure */
|
||||
|
|
Loading…
Reference in New Issue
Block a user