Another fix for the trace flush logic. I'll get this right someday.

Thanks to David Manura.
This commit is contained in:
Mike Pall 2011-01-22 20:32:23 +01:00
parent e985aeda84
commit f529d22869
2 changed files with 12 additions and 9 deletions

View File

@ -116,9 +116,9 @@ debugging purposes.
<h3 id="jit_flush_tr"><tt>jit.flush(tr)</tt></h3> <h3 id="jit_flush_tr"><tt>jit.flush(tr)</tt></h3>
<p> <p>
Flushes the specified root trace and all of its side traces from the cache. Flushes the root trace, specified by its number, and all of its side
The code for the trace will be retained as long as there are any other traces from the cache. The code for the trace will be retained as long
traces which link to it. as there are any other traces which link to it.
</p> </p>
<h3 id="jit_status"><tt>status, ... = jit.status()</tt></h3> <h3 id="jit_status"><tt>status, ... = jit.status()</tt></h3>

View File

@ -194,8 +194,9 @@ static void trace_unpatch(jit_State *J, GCtrace *T)
lua_assert(bc_op(*pc) == BC_JFORI); lua_assert(bc_op(*pc) == BC_JFORI);
setbc_op(pc, BC_FORI); setbc_op(pc, BC_FORI);
break; break;
case BC_JITERL:
case BC_JLOOP: case BC_JLOOP:
lua_assert(op == BC_LOOP || bc_isret(op)); lua_assert(op == BC_ITERL || op == BC_LOOP || bc_isret(op));
*pc = T->startins; *pc = T->startins;
break; break;
case BC_JMP: case BC_JMP:
@ -227,11 +228,13 @@ static void trace_flushroot(jit_State *J, GCtrace *T)
pt->trace = T->nextroot; pt->trace = T->nextroot;
} else { /* Otherwise search in chain of root traces. */ } else { /* Otherwise search in chain of root traces. */
GCtrace *T2 = traceref(J, pt->trace); GCtrace *T2 = traceref(J, pt->trace);
for (; T2->nextroot; T2 = traceref(J, T2->nextroot)) if (T2) {
if (T2->nextroot == T->traceno) { for (; T2->nextroot; T2 = traceref(J, T2->nextroot))
T2->nextroot = T->nextroot; /* Unlink from chain. */ if (T2->nextroot == T->traceno) {
break; T2->nextroot = T->nextroot; /* Unlink from chain. */
} break;
}
}
} }
} }