diff options
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r-- | src/lj_asm.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index 985f0cef..c51cc89d 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -1842,26 +1842,24 @@ static void asm_newref(ASMState *as, IRIns *ir) | |||
1842 | static void asm_uref(ASMState *as, IRIns *ir) | 1842 | static void asm_uref(ASMState *as, IRIns *ir) |
1843 | { | 1843 | { |
1844 | /* NYI: Check that UREFO is still open and not aliasing a slot. */ | 1844 | /* NYI: Check that UREFO is still open and not aliasing a slot. */ |
1845 | if (ra_used(ir)) { | 1845 | Reg dest = ra_dest(as, ir, RSET_GPR); |
1846 | Reg dest = ra_dest(as, ir, RSET_GPR); | 1846 | if (irref_isk(ir->op1)) { |
1847 | if (irref_isk(ir->op1)) { | 1847 | GCfunc *fn = ir_kfunc(IR(ir->op1)); |
1848 | GCfunc *fn = ir_kfunc(IR(ir->op1)); | 1848 | MRef *v = &gcref(fn->l.uvptr[(ir->op2 >> 8)])->uv.v; |
1849 | MRef *v = &gcref(fn->l.uvptr[(ir->op2 >> 8)])->uv.v; | 1849 | emit_rma(as, XO_MOV, dest, v); |
1850 | emit_rma(as, XO_MOV, dest, v); | 1850 | } else { |
1851 | Reg uv = ra_scratch(as, RSET_GPR); | ||
1852 | Reg func = ra_alloc1(as, ir->op1, RSET_GPR); | ||
1853 | if (ir->o == IR_UREFC) { | ||
1854 | emit_rmro(as, XO_LEA, dest, uv, offsetof(GCupval, tv)); | ||
1855 | asm_guardcc(as, CC_NE); | ||
1856 | emit_i8(as, 1); | ||
1857 | emit_rmro(as, XO_ARITHib, XOg_CMP, uv, offsetof(GCupval, closed)); | ||
1851 | } else { | 1858 | } else { |
1852 | Reg uv = ra_scratch(as, RSET_GPR); | 1859 | emit_rmro(as, XO_MOV, dest, uv, offsetof(GCupval, v)); |
1853 | Reg func = ra_alloc1(as, ir->op1, RSET_GPR); | ||
1854 | if (ir->o == IR_UREFC) { | ||
1855 | emit_rmro(as, XO_LEA, dest, uv, offsetof(GCupval, tv)); | ||
1856 | asm_guardcc(as, CC_NE); | ||
1857 | emit_i8(as, 1); | ||
1858 | emit_rmro(as, XO_ARITHib, XOg_CMP, uv, offsetof(GCupval, closed)); | ||
1859 | } else { | ||
1860 | emit_rmro(as, XO_MOV, dest, uv, offsetof(GCupval, v)); | ||
1861 | } | ||
1862 | emit_rmro(as, XO_MOV, uv, func, | ||
1863 | (int32_t)offsetof(GCfuncL, uvptr) + 4*(int32_t)(ir->op2 >> 8)); | ||
1864 | } | 1860 | } |
1861 | emit_rmro(as, XO_MOV, uv, func, | ||
1862 | (int32_t)offsetof(GCfuncL, uvptr) + 4*(int32_t)(ir->op2 >> 8)); | ||
1865 | } | 1863 | } |
1866 | } | 1864 | } |
1867 | 1865 | ||
@@ -3423,11 +3421,10 @@ static void asm_trace(ASMState *as) | |||
3423 | { | 3421 | { |
3424 | for (as->curins--; as->curins > as->stopins; as->curins--) { | 3422 | for (as->curins--; as->curins > as->stopins; as->curins--) { |
3425 | IRIns *ir = IR(as->curins); | 3423 | IRIns *ir = IR(as->curins); |
3424 | if (!ra_used(ir) && !ir_sideeff(ir) && (as->flags & JIT_F_OPT_DCE)) | ||
3425 | continue; /* Dead-code elimination can be soooo easy. */ | ||
3426 | if (irt_isguard(ir->t)) | 3426 | if (irt_isguard(ir->t)) |
3427 | asm_snap_prep(as); | 3427 | asm_snap_prep(as); |
3428 | else if (!ra_used(ir) && !irm_sideeff(lj_ir_mode[ir->o]) && | ||
3429 | (as->flags & JIT_F_OPT_DCE)) | ||
3430 | continue; /* Dead-code elimination can be soooo easy. */ | ||
3431 | RA_DBG_REF(); | 3428 | RA_DBG_REF(); |
3432 | checkmclim(as); | 3429 | checkmclim(as); |
3433 | asm_ir(as, ir); | 3430 | asm_ir(as, ir); |