summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lj_jit.h1
-rw-r--r--src/lj_record.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/src/lj_jit.h b/src/lj_jit.h
index 0b786c2f..4246e9db 100644
--- a/src/lj_jit.h
+++ b/src/lj_jit.h
@@ -278,6 +278,7 @@ typedef struct BPropEntry {
278 278
279/* Scalar evolution analysis cache. */ 279/* Scalar evolution analysis cache. */
280typedef struct ScEvEntry { 280typedef struct ScEvEntry {
281 MRef pc; /* Bytecode PC of FORI. */
281 IRRef1 idx; /* Index reference. */ 282 IRRef1 idx; /* Index reference. */
282 IRRef1 start; /* Constant start reference. */ 283 IRRef1 start; /* Constant start reference. */
283 IRRef1 stop; /* Constant stop reference. */ 284 IRRef1 stop; /* Constant stop reference. */
diff --git a/src/lj_record.c b/src/lj_record.c
index dbc096a2..ca833df2 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -424,6 +424,7 @@ static void rec_for_loop(jit_State *J, const BCIns *fori, ScEvEntry *scev,
424 J->base[ra+FORL_IDX] = idx = emitir(IRT(IR_ADD, t), idx, step); 424 J->base[ra+FORL_IDX] = idx = emitir(IRT(IR_ADD, t), idx, step);
425 J->base[ra+FORL_EXT] = idx; 425 J->base[ra+FORL_EXT] = idx;
426 scev->idx = tref_ref(idx); 426 scev->idx = tref_ref(idx);
427 setmref(scev->pc, fori);
427 J->maxslot = ra+FORL_EXT+1; 428 J->maxslot = ra+FORL_EXT+1;
428} 429}
429 430
@@ -439,7 +440,7 @@ static LoopEvent rec_for(jit_State *J, const BCIns *fori, int isforl)
439 IRType t; 440 IRType t;
440 if (isforl) { /* Handle FORL/JFORL opcodes. */ 441 if (isforl) { /* Handle FORL/JFORL opcodes. */
441 TRef idx = tr[FORL_IDX]; 442 TRef idx = tr[FORL_IDX];
442 if (tref_ref(idx) == J->scev.idx) { 443 if (mref(J->scev.pc, const BCIns) == fori) {
443 t = J->scev.t.irt; 444 t = J->scev.t.irt;
444 stop = J->scev.stop; 445 stop = J->scev.stop;
445 idx = emitir(IRT(IR_ADD, t), idx, J->scev.step); 446 idx = emitir(IRT(IR_ADD, t), idx, J->scev.step);
@@ -2336,6 +2337,7 @@ void lj_record_setup(jit_State *J)
2336 memset(J->chain, 0, sizeof(J->chain)); 2337 memset(J->chain, 0, sizeof(J->chain));
2337 memset(J->bpropcache, 0, sizeof(J->bpropcache)); 2338 memset(J->bpropcache, 0, sizeof(J->bpropcache));
2338 J->scev.idx = REF_NIL; 2339 J->scev.idx = REF_NIL;
2340 setmref(J->scev.pc, NULL);
2339 2341
2340 J->baseslot = 1; /* Invoking function is at base[-1]. */ 2342 J->baseslot = 1; /* Invoking function is at base[-1]. */
2341 J->base = J->slot + J->baseslot; 2343 J->base = J->slot + J->baseslot;