From 60fb3fe2b2f91b9e6f053004fd1118891a3e885f Mon Sep 17 00:00:00 2001 From: Mike Pall <mike> Date: Thu, 21 May 2015 16:38:31 +0200 Subject: Fix table allocation bump optimization. --- src/lj_jit.h | 1 + src/lj_record.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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 { /* Reverse bytecode map (IRRef -> PC). Only for selected instructions. */ typedef struct RBCHashEntry { MRef pc; /* Bytecode PC. */ + GCRef pt; /* Prototype. */ IRRef ref; /* IR reference. */ } RBCHashEntry; 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) J->retryrec = 1; /* Abort the trace at the end of recording. */ } } else if (ir->o == IR_TDUP) { - GCtab *tpl = gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)bc_d(*pc))); + GCtab *tpl = gco2tab(proto_kgc(&gcref(rbc->pt)->pt, ~(ptrdiff_t)bc_d(*pc))); /* Grow template table, but preserve keys with nil values. */ if (tb->asize > tpl->asize || (1u << nhbits)-1 > tpl->hmask) { Node *node = noderef(tpl->node); @@ -1783,6 +1783,7 @@ static TRef rec_tnew(jit_State *J, uint32_t ah) tr = emitir(IRTG(IR_TNEW, IRT_TAB), asize, hbits); J->rbchash[(tr & (RBCHASH_SLOTS-1))].ref = tref_ref(tr); setmref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pc, J->pc); + setgcref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt)); return tr; } @@ -2211,6 +2212,7 @@ void lj_record_ins(jit_State *J) lj_ir_ktab(J, gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)rc))), 0); J->rbchash[(rc & (RBCHASH_SLOTS-1))].ref = tref_ref(rc); setmref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pc, pc); + setgcref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt)); break; /* -- Calls and vararg handling ----------------------------------------- */ -- cgit v1.2.3-55-g6feb