diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_dispatch.c | 3 | ||||
| -rw-r--r-- | src/lj_record.c | 19 | ||||
| -rw-r--r-- | src/lj_trace.c | 10 |
3 files changed, 17 insertions, 15 deletions
diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c index 7b3ff80b..83bb4fd8 100644 --- a/src/lj_dispatch.c +++ b/src/lj_dispatch.c | |||
| @@ -414,7 +414,8 @@ ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns *pc) | |||
| 414 | #if LJ_HASJIT | 414 | #if LJ_HASJIT |
| 415 | J->L = L; | 415 | J->L = L; |
| 416 | if ((uintptr_t)pc & 1) { /* Marker for hot call. */ | 416 | if ((uintptr_t)pc & 1) { /* Marker for hot call. */ |
| 417 | lj_trace_hot(J, (const BCIns *)((uintptr_t)pc & ~(uintptr_t)1)); | 417 | pc = (const BCIns *)((uintptr_t)pc & ~(uintptr_t)1); |
| 418 | lj_trace_hot(J, pc); | ||
| 418 | goto out; | 419 | goto out; |
| 419 | } else if (J->state != LJ_TRACE_IDLE && | 420 | } else if (J->state != LJ_TRACE_IDLE && |
| 420 | !(g->hookmask & (HOOK_GC|HOOK_VMEVENT))) { | 421 | !(g->hookmask & (HOOK_GC|HOOK_VMEVENT))) { |
diff --git a/src/lj_record.c b/src/lj_record.c index e5a8b208..f4bfd5f7 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
| @@ -2248,6 +2248,11 @@ static const BCIns *rec_setup_root(jit_State *J) | |||
| 2248 | J->maxslot = ra; | 2248 | J->maxslot = ra; |
| 2249 | pc++; | 2249 | pc++; |
| 2250 | break; | 2250 | break; |
| 2251 | case BC_FUNCF: | ||
| 2252 | /* No bytecode range check for root traces started by a hot call. */ | ||
| 2253 | J->maxslot = J->pt->numparams; | ||
| 2254 | pc++; | ||
| 2255 | break; | ||
| 2251 | default: | 2256 | default: |
| 2252 | lua_assert(0); | 2257 | lua_assert(0); |
| 2253 | break; | 2258 | break; |
| @@ -2370,15 +2375,11 @@ void lj_record_setup(jit_State *J) | |||
| 2370 | rec_stop(J, TRACE_INTERP); | 2375 | rec_stop(J, TRACE_INTERP); |
| 2371 | } else { /* Root trace. */ | 2376 | } else { /* Root trace. */ |
| 2372 | J->cur.root = 0; | 2377 | J->cur.root = 0; |
| 2373 | if (J->pc >= proto_bc(J->pt)) { /* Not a hot CALL? */ | 2378 | J->cur.startins = *J->pc; |
| 2374 | J->cur.startins = *J->pc; | 2379 | J->pc = rec_setup_root(J); |
| 2375 | J->pc = rec_setup_root(J); | 2380 | /* Note: the loop instruction itself is recorded at the end and not |
| 2376 | /* Note: the loop instruction itself is recorded at the end and not | 2381 | ** at the start! So snapshot #0 needs to point to the *next* instruction. |
| 2377 | ** at the start! So snapshot #0 needs to point to the *next* instruction. | 2382 | */ |
| 2378 | */ | ||
| 2379 | } else { | ||
| 2380 | J->cur.startins = BCINS_ABC(BC_CALL, 0, 0, 0); | ||
| 2381 | } | ||
| 2382 | lj_snap_add(J); | 2383 | lj_snap_add(J); |
| 2383 | if (bc_op(J->cur.startins) == BC_FORL) | 2384 | if (bc_op(J->cur.startins) == BC_FORL) |
| 2384 | rec_setup_forl(J, J->pc-1); | 2385 | rec_setup_forl(J, J->pc-1); |
diff --git a/src/lj_trace.c b/src/lj_trace.c index ae88f844..3773cffe 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c | |||
| @@ -163,6 +163,7 @@ static void trace_unpatch(jit_State *J, Trace *T) | |||
| 163 | BCOp op = bc_op(T->startins); | 163 | BCOp op = bc_op(T->startins); |
| 164 | MSize pcofs = T->snap[0].mapofs + T->snap[0].nent; | 164 | MSize pcofs = T->snap[0].mapofs + T->snap[0].nent; |
| 165 | BCIns *pc = ((BCIns *)snap_pc(T->snapmap[pcofs])) - 1; | 165 | BCIns *pc = ((BCIns *)snap_pc(T->snapmap[pcofs])) - 1; |
| 166 | UNUSED(J); | ||
| 166 | switch (op) { | 167 | switch (op) { |
| 167 | case BC_FORL: | 168 | case BC_FORL: |
| 168 | lua_assert(bc_op(*pc) == BC_JFORI); | 169 | lua_assert(bc_op(*pc) == BC_JFORI); |
| @@ -181,8 +182,9 @@ static void trace_unpatch(jit_State *J, Trace *T) | |||
| 181 | lua_assert(bc_op(*pc) == BC_JITERL && J->trace[bc_d(*pc)] == T); | 182 | lua_assert(bc_op(*pc) == BC_JITERL && J->trace[bc_d(*pc)] == T); |
| 182 | *pc = T->startins; | 183 | *pc = T->startins; |
| 183 | break; | 184 | break; |
| 184 | case BC_CALL: | 185 | case BC_FUNCF: |
| 185 | lj_trace_err(J, LJ_TRERR_NYILNKF); | 186 | lua_assert(bc_op(*pc) == BC_JFUNCF && J->trace[bc_d(*pc)] == T); |
| 187 | *pc = T->startins; | ||
| 186 | break; | 188 | break; |
| 187 | case BC_JMP: /* No need to unpatch branches in parent traces (yet). */ | 189 | case BC_JMP: /* No need to unpatch branches in parent traces (yet). */ |
| 188 | default: | 190 | default: |
| @@ -384,6 +386,7 @@ static void trace_stop(jit_State *J) | |||
| 384 | /* fallthrough */ | 386 | /* fallthrough */ |
| 385 | case BC_LOOP: | 387 | case BC_LOOP: |
| 386 | case BC_ITERL: | 388 | case BC_ITERL: |
| 389 | case BC_FUNCF: | ||
| 387 | /* Patch bytecode of starting instruction in root trace. */ | 390 | /* Patch bytecode of starting instruction in root trace. */ |
| 388 | setbc_op(pc, (int)op+(int)BC_JLOOP-(int)BC_LOOP); | 391 | setbc_op(pc, (int)op+(int)BC_JLOOP-(int)BC_LOOP); |
| 389 | setbc_d(pc, J->curtrace); | 392 | setbc_d(pc, J->curtrace); |
| @@ -391,9 +394,6 @@ static void trace_stop(jit_State *J) | |||
| 391 | J->cur.nextroot = pt->trace; | 394 | J->cur.nextroot = pt->trace; |
| 392 | pt->trace = (TraceNo1)J->curtrace; | 395 | pt->trace = (TraceNo1)J->curtrace; |
| 393 | break; | 396 | break; |
| 394 | case BC_CALL: | ||
| 395 | lj_trace_err(J, LJ_TRERR_NYILNKF); | ||
| 396 | break; | ||
| 397 | case BC_JMP: | 397 | case BC_JMP: |
| 398 | /* Patch exit branch in parent to side trace entry. */ | 398 | /* Patch exit branch in parent to side trace entry. */ |
| 399 | lua_assert(J->parent != 0 && J->cur.root != 0); | 399 | lua_assert(J->parent != 0 && J->cur.root != 0); |
