ASMState *as = &as_;
MCode *origtop;
+ /* Remove nops/renames left over from ASM restart due to LJ_TRERR_MCODELM. */
+ {
+ IRRef nins = T->nins;
+ IRIns *ir = &T->ir[nins-1];
+ if (ir->o == IR_NOP || ir->o == IR_RENAME) {
+ do { ir--; nins--; } while (ir->o == IR_NOP || ir->o == IR_RENAME);
+ T->nins = nins;
+ }
+ }
+
/* Ensure an initialized instruction beyond the last one for HIOP checks. */
- J->cur.nins = lj_ir_nextins(J);
- lj_ir_nop(&J->cur.ir[J->cur.nins]);
+ /* This also allows one RENAME to be added without reallocating curfinal. */
+ as->orignins = lj_ir_nextins(J);
- J->cur.ir[as->orignins].o = IR_NOP;
++ lj_ir_nop(&J->cur.ir[as->orignins]);
/* Setup initial state. Copy some fields to reduce indirections. */
as->J = J;