aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm_mips.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_asm_mips.h')
-rw-r--r--src/lj_asm_mips.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h
index b02da663..d4e40c91 100644
--- a/src/lj_asm_mips.h
+++ b/src/lj_asm_mips.h
@@ -1207,22 +1207,29 @@ nolo:
1207static void asm_uref(ASMState *as, IRIns *ir) 1207static void asm_uref(ASMState *as, IRIns *ir)
1208{ 1208{
1209 Reg dest = ra_dest(as, ir, RSET_GPR); 1209 Reg dest = ra_dest(as, ir, RSET_GPR);
1210 if (irref_isk(ir->op1)) { 1210 int guarded = (irt_t(ir->t) & (IRT_GUARD|IRT_TYPE)) == (IRT_GUARD|IRT_PGC);
1211 if (irref_isk(ir->op1) && !guarded) {
1211 GCfunc *fn = ir_kfunc(IR(ir->op1)); 1212 GCfunc *fn = ir_kfunc(IR(ir->op1));
1212 MRef *v = &gcref(fn->l.uvptr[(ir->op2 >> 8)])->uv.v; 1213 MRef *v = &gcref(fn->l.uvptr[(ir->op2 >> 8)])->uv.v;
1213 emit_lsptr(as, MIPSI_AL, dest, v, RSET_GPR); 1214 emit_lsptr(as, MIPSI_AL, dest, v, RSET_GPR);
1214 } else { 1215 } else {
1215 Reg uv = ra_scratch(as, RSET_GPR); 1216 if (guarded)
1216 Reg func = ra_alloc1(as, ir->op1, RSET_GPR); 1217 asm_guard(as, ir->o == IR_UREFC ? MIPSI_BEQ : MIPSI_BNE, RID_TMP, RID_ZERO);
1217 if (ir->o == IR_UREFC) { 1218 if (ir->o == IR_UREFC)
1218 asm_guard(as, MIPSI_BEQ, RID_TMP, RID_ZERO); 1219 emit_tsi(as, MIPSI_AADDIU, dest, dest, (int32_t)offsetof(GCupval, tv));
1219 emit_tsi(as, MIPSI_AADDIU, dest, uv, (int32_t)offsetof(GCupval, tv)); 1220 else
1220 emit_tsi(as, MIPSI_LBU, RID_TMP, uv, (int32_t)offsetof(GCupval, closed)); 1221 emit_tsi(as, MIPSI_AL, dest, dest, (int32_t)offsetof(GCupval, v));
1222 if (guarded)
1223 emit_tsi(as, MIPSI_LBU, RID_TMP, dest, (int32_t)offsetof(GCupval, closed));
1224 if (irref_isk(ir->op1)) {
1225 GCfunc *fn = ir_kfunc(IR(ir->op1));
1226 GCobj *o = gcref(fn->l.uvptr[(ir->op2 >> 8)]);
1227 emit_loada(as, dest, o);
1221 } else { 1228 } else {
1222 emit_tsi(as, MIPSI_AL, dest, uv, (int32_t)offsetof(GCupval, v)); 1229 emit_tsi(as, MIPSI_AL, dest, ra_alloc1(as, ir->op1, RSET_GPR),
1230 (int32_t)offsetof(GCfuncL, uvptr) +
1231 (int32_t)sizeof(MRef) * (int32_t)(ir->op2 >> 8));
1223 } 1232 }
1224 emit_tsi(as, MIPSI_AL, uv, func, (int32_t)offsetof(GCfuncL, uvptr) +
1225 (int32_t)sizeof(MRef) * (int32_t)(ir->op2 >> 8));
1226 } 1233 }
1227} 1234}
1228 1235