|
@@ -421,6 +421,7 @@ static void rec_for_loop(jit_State *J, const BCIns *fori, ScEvEntry *scev,
|
|
J->base[ra+FORL_IDX] = idx = emitir(IRT(IR_ADD, t), idx, step);
|
|
J->base[ra+FORL_IDX] = idx = emitir(IRT(IR_ADD, t), idx, step);
|
|
J->base[ra+FORL_EXT] = idx;
|
|
J->base[ra+FORL_EXT] = idx;
|
|
scev->idx = tref_ref(idx);
|
|
scev->idx = tref_ref(idx);
|
|
|
|
+ setmref(scev->pc, fori);
|
|
J->maxslot = ra+FORL_EXT+1;
|
|
J->maxslot = ra+FORL_EXT+1;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -436,7 +437,7 @@ static LoopEvent rec_for(jit_State *J, const BCIns *fori, int isforl)
|
|
IRType t;
|
|
IRType t;
|
|
if (isforl) { /* Handle FORL/JFORL opcodes. */
|
|
if (isforl) { /* Handle FORL/JFORL opcodes. */
|
|
TRef idx = tr[FORL_IDX];
|
|
TRef idx = tr[FORL_IDX];
|
|
- if (tref_ref(idx) == J->scev.idx) {
|
|
|
|
|
|
+ if (mref(J->scev.pc, const BCIns) == fori) {
|
|
t = J->scev.t.irt;
|
|
t = J->scev.t.irt;
|
|
stop = J->scev.stop;
|
|
stop = J->scev.stop;
|
|
idx = emitir(IRT(IR_ADD, t), idx, J->scev.step);
|
|
idx = emitir(IRT(IR_ADD, t), idx, J->scev.step);
|
|
@@ -2153,6 +2154,7 @@ void lj_record_setup(jit_State *J)
|
|
memset(J->chain, 0, sizeof(J->chain));
|
|
memset(J->chain, 0, sizeof(J->chain));
|
|
memset(J->bpropcache, 0, sizeof(J->bpropcache));
|
|
memset(J->bpropcache, 0, sizeof(J->bpropcache));
|
|
J->scev.idx = REF_NIL;
|
|
J->scev.idx = REF_NIL;
|
|
|
|
+ setmref(J->scev.pc, NULL);
|
|
|
|
|
|
J->baseslot = 1; /* Invoking function is at base[-1]. */
|
|
J->baseslot = 1; /* Invoking function is at base[-1]. */
|
|
J->base = J->slot + J->baseslot;
|
|
J->base = J->slot + J->baseslot;
|