aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2015-05-21 16:38:31 +0200
committerMike Pall <mike>2015-05-21 16:38:31 +0200
commit60fb3fe2b2f91b9e6f053004fd1118891a3e885f (patch)
tree4a56e2b39b2bd81a29609854695f539f3fa91cd7
parent4a146cac9a00f5a1a7877db847ff5ba03e7b7256 (diff)
downloadluajit-60fb3fe2b2f91b9e6f053004fd1118891a3e885f.tar.gz
luajit-60fb3fe2b2f91b9e6f053004fd1118891a3e885f.tar.bz2
luajit-60fb3fe2b2f91b9e6f053004fd1118891a3e885f.zip
Fix table allocation bump optimization.
-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 db3d89bb..69656568 100644
--- a/src/lj_jit.h
+++ b/src/lj_jit.h
@@ -293,6 +293,7 @@ typedef struct ScEvEntry {
293/* Reverse bytecode map (IRRef -> PC). Only for selected instructions. */ 293/* Reverse bytecode map (IRRef -> PC). Only for selected instructions. */
294typedef struct RBCHashEntry { 294typedef struct RBCHashEntry {
295 MRef pc; /* Bytecode PC. */ 295 MRef pc; /* Bytecode PC. */
296 GCRef pt; /* Prototype. */
296 IRRef ref; /* IR reference. */ 297 IRRef ref; /* IR reference. */
297} RBCHashEntry; 298} RBCHashEntry;
298 299
diff --git a/src/lj_record.c b/src/lj_record.c
index 19eff723..dc1bf835 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1157,7 +1157,7 @@ static void rec_idx_bump(jit_State *J, RecordIndex *ix)
1157 J->retryrec = 1; /* Abort the trace at the end of recording. */ 1157 J->retryrec = 1; /* Abort the trace at the end of recording. */
1158 } 1158 }
1159 } else if (ir->o == IR_TDUP) { 1159 } else if (ir->o == IR_TDUP) {
1160 GCtab *tpl = gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)bc_d(*pc))); 1160 GCtab *tpl = gco2tab(proto_kgc(&gcref(rbc->pt)->pt, ~(ptrdiff_t)bc_d(*pc)));
1161 /* Grow template table, but preserve keys with nil values. */ 1161 /* Grow template table, but preserve keys with nil values. */
1162 if (tb->asize > tpl->asize || (1u << nhbits)-1 > tpl->hmask) { 1162 if (tb->asize > tpl->asize || (1u << nhbits)-1 > tpl->hmask) {
1163 Node *node = noderef(tpl->node); 1163 Node *node = noderef(tpl->node);
@@ -1783,6 +1783,7 @@ static TRef rec_tnew(jit_State *J, uint32_t ah)
1783 tr = emitir(IRTG(IR_TNEW, IRT_TAB), asize, hbits); 1783 tr = emitir(IRTG(IR_TNEW, IRT_TAB), asize, hbits);
1784 J->rbchash[(tr & (RBCHASH_SLOTS-1))].ref = tref_ref(tr); 1784 J->rbchash[(tr & (RBCHASH_SLOTS-1))].ref = tref_ref(tr);
1785 setmref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pc, J->pc); 1785 setmref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pc, J->pc);
1786 setgcref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt));
1786 return tr; 1787 return tr;
1787} 1788}
1788 1789
@@ -2211,6 +2212,7 @@ void lj_record_ins(jit_State *J)
2211 lj_ir_ktab(J, gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)rc))), 0); 2212 lj_ir_ktab(J, gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)rc))), 0);
2212 J->rbchash[(rc & (RBCHASH_SLOTS-1))].ref = tref_ref(rc); 2213 J->rbchash[(rc & (RBCHASH_SLOTS-1))].ref = tref_ref(rc);
2213 setmref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pc, pc); 2214 setmref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pc, pc);
2215 setgcref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt));
2214 break; 2216 break;
2215 2217
2216 /* -- Calls and vararg handling ----------------------------------------- */ 2218 /* -- Calls and vararg handling ----------------------------------------- */