aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2010-02-18 17:17:50 +0100
committerMike Pall <mike>2010-02-18 17:17:50 +0100
commit65586ca4dcbcffe08f96aee69ac22374c32c6e8a (patch)
tree115988f9da4d6eeeaff0a6d8e97567f8f4ed45b7
parent59f54be9d362514724b033d3f2959f215b05957f (diff)
downloadluajit-65586ca4dcbcffe08f96aee69ac22374c32c6e8a.tar.gz
luajit-65586ca4dcbcffe08f96aee69ac22374c32c6e8a.tar.bz2
luajit-65586ca4dcbcffe08f96aee69ac22374c32c6e8a.zip
Adapt bytecode patching/unpatching for hot calls.
-rw-r--r--src/lj_trace.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lj_trace.c b/src/lj_trace.c
index 3773cffe..3b137164 100644
--- a/src/lj_trace.c
+++ b/src/lj_trace.c
@@ -149,7 +149,9 @@ void lj_trace_reenableproto(GCproto *pt)
149 BCIns *bc = proto_bc(pt); 149 BCIns *bc = proto_bc(pt);
150 BCPos i, sizebc = pt->sizebc;; 150 BCPos i, sizebc = pt->sizebc;;
151 pt->flags &= ~PROTO_HAS_ILOOP; 151 pt->flags &= ~PROTO_HAS_ILOOP;
152 for (i = 0; i < sizebc; i++) { 152 if (bc_op(bc[0]) == BC_IFUNCF)
153 setbc_op(&bc[0], BC_FUNCF);
154 for (i = 1; i < sizebc; i++) {
153 BCOp op = bc_op(bc[i]); 155 BCOp op = bc_op(bc[i]);
154 if (op == BC_IFORL || op == BC_IITERL || op == BC_ILOOP) 156 if (op == BC_IFORL || op == BC_IITERL || op == BC_ILOOP)
155 setbc_op(&bc[i], (int)op+(int)BC_LOOP-(int)BC_ILOOP); 157 setbc_op(&bc[i], (int)op+(int)BC_LOOP-(int)BC_ILOOP);
@@ -325,14 +327,9 @@ static void trace_start(jit_State *J)
325 327
326 if ((J->pt->flags & PROTO_NO_JIT)) { /* JIT disabled for this proto? */ 328 if ((J->pt->flags & PROTO_NO_JIT)) { /* JIT disabled for this proto? */
327 if (J->parent == 0) { 329 if (J->parent == 0) {
328 if (J->pc >= proto_bc(J->pt)) { 330 /* Lazy bytecode patching to disable hotcount events. */
329 /* Lazy bytecode patching to disable hotcount events. */ 331 setbc_op(J->pc, (int)bc_op(*J->pc)+(int)BC_ILOOP-(int)BC_LOOP);
330 setbc_op(J->pc, (int)bc_op(*J->pc)+(int)BC_ILOOP-(int)BC_LOOP); 332 J->pt->flags |= PROTO_HAS_ILOOP;
331 J->pt->flags |= PROTO_HAS_ILOOP;
332 } else {
333 /* NYI: lazy closure patching to disable hotcall events. */
334 lua_assert(0);
335 }
336 } 333 }
337 J->state = LJ_TRACE_IDLE; /* Silently ignored. */ 334 J->state = LJ_TRACE_IDLE; /* Silently ignored. */
338 return; 335 return;