aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2022-06-02 13:18:10 +0200
committerMike Pall <mike>2022-06-02 13:18:10 +0200
commitd4b6bb80ea3b26c4c65b568c1b808ee848f19221 (patch)
treeec095bd89178cc03dc4c169ea2cdaafae370fe93 /src
parent1b8d8cabdcc4f1977dc8c51a82074653078d870b (diff)
downloadluajit-d4b6bb80ea3b26c4c65b568c1b808ee848f19221.tar.gz
luajit-d4b6bb80ea3b26c4c65b568c1b808ee848f19221.tar.bz2
luajit-d4b6bb80ea3b26c4c65b568c1b808ee848f19221.zip
Fix ITERN loop detection when hook checks are enabled.
Reported by Myria.
Diffstat (limited to 'src')
-rw-r--r--src/lj_record.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index 533f4995..faa9a508 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -664,12 +664,17 @@ static LoopEvent rec_itern(jit_State *J, BCReg ra, BCReg rb)
664 RecordIndex ix; 664 RecordIndex ix;
665 /* Since ITERN is recorded at the start, we need our own loop detection. */ 665 /* Since ITERN is recorded at the start, we need our own loop detection. */
666 if (J->pc == J->startpc && 666 if (J->pc == J->startpc &&
667 (J->cur.nins > REF_FIRST+1 ||
668 (J->cur.nins == REF_FIRST+1 && J->cur.ir[REF_FIRST].o != IR_PROF)) &&
669 J->framedepth + J->retdepth == 0 && J->parent == 0 && J->exitno == 0) { 667 J->framedepth + J->retdepth == 0 && J->parent == 0 && J->exitno == 0) {
670 J->instunroll = 0; /* Cannot continue unrolling across an ITERN. */ 668 IRRef ref = REF_FIRST + LJ_HASPROFILE;
671 lj_record_stop(J, LJ_TRLINK_LOOP, J->cur.traceno); /* Looping trace. */ 669#ifdef LUAJIT_ENABLE_CHECKHOOK
672 return LOOPEV_ENTER; 670 ref += 3;
671#endif
672 if (J->cur.nins > ref ||
673 (LJ_HASPROFILE && J->cur.nins == ref && J->cur.ir[ref-1].o != IR_PROF)) {
674 J->instunroll = 0; /* Cannot continue unrolling across an ITERN. */
675 lj_record_stop(J, LJ_TRLINK_LOOP, J->cur.traceno); /* Looping trace. */
676 return LOOPEV_ENTER;
677 }
673 } 678 }
674 J->maxslot = ra; 679 J->maxslot = ra;
675 lj_snap_add(J); /* Required to make JLOOP the first ins in a side-trace. */ 680 lj_snap_add(J); /* Required to make JLOOP the first ins in a side-trace. */