diff options
| -rw-r--r-- | src/lj_asm_arm.h | 7 | ||||
| -rw-r--r-- | src/lj_asm_arm64.h | 2 | ||||
| -rw-r--r-- | src/lj_asm_mips.h | 23 | ||||
| -rw-r--r-- | src/lj_asm_ppc.h | 7 | ||||
| -rw-r--r-- | src/lj_asm_x86.h | 9 | ||||
| -rw-r--r-- | src/lj_record.c | 3 |
6 files changed, 39 insertions, 12 deletions
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h index ded63913..326330f4 100644 --- a/src/lj_asm_arm.h +++ b/src/lj_asm_arm.h | |||
| @@ -1250,7 +1250,12 @@ dotypecheck: | |||
| 1250 | } | 1250 | } |
| 1251 | } | 1251 | } |
| 1252 | asm_guardcc(as, t == IRT_NUM ? CC_HS : CC_NE); | 1252 | asm_guardcc(as, t == IRT_NUM ? CC_HS : CC_NE); |
| 1253 | emit_n(as, ARMI_CMN|ARMI_K12|-irt_toitype_(t), type); | 1253 | if ((ir->op2 & IRSLOAD_KEYINDEX)) { |
| 1254 | emit_n(as, ARMI_CMN|ARMI_K12|1, type); | ||
| 1255 | emit_dn(as, ARMI_EOR^emit_isk12(ARMI_EOR, ~LJ_KEYINDEX), type, type); | ||
| 1256 | } else { | ||
| 1257 | emit_n(as, ARMI_CMN|ARMI_K12|-irt_toitype_(t), type); | ||
| 1258 | } | ||
| 1254 | } | 1259 | } |
| 1255 | if (ra_hasreg(dest)) { | 1260 | if (ra_hasreg(dest)) { |
| 1256 | #if !LJ_SOFTFP | 1261 | #if !LJ_SOFTFP |
diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h index eb31b006..1f44d023 100644 --- a/src/lj_asm_arm64.h +++ b/src/lj_asm_arm64.h | |||
| @@ -1209,7 +1209,7 @@ dotypecheck: | |||
| 1209 | lj_assertA(irt_isinteger(t) || irt_isnum(t), | 1209 | lj_assertA(irt_isinteger(t) || irt_isnum(t), |
| 1210 | "bad SLOAD type %d", irt_type(t)); | 1210 | "bad SLOAD type %d", irt_type(t)); |
| 1211 | emit_nm(as, A64I_CMPx | A64F_SH(A64SH_LSR, 32), | 1211 | emit_nm(as, A64I_CMPx | A64F_SH(A64SH_LSR, 32), |
| 1212 | ra_allock(as, LJ_TISNUM << 15, allow), tmp); | 1212 | ra_allock(as, (ir->op2 & IRSLOAD_KEYINDEX) ? LJ_KEYINDEX : (LJ_TISNUM << 15), allow), tmp); |
| 1213 | } else if (irt_isnil(t)) { | 1213 | } else if (irt_isnil(t)) { |
| 1214 | emit_n(as, (A64I_CMNx^A64I_K12) | A64F_U12(1), tmp); | 1214 | emit_n(as, (A64I_CMNx^A64I_K12) | A64F_U12(1), tmp); |
| 1215 | } else if (irt_ispri(t)) { | 1215 | } else if (irt_ispri(t)) { |
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index db42b8f3..1686b40f 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h | |||
| @@ -1577,7 +1577,7 @@ dotypecheck: | |||
| 1577 | asm_guard(as, MIPSI_BEQ, RID_TMP, RID_ZERO); | 1577 | asm_guard(as, MIPSI_BEQ, RID_TMP, RID_ZERO); |
| 1578 | emit_tsi(as, MIPSI_SLTIU, RID_TMP, type, (int32_t)LJ_TISNUM); | 1578 | emit_tsi(as, MIPSI_SLTIU, RID_TMP, type, (int32_t)LJ_TISNUM); |
| 1579 | } else { | 1579 | } else { |
| 1580 | Reg ktype = ra_allock(as, irt_toitype(t), allow); | 1580 | Reg ktype = ra_allock(as, (ir->op2 & IRSLOAD_KEYINDEX) ? LJ_KEYINDEX : irt_toitype(t), allow); |
| 1581 | asm_guard(as, MIPSI_BNE, type, ktype); | 1581 | asm_guard(as, MIPSI_BNE, type, ktype); |
| 1582 | } | 1582 | } |
| 1583 | } | 1583 | } |
| @@ -1595,6 +1595,10 @@ dotypecheck: | |||
| 1595 | if (irt_ispri(t)) { | 1595 | if (irt_ispri(t)) { |
| 1596 | asm_guard(as, MIPSI_BNE, type, | 1596 | asm_guard(as, MIPSI_BNE, type, |
| 1597 | ra_allock(as, ~((int64_t)~irt_toitype(t) << 47) , allow)); | 1597 | ra_allock(as, ~((int64_t)~irt_toitype(t) << 47) , allow)); |
| 1598 | } else if ((ir->op2 & IRSLOAD_KEYINDEX)) { | ||
| 1599 | asm_guard(as, MIPSI_BNE, RID_TMP, | ||
| 1600 | ra_allock(as, (int32_t)LJ_KEYINDEX, allow)); | ||
| 1601 | emit_dta(as, MIPSI_DSRA32, RID_TMP, type, 0); | ||
| 1598 | } else { | 1602 | } else { |
| 1599 | if (irt_isnum(t)) { | 1603 | if (irt_isnum(t)) { |
| 1600 | asm_guard(as, MIPSI_BEQ, RID_TMP, RID_ZERO); | 1604 | asm_guard(as, MIPSI_BEQ, RID_TMP, RID_ZERO); |
| @@ -2568,7 +2572,22 @@ static void asm_stack_restore(ASMState *as, SnapShot *snap) | |||
| 2568 | } | 2572 | } |
| 2569 | emit_tsi(as, MIPSI_SW, type, RID_BASE, ofs+(LJ_BE?0:4)); | 2573 | emit_tsi(as, MIPSI_SW, type, RID_BASE, ofs+(LJ_BE?0:4)); |
| 2570 | #else | 2574 | #else |
| 2571 | asm_tvstore64(as, RID_BASE, ofs, ref); | 2575 | if ((sn & SNAP_KEYINDEX)) { |
| 2576 | RegSet allow = rset_exclude(RSET_GPR, RID_BASE); | ||
| 2577 | int64_t kki = (int64_t)LJ_KEYINDEX << 32; | ||
| 2578 | if (irref_isk(ref)) { | ||
| 2579 | emit_tsi(as, MIPSI_SD, | ||
| 2580 | ra_allock(as, kki | (int64_t)(uint32_t)ir->i, allow), | ||
| 2581 | RID_BASE, ofs); | ||
| 2582 | } else { | ||
| 2583 | Reg src = ra_alloc1(as, ref, allow); | ||
| 2584 | Reg rki = ra_allock(as, kki, rset_exclude(allow, src)); | ||
| 2585 | emit_tsi(as, MIPSI_SD, RID_TMP, RID_BASE, ofs); | ||
| 2586 | emit_dst(as, MIPSI_DADDU, RID_TMP, src, rki); | ||
| 2587 | } | ||
| 2588 | } else { | ||
| 2589 | asm_tvstore64(as, RID_BASE, ofs, ref); | ||
| 2590 | } | ||
| 2572 | #endif | 2591 | #endif |
| 2573 | } | 2592 | } |
| 2574 | checkmclim(as); | 2593 | checkmclim(as); |
diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h index 5ea4d47d..546b8e5d 100644 --- a/src/lj_asm_ppc.h +++ b/src/lj_asm_ppc.h | |||
| @@ -1169,7 +1169,12 @@ dotypecheck: | |||
| 1169 | } else { | 1169 | } else { |
| 1170 | if ((ir->op2 & IRSLOAD_TYPECHECK)) { | 1170 | if ((ir->op2 & IRSLOAD_TYPECHECK)) { |
| 1171 | asm_guardcc(as, CC_NE); | 1171 | asm_guardcc(as, CC_NE); |
| 1172 | emit_ai(as, PPCI_CMPWI, RID_TMP, irt_toitype(t)); | 1172 | if ((ir->op2 & IRSLOAD_KEYINDEX)) { |
| 1173 | emit_ai(as, PPCI_CMPWI, RID_TMP, (LJ_KEYINDEX & 0xffff)); | ||
| 1174 | emit_asi(as, PPCI_XORIS, RID_TMP, RID_TMP, (LJ_KEYINDEX >> 16)); | ||
| 1175 | } else { | ||
| 1176 | emit_ai(as, PPCI_CMPWI, RID_TMP, irt_toitype(t)); | ||
| 1177 | } | ||
| 1173 | type = RID_TMP; | 1178 | type = RID_TMP; |
| 1174 | } | 1179 | } |
| 1175 | if (ra_hasreg(dest)) emit_tai(as, PPCI_LWZ, dest, base, ofs); | 1180 | if (ra_hasreg(dest)) emit_tai(as, PPCI_LWZ, dest, base, ofs); |
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h index 38069e1d..4465efa2 100644 --- a/src/lj_asm_x86.h +++ b/src/lj_asm_x86.h | |||
| @@ -1768,14 +1768,11 @@ static void asm_sload(ASMState *as, IRIns *ir) | |||
| 1768 | if ((ir->op2 & IRSLOAD_TYPECHECK)) { | 1768 | if ((ir->op2 & IRSLOAD_TYPECHECK)) { |
| 1769 | /* Need type check, even if the load result is unused. */ | 1769 | /* Need type check, even if the load result is unused. */ |
| 1770 | asm_guardcc(as, irt_isnum(t) ? CC_AE : CC_NE); | 1770 | asm_guardcc(as, irt_isnum(t) ? CC_AE : CC_NE); |
| 1771 | if (LJ_64 && irt_type(t) >= IRT_NUM) { | 1771 | if ((LJ_64 && irt_type(t) >= IRT_NUM) || (ir->op2 & IRSLOAD_KEYINDEX)) { |
| 1772 | lj_assertA(irt_isinteger(t) || irt_isnum(t), | 1772 | lj_assertA(irt_isinteger(t) || irt_isnum(t), |
| 1773 | "bad SLOAD type %d", irt_type(t)); | 1773 | "bad SLOAD type %d", irt_type(t)); |
| 1774 | #if LJ_GC64 | 1774 | emit_u32(as, (ir->op2 & IRSLOAD_KEYINDEX) ? LJ_KEYINDEX : |
| 1775 | emit_u32(as, LJ_TISNUM << 15); | 1775 | LJ_GC64 ? (LJ_TISNUM << 15) : LJ_TISNUM); |
| 1776 | #else | ||
| 1777 | emit_u32(as, LJ_TISNUM); | ||
| 1778 | #endif | ||
| 1779 | emit_rmro(as, XO_ARITHi, XOg_CMP, base, ofs+4); | 1776 | emit_rmro(as, XO_ARITHi, XOg_CMP, base, ofs+4); |
| 1780 | #if LJ_GC64 | 1777 | #if LJ_GC64 |
| 1781 | } else if (irt_isnil(t)) { | 1778 | } else if (irt_isnil(t)) { |
diff --git a/src/lj_record.c b/src/lj_record.c index 59798844..d48908e2 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
| @@ -675,7 +675,8 @@ static LoopEvent rec_itern(jit_State *J, BCReg ra, BCReg rb) | |||
| 675 | lj_snap_add(J); /* Required to make JLOOP the first ins in a side-trace. */ | 675 | lj_snap_add(J); /* Required to make JLOOP the first ins in a side-trace. */ |
| 676 | ix.tab = getslot(J, ra-2); | 676 | ix.tab = getslot(J, ra-2); |
| 677 | ix.key = J->base[ra-1] ? J->base[ra-1] : | 677 | ix.key = J->base[ra-1] ? J->base[ra-1] : |
| 678 | sloadt(J, (int32_t)(ra-1), IRT_INT, IRSLOAD_KEYINDEX); | 678 | sloadt(J, (int32_t)(ra-1), IRT_GUARD|IRT_INT, |
| 679 | IRSLOAD_TYPECHECK|IRSLOAD_KEYINDEX); | ||
| 679 | copyTV(J->L, &ix.tabv, &J->L->base[ra-2]); | 680 | copyTV(J->L, &ix.tabv, &J->L->base[ra-2]); |
| 680 | copyTV(J->L, &ix.keyv, &J->L->base[ra-1]); | 681 | copyTV(J->L, &ix.keyv, &J->L->base[ra-1]); |
| 681 | ix.idxchain = (rb < 3); /* Omit value type check, if unused. */ | 682 | ix.idxchain = (rb < 3); /* Omit value type check, if unused. */ |
