aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2016-06-27 15:46:09 +0200
committerMike Pall <mike>2016-06-27 15:46:09 +0200
commit01e4754962130dc85802a9738707d7fdb76c879c (patch)
treee9c07ab27ed0141baf3e8f7325f34dc82bb4706e
parentce30766b67a36e76acd321d69cbd2b0db9c89ee0 (diff)
downloadluajit-01e4754962130dc85802a9738707d7fdb76c879c.tar.gz
luajit-01e4754962130dc85802a9738707d7fdb76c879c.tar.bz2
luajit-01e4754962130dc85802a9738707d7fdb76c879c.zip
Properly clean up state before restart of trace assembly.
-rw-r--r--src/lj_asm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index dba5c178..7ce58924 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -1993,12 +1993,6 @@ static void asm_setup_regsp(ASMState *as)
1993 /* REF_BASE is used for implicit references to the BASE register. */ 1993 /* REF_BASE is used for implicit references to the BASE register. */
1994 lastir->prev = REGSP_HINT(RID_BASE); 1994 lastir->prev = REGSP_HINT(RID_BASE);
1995 1995
1996 ir = IR(nins-1);
1997 if (ir->o == IR_RENAME) {
1998 /* Remove any renames left over from ASM restart due to LJ_TRERR_MCODELM. */
1999 do { ir--; nins--; } while (ir->o == IR_RENAME);
2000 T->nins = nins;
2001 }
2002 as->snaprename = nins; 1996 as->snaprename = nins;
2003 as->snapref = nins; 1997 as->snapref = nins;
2004 as->snapno = T->nsnap; 1998 as->snapno = T->nsnap;
@@ -2230,6 +2224,16 @@ void lj_asm_trace(jit_State *J, GCtrace *T)
2230 ASMState *as = &as_; 2224 ASMState *as = &as_;
2231 MCode *origtop; 2225 MCode *origtop;
2232 2226
2227 /* Remove nops/renames left over from ASM restart due to LJ_TRERR_MCODELM. */
2228 {
2229 IRRef nins = T->nins;
2230 IRIns *ir = &T->ir[nins-1];
2231 if (ir->o == IR_NOP || ir->o == IR_RENAME) {
2232 do { ir--; nins--; } while (ir->o == IR_NOP || ir->o == IR_RENAME);
2233 T->nins = nins;
2234 }
2235 }
2236
2233 /* Ensure an initialized instruction beyond the last one for HIOP checks. */ 2237 /* Ensure an initialized instruction beyond the last one for HIOP checks. */
2234 /* This also allows one RENAME to be added without reallocating curfinal. */ 2238 /* This also allows one RENAME to be added without reallocating curfinal. */
2235 as->orignins = lj_ir_nextins(J); 2239 as->orignins = lj_ir_nextins(J);