diff options
| author | Mike Pall <mike> | 2021-09-21 14:30:28 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2021-09-21 14:30:28 +0200 |
| commit | 191d87f5312925b1e88a170549064783fe2246f8 (patch) | |
| tree | 996fd24a4053b564e2720090ef9c21da1ecea81e | |
| parent | 1aa4af0b83fa2f1c8fb19ac168b2a06e3d3cea36 (diff) | |
| download | luajit-191d87f5312925b1e88a170549064783fe2246f8.tar.gz luajit-191d87f5312925b1e88a170549064783fe2246f8.tar.bz2 luajit-191d87f5312925b1e88a170549064783fe2246f8.zip | |
Fix ITERN blacklisting.
Reported by ExtReMLapin. #744
| -rw-r--r-- | src/lj_trace.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lj_trace.c b/src/lj_trace.c index be886f35..b0ea8486 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c | |||
| @@ -373,8 +373,13 @@ void lj_trace_freestate(global_State *g) | |||
| 373 | /* Blacklist a bytecode instruction. */ | 373 | /* Blacklist a bytecode instruction. */ |
| 374 | static void blacklist_pc(GCproto *pt, BCIns *pc) | 374 | static void blacklist_pc(GCproto *pt, BCIns *pc) |
| 375 | { | 375 | { |
| 376 | setbc_op(pc, (int)bc_op(*pc)+(int)BC_ILOOP-(int)BC_LOOP); | 376 | if (bc_op(*pc) == BC_ITERN) { |
| 377 | pt->flags |= PROTO_ILOOP; | 377 | setbc_op(pc, BC_ITERC); |
| 378 | setbc_op(pc+1+bc_j(pc[1]), BC_JMP); | ||
| 379 | } else { | ||
| 380 | setbc_op(pc, (int)bc_op(*pc)+(int)BC_ILOOP-(int)BC_LOOP); | ||
| 381 | pt->flags |= PROTO_ILOOP; | ||
| 382 | } | ||
| 378 | } | 383 | } |
| 379 | 384 | ||
| 380 | /* Penalize a bytecode instruction. */ | 385 | /* Penalize a bytecode instruction. */ |
| @@ -576,8 +581,7 @@ static int trace_abort(jit_State *J) | |||
| 576 | return 1; /* Retry ASM with new MCode area. */ | 581 | return 1; /* Retry ASM with new MCode area. */ |
| 577 | } | 582 | } |
| 578 | /* Penalize or blacklist starting bytecode instruction. */ | 583 | /* Penalize or blacklist starting bytecode instruction. */ |
| 579 | if (J->parent == 0 && !bc_isret(bc_op(J->cur.startins)) && | 584 | if (J->parent == 0 && !bc_isret(bc_op(J->cur.startins))) { |
| 580 | bc_op(J->cur.startins) != BC_ITERN) { | ||
| 581 | if (J->exitno == 0) { | 585 | if (J->exitno == 0) { |
| 582 | BCIns *startpc = mref(J->cur.startpc, BCIns); | 586 | BCIns *startpc = mref(J->cur.startpc, BCIns); |
| 583 | if (e == LJ_TRERR_RETRY) | 587 | if (e == LJ_TRERR_RETRY) |
