diff options
author | Mike Pall <mike> | 2011-01-22 20:32:23 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-01-22 20:32:23 +0100 |
commit | f529d22869429d458c5382cf6787f213d7bd5296 (patch) | |
tree | 54c17195b7a88a67907daffbc94caed4387b63a5 | |
parent | e985aeda84d8af63c4bfaa176c3312dfb2f7f230 (diff) | |
download | luajit-f529d22869429d458c5382cf6787f213d7bd5296.tar.gz luajit-f529d22869429d458c5382cf6787f213d7bd5296.tar.bz2 luajit-f529d22869429d458c5382cf6787f213d7bd5296.zip |
Another fix for the trace flush logic. I'll get this right someday.
Thanks to David Manura.
-rw-r--r-- | doc/ext_jit.html | 6 | ||||
-rw-r--r-- | src/lj_trace.c | 15 |
2 files changed, 12 insertions, 9 deletions
diff --git a/doc/ext_jit.html b/doc/ext_jit.html index fc494382..36e306a8 100644 --- a/doc/ext_jit.html +++ b/doc/ext_jit.html | |||
@@ -116,9 +116,9 @@ debugging purposes. | |||
116 | 116 | ||
117 | <h3 id="jit_flush_tr"><tt>jit.flush(tr)</tt></h3> | 117 | <h3 id="jit_flush_tr"><tt>jit.flush(tr)</tt></h3> |
118 | <p> | 118 | <p> |
119 | Flushes the specified root trace and all of its side traces from the cache. | 119 | Flushes the root trace, specified by its number, and all of its side |
120 | The code for the trace will be retained as long as there are any other | 120 | traces from the cache. The code for the trace will be retained as long |
121 | traces which link to it. | 121 | as there are any other traces which link to it. |
122 | </p> | 122 | </p> |
123 | 123 | ||
124 | <h3 id="jit_status"><tt>status, ... = jit.status()</tt></h3> | 124 | <h3 id="jit_status"><tt>status, ... = jit.status()</tt></h3> |
diff --git a/src/lj_trace.c b/src/lj_trace.c index c6e87bb5..612a41bc 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c | |||
@@ -194,8 +194,9 @@ static void trace_unpatch(jit_State *J, GCtrace *T) | |||
194 | lua_assert(bc_op(*pc) == BC_JFORI); | 194 | lua_assert(bc_op(*pc) == BC_JFORI); |
195 | setbc_op(pc, BC_FORI); | 195 | setbc_op(pc, BC_FORI); |
196 | break; | 196 | break; |
197 | case BC_JITERL: | ||
197 | case BC_JLOOP: | 198 | case BC_JLOOP: |
198 | lua_assert(op == BC_LOOP || bc_isret(op)); | 199 | lua_assert(op == BC_ITERL || op == BC_LOOP || bc_isret(op)); |
199 | *pc = T->startins; | 200 | *pc = T->startins; |
200 | break; | 201 | break; |
201 | case BC_JMP: | 202 | case BC_JMP: |
@@ -227,11 +228,13 @@ static void trace_flushroot(jit_State *J, GCtrace *T) | |||
227 | pt->trace = T->nextroot; | 228 | pt->trace = T->nextroot; |
228 | } else { /* Otherwise search in chain of root traces. */ | 229 | } else { /* Otherwise search in chain of root traces. */ |
229 | GCtrace *T2 = traceref(J, pt->trace); | 230 | GCtrace *T2 = traceref(J, pt->trace); |
230 | for (; T2->nextroot; T2 = traceref(J, T2->nextroot)) | 231 | if (T2) { |
231 | if (T2->nextroot == T->traceno) { | 232 | for (; T2->nextroot; T2 = traceref(J, T2->nextroot)) |
232 | T2->nextroot = T->nextroot; /* Unlink from chain. */ | 233 | if (T2->nextroot == T->traceno) { |
233 | break; | 234 | T2->nextroot = T->nextroot; /* Unlink from chain. */ |
234 | } | 235 | break; |
236 | } | ||
237 | } | ||
235 | } | 238 | } |
236 | } | 239 | } |
237 | 240 | ||