aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2014-03-27 23:29:30 +0100
committerMike Pall <mike>2014-03-27 23:29:30 +0100
commit095344ce7ca1f8eb30987086a2b4dc78b9d813e6 (patch)
treeb2919d8cc77fbdaafde8322583c0469b93fd60a0 /src
parentc03be1210c5334e58958d95ea0412c20c3eb0128 (diff)
downloadluajit-095344ce7ca1f8eb30987086a2b4dc78b9d813e6.tar.gz
luajit-095344ce7ca1f8eb30987086a2b4dc78b9d813e6.tar.bz2
luajit-095344ce7ca1f8eb30987086a2b4dc78b9d813e6.zip
Fix check for reuse of SCEV results in FORL.
Diffstat (limited to 'src')
-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 b69e4f4e..ecd79de5 100644
--- a/src/lj_jit.h
+++ b/src/lj_jit.h
@@ -279,6 +279,7 @@ typedef struct BPropEntry {
279 279
280/* Scalar evolution analysis cache. */ 280/* Scalar evolution analysis cache. */
281typedef struct ScEvEntry { 281typedef struct ScEvEntry {
282 MRef pc; /* Bytecode PC of FORI. */
282 IRRef1 idx; /* Index reference. */ 283 IRRef1 idx; /* Index reference. */
283 IRRef1 start; /* Constant start reference. */ 284 IRRef1 start; /* Constant start reference. */
284 IRRef1 stop; /* Constant stop reference. */ 285 IRRef1 stop; /* Constant stop reference. */
diff --git a/src/lj_record.c b/src/lj_record.c
index c6848fc0..95957d31 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -421,6 +421,7 @@ static void rec_for_loop(jit_State *J, const BCIns *fori, ScEvEntry *scev,
421 J->base[ra+FORL_IDX] = idx = emitir(IRT(IR_ADD, t), idx, step); 421 J->base[ra+FORL_IDX] = idx = emitir(IRT(IR_ADD, t), idx, step);
422 J->base[ra+FORL_EXT] = idx; 422 J->base[ra+FORL_EXT] = idx;
423 scev->idx = tref_ref(idx); 423 scev->idx = tref_ref(idx);
424 setmref(scev->pc, fori);
424 J->maxslot = ra+FORL_EXT+1; 425 J->maxslot = ra+FORL_EXT+1;
425} 426}
426 427
@@ -436,7 +437,7 @@ static LoopEvent rec_for(jit_State *J, const BCIns *fori, int isforl)
436 IRType t; 437 IRType t;
437 if (isforl) { /* Handle FORL/JFORL opcodes. */ 438 if (isforl) { /* Handle FORL/JFORL opcodes. */
438 TRef idx = tr[FORL_IDX]; 439 TRef idx = tr[FORL_IDX];
439 if (tref_ref(idx) == J->scev.idx) { 440 if (mref(J->scev.pc, const BCIns) == fori) {
440 t = J->scev.t.irt; 441 t = J->scev.t.irt;
441 stop = J->scev.stop; 442 stop = J->scev.stop;
442 idx = emitir(IRT(IR_ADD, t), idx, J->scev.step); 443 idx = emitir(IRT(IR_ADD, t), idx, J->scev.step);
@@ -2153,6 +2154,7 @@ void lj_record_setup(jit_State *J)
2153 memset(J->chain, 0, sizeof(J->chain)); 2154 memset(J->chain, 0, sizeof(J->chain));
2154 memset(J->bpropcache, 0, sizeof(J->bpropcache)); 2155 memset(J->bpropcache, 0, sizeof(J->bpropcache));
2155 J->scev.idx = REF_NIL; 2156 J->scev.idx = REF_NIL;
2157 setmref(J->scev.pc, NULL);
2156 2158
2157 J->baseslot = 1; /* Invoking function is at base[-1]. */ 2159 J->baseslot = 1; /* Invoking function is at base[-1]. */
2158 J->base = J->slot + J->baseslot; 2160 J->base = J->slot + J->baseslot;