diff options
Diffstat (limited to '')
-rw-r--r-- | src/lj_asm_arm.h | 1 | ||||
-rw-r--r-- | src/lj_asm_arm64.h | 1 | ||||
-rw-r--r-- | src/lj_asm_mips.h | 1 | ||||
-rw-r--r-- | src/lj_asm_ppc.h | 4 | ||||
-rw-r--r-- | src/lj_asm_x86.h | 7 | ||||
-rw-r--r-- | src/lj_ffrecord.c | 4 | ||||
-rw-r--r-- | src/lj_ir.h | 2 | ||||
-rw-r--r-- | src/lj_record.c | 10 | ||||
-rw-r--r-- | src/lj_record.h | 2 |
9 files changed, 19 insertions, 13 deletions
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h index 6cfe5c70..3adb534b 100644 --- a/src/lj_asm_arm.h +++ b/src/lj_asm_arm.h | |||
@@ -1133,6 +1133,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) | |||
1133 | } | 1133 | } |
1134 | idx = asm_fuseahuref(as, ir->op1, &ofs, allow, | 1134 | idx = asm_fuseahuref(as, ir->op1, &ofs, allow, |
1135 | (!LJ_SOFTFP && t == IRT_NUM) ? 1024 : 4096); | 1135 | (!LJ_SOFTFP && t == IRT_NUM) ? 1024 : 4096); |
1136 | if (ir->o == IR_VLOAD) ofs += 8 * ir->op2; | ||
1136 | if (!hiop || type == RID_NONE) { | 1137 | if (!hiop || type == RID_NONE) { |
1137 | rset_clear(allow, idx); | 1138 | rset_clear(allow, idx); |
1138 | if (ofs < 256 && ra_hasreg(dest) && (dest & 1) == 0 && | 1139 | if (ofs < 256 && ra_hasreg(dest) && (dest & 1) == 0 && |
diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h index bb972ad1..f51c6f76 100644 --- a/src/lj_asm_arm64.h +++ b/src/lj_asm_arm64.h | |||
@@ -1078,6 +1078,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) | |||
1078 | } | 1078 | } |
1079 | type = ra_scratch(as, rset_clear(gpr, tmp)); | 1079 | type = ra_scratch(as, rset_clear(gpr, tmp)); |
1080 | idx = asm_fuseahuref(as, ir->op1, &ofs, rset_clear(gpr, type), A64I_LDRx); | 1080 | idx = asm_fuseahuref(as, ir->op1, &ofs, rset_clear(gpr, type), A64I_LDRx); |
1081 | if (ir->o == IR_VLOAD) ofs += 8 * ir->op2; | ||
1081 | /* Always do the type check, even if the load result is unused. */ | 1082 | /* Always do the type check, even if the load result is unused. */ |
1082 | asm_guardcc(as, irt_isnum(ir->t) ? CC_LS : CC_NE); | 1083 | asm_guardcc(as, irt_isnum(ir->t) ? CC_LS : CC_NE); |
1083 | if (irt_type(ir->t) >= IRT_NUM) { | 1084 | if (irt_type(ir->t) >= IRT_NUM) { |
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index 1fe934e1..cd32d038 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h | |||
@@ -1417,6 +1417,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) | |||
1417 | #endif | 1417 | #endif |
1418 | } | 1418 | } |
1419 | idx = asm_fuseahuref(as, ir->op1, &ofs, allow); | 1419 | idx = asm_fuseahuref(as, ir->op1, &ofs, allow); |
1420 | if (ir->o == IR_VLOAD) ofs += 8 * ir->op2; | ||
1420 | rset_clear(allow, idx); | 1421 | rset_clear(allow, idx); |
1421 | if (irt_isnum(t)) { | 1422 | if (irt_isnum(t)) { |
1422 | asm_guard(as, MIPSI_BEQ, RID_TMP, RID_ZERO); | 1423 | asm_guard(as, MIPSI_BEQ, RID_TMP, RID_ZERO); |
diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h index f5cedd6a..ba60b7e6 100644 --- a/src/lj_asm_ppc.h +++ b/src/lj_asm_ppc.h | |||
@@ -1019,6 +1019,10 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) | |||
1019 | rset_clear(allow, dest); | 1019 | rset_clear(allow, dest); |
1020 | } | 1020 | } |
1021 | idx = asm_fuseahuref(as, ir->op1, &ofs, allow); | 1021 | idx = asm_fuseahuref(as, ir->op1, &ofs, allow); |
1022 | if (ir->o == IR_VLOAD) { | ||
1023 | ofs = ofs != AHUREF_LSX ? ofs + 8 * ir->op2 : | ||
1024 | ir->op2 ? 8 * ir->op2 : AHUREF_LSX; | ||
1025 | } | ||
1022 | if (irt_isnum(t)) { | 1026 | if (irt_isnum(t)) { |
1023 | Reg tisnum = ra_allock(as, (int32_t)LJ_TISNUM, rset_exclude(allow, idx)); | 1027 | Reg tisnum = ra_allock(as, (int32_t)LJ_TISNUM, rset_exclude(allow, idx)); |
1024 | asm_guardcc(as, CC_GE); | 1028 | asm_guardcc(as, CC_GE); |
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index 3c934c31..512f1afd 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h | |||
@@ -227,9 +227,6 @@ static void asm_fuseahuref(ASMState *as, IRRef ref, RegSet allow) | |||
227 | #endif | 227 | #endif |
228 | return; | 228 | return; |
229 | default: | 229 | default: |
230 | lj_assertA(ir->o == IR_HREF || ir->o == IR_NEWREF || ir->o == IR_UREFO || | ||
231 | ir->o == IR_KKPTR, | ||
232 | "bad IR op %d", ir->o); | ||
233 | break; | 230 | break; |
234 | } | 231 | } |
235 | } | 232 | } |
@@ -490,6 +487,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow) | |||
490 | } | 487 | } |
491 | } else if (ir->o == IR_VLOAD && !(LJ_GC64 && irt_isaddr(ir->t))) { | 488 | } else if (ir->o == IR_VLOAD && !(LJ_GC64 && irt_isaddr(ir->t))) { |
492 | asm_fuseahuref(as, ir->op1, xallow); | 489 | asm_fuseahuref(as, ir->op1, xallow); |
490 | as->mrm.ofs += 8 * ir->op2; | ||
493 | return RID_MRM; | 491 | return RID_MRM; |
494 | } | 492 | } |
495 | } | 493 | } |
@@ -1550,6 +1548,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) | |||
1550 | Reg dest = asm_load_lightud64(as, ir, 1); | 1548 | Reg dest = asm_load_lightud64(as, ir, 1); |
1551 | if (ra_hasreg(dest)) { | 1549 | if (ra_hasreg(dest)) { |
1552 | asm_fuseahuref(as, ir->op1, RSET_GPR); | 1550 | asm_fuseahuref(as, ir->op1, RSET_GPR); |
1551 | if (ir->o == IR_VLOAD) as->mrm.ofs += 8 * ir->op2; | ||
1553 | emit_mrm(as, XO_MOV, dest|REX_64, RID_MRM); | 1552 | emit_mrm(as, XO_MOV, dest|REX_64, RID_MRM); |
1554 | } | 1553 | } |
1555 | return; | 1554 | return; |
@@ -1559,6 +1558,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) | |||
1559 | RegSet allow = irt_isnum(ir->t) ? RSET_FPR : RSET_GPR; | 1558 | RegSet allow = irt_isnum(ir->t) ? RSET_FPR : RSET_GPR; |
1560 | Reg dest = ra_dest(as, ir, allow); | 1559 | Reg dest = ra_dest(as, ir, allow); |
1561 | asm_fuseahuref(as, ir->op1, RSET_GPR); | 1560 | asm_fuseahuref(as, ir->op1, RSET_GPR); |
1561 | if (ir->o == IR_VLOAD) as->mrm.ofs += 8 * ir->op2; | ||
1562 | #if LJ_GC64 | 1562 | #if LJ_GC64 |
1563 | if (irt_isaddr(ir->t)) { | 1563 | if (irt_isaddr(ir->t)) { |
1564 | emit_shifti(as, XOg_SHR|REX_64, dest, 17); | 1564 | emit_shifti(as, XOg_SHR|REX_64, dest, 17); |
@@ -1586,6 +1586,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) | |||
1586 | } | 1586 | } |
1587 | #endif | 1587 | #endif |
1588 | asm_fuseahuref(as, ir->op1, gpr); | 1588 | asm_fuseahuref(as, ir->op1, gpr); |
1589 | if (ir->o == IR_VLOAD) as->mrm.ofs += 8 * ir->op2; | ||
1589 | } | 1590 | } |
1590 | /* Always do the type check, even if the load result is unused. */ | 1591 | /* Always do the type check, even if the load result is unused. */ |
1591 | as->mrm.ofs += 4; | 1592 | as->mrm.ofs += 4; |
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index 92902b70..3ef92034 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c | |||
@@ -1317,7 +1317,7 @@ static void LJ_FASTCALL recff_buffer_method_decode(jit_State *J, RecordFFData *r | |||
1317 | trr = lj_ir_call(J, IRCALL_lj_serialize_get, trbuf, tmp); | 1317 | trr = lj_ir_call(J, IRCALL_lj_serialize_get, trbuf, tmp); |
1318 | /* No IR_USE needed, since the call is a store. */ | 1318 | /* No IR_USE needed, since the call is a store. */ |
1319 | t = (IRType)lj_serialize_peektype(bufV(&rd->argv[0])); | 1319 | t = (IRType)lj_serialize_peektype(bufV(&rd->argv[0])); |
1320 | J->base[0] = lj_record_vload(J, tmp, t); | 1320 | J->base[0] = lj_record_vload(J, tmp, 0, t); |
1321 | /* The sbx->r store must be after the VLOAD type check, in case it fails. */ | 1321 | /* The sbx->r store must be after the VLOAD type check, in case it fails. */ |
1322 | recff_sbufx_set_ptr(J, ud, IRFL_SBUF_R, trr); | 1322 | recff_sbufx_set_ptr(J, ud, IRFL_SBUF_R, trr); |
1323 | } | 1323 | } |
@@ -1350,7 +1350,7 @@ static void LJ_FASTCALL recff_buffer_decode(jit_State *J, RecordFFData *rd) | |||
1350 | memset(&sbx, 0, sizeof(SBufExt)); | 1350 | memset(&sbx, 0, sizeof(SBufExt)); |
1351 | lj_bufx_set_cow(J->L, &sbx, strdata(str), str->len); | 1351 | lj_bufx_set_cow(J->L, &sbx, strdata(str), str->len); |
1352 | t = (IRType)lj_serialize_peektype(&sbx); | 1352 | t = (IRType)lj_serialize_peektype(&sbx); |
1353 | J->base[0] = lj_record_vload(J, tmp, t); | 1353 | J->base[0] = lj_record_vload(J, tmp, 0, t); |
1354 | } /* else: Interpreter will throw. */ | 1354 | } /* else: Interpreter will throw. */ |
1355 | } | 1355 | } |
1356 | 1356 | ||
diff --git a/src/lj_ir.h b/src/lj_ir.h index b3faaea8..6a161933 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h | |||
@@ -106,7 +106,7 @@ | |||
106 | _(FLOAD, L , ref, lit) \ | 106 | _(FLOAD, L , ref, lit) \ |
107 | _(XLOAD, L , ref, lit) \ | 107 | _(XLOAD, L , ref, lit) \ |
108 | _(SLOAD, L , lit, lit) \ | 108 | _(SLOAD, L , lit, lit) \ |
109 | _(VLOAD, L , ref, ___) \ | 109 | _(VLOAD, L , ref, lit) \ |
110 | _(ALEN, L , ref, ref) \ | 110 | _(ALEN, L , ref, ref) \ |
111 | \ | 111 | \ |
112 | _(ASTORE, S , ref, ref) \ | 112 | _(ASTORE, S , ref, ref) \ |
diff --git a/src/lj_record.c b/src/lj_record.c index ee62179b..a1471aae 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -260,9 +260,9 @@ TRef lj_record_constify(jit_State *J, cTValue *o) | |||
260 | } | 260 | } |
261 | 261 | ||
262 | /* Emit a VLOAD with the correct type. */ | 262 | /* Emit a VLOAD with the correct type. */ |
263 | TRef lj_record_vload(jit_State *J, TRef ref, IRType t) | 263 | TRef lj_record_vload(jit_State *J, TRef ref, MSize idx, IRType t) |
264 | { | 264 | { |
265 | TRef tr = emitir(IRTG(IR_VLOAD, t), ref, 0); | 265 | TRef tr = emitir(IRTG(IR_VLOAD, t), ref, idx); |
266 | if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */ | 266 | if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */ |
267 | return tr; | 267 | return tr; |
268 | } | 268 | } |
@@ -1848,9 +1848,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults) | |||
1848 | vbase = emitir(IRT(IR_ADD, IRT_PGC), vbase, lj_ir_kint(J, frofs-8)); | 1848 | vbase = emitir(IRT(IR_ADD, IRT_PGC), vbase, lj_ir_kint(J, frofs-8)); |
1849 | for (i = 0; i < nload; i++) { | 1849 | for (i = 0; i < nload; i++) { |
1850 | IRType t = itype2irt(&J->L->base[i-1-LJ_FR2-nvararg]); | 1850 | IRType t = itype2irt(&J->L->base[i-1-LJ_FR2-nvararg]); |
1851 | TRef aref = emitir(IRT(IR_AREF, IRT_PGC), | 1851 | J->base[dst+i] = lj_record_vload(J, vbase, i, t); |
1852 | vbase, lj_ir_kint(J, (int32_t)i)); | ||
1853 | J->base[dst+i] = lj_record_vload(J, aref, t); | ||
1854 | } | 1852 | } |
1855 | } else { | 1853 | } else { |
1856 | emitir(IRTGI(IR_LE), fr, lj_ir_kint(J, frofs)); | 1854 | emitir(IRTGI(IR_LE), fr, lj_ir_kint(J, frofs)); |
@@ -1897,7 +1895,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults) | |||
1897 | lj_ir_kint(J, frofs-(8<<LJ_FR2))); | 1895 | lj_ir_kint(J, frofs-(8<<LJ_FR2))); |
1898 | t = itype2irt(&J->L->base[idx-2-LJ_FR2-nvararg]); | 1896 | t = itype2irt(&J->L->base[idx-2-LJ_FR2-nvararg]); |
1899 | aref = emitir(IRT(IR_AREF, IRT_PGC), vbase, tridx); | 1897 | aref = emitir(IRT(IR_AREF, IRT_PGC), vbase, tridx); |
1900 | tr = lj_record_vload(J, aref, t); | 1898 | tr = lj_record_vload(J, aref, 0, t); |
1901 | } | 1899 | } |
1902 | J->base[dst-2-LJ_FR2] = tr; | 1900 | J->base[dst-2-LJ_FR2] = tr; |
1903 | J->maxslot = dst-1-LJ_FR2; | 1901 | J->maxslot = dst-1-LJ_FR2; |
diff --git a/src/lj_record.h b/src/lj_record.h index 03d84a71..3bf461c8 100644 --- a/src/lj_record.h +++ b/src/lj_record.h | |||
@@ -30,7 +30,7 @@ LJ_FUNC int lj_record_objcmp(jit_State *J, TRef a, TRef b, | |||
30 | cTValue *av, cTValue *bv); | 30 | cTValue *av, cTValue *bv); |
31 | LJ_FUNC void lj_record_stop(jit_State *J, TraceLink linktype, TraceNo lnk); | 31 | LJ_FUNC void lj_record_stop(jit_State *J, TraceLink linktype, TraceNo lnk); |
32 | LJ_FUNC TRef lj_record_constify(jit_State *J, cTValue *o); | 32 | LJ_FUNC TRef lj_record_constify(jit_State *J, cTValue *o); |
33 | LJ_FUNC TRef lj_record_vload(jit_State *J, TRef ref, IRType t); | 33 | LJ_FUNC TRef lj_record_vload(jit_State *J, TRef ref, MSize idx, IRType t); |
34 | 34 | ||
35 | LJ_FUNC void lj_record_call(jit_State *J, BCReg func, ptrdiff_t nargs); | 35 | LJ_FUNC void lj_record_call(jit_State *J, BCReg func, ptrdiff_t nargs); |
36 | LJ_FUNC void lj_record_tailcall(jit_State *J, BCReg func, ptrdiff_t nargs); | 36 | LJ_FUNC void lj_record_tailcall(jit_State *J, BCReg func, ptrdiff_t nargs); |