mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
x86/x64: Add more red zone checks to assembler backend.
Thanks to Peter Cawley. #1116
This commit is contained in:
parent
a4c1640432
commit
d854d00ce9
@ -674,6 +674,7 @@ static void asm_tointg(ASMState *as, IRIns *ir, Reg left)
|
|||||||
emit_rr(as, XO_CVTSI2SD, tmp, dest);
|
emit_rr(as, XO_CVTSI2SD, tmp, dest);
|
||||||
if (!(as->flags & JIT_F_SPLIT_XMM))
|
if (!(as->flags & JIT_F_SPLIT_XMM))
|
||||||
emit_rr(as, XO_XORPS, tmp, tmp); /* Avoid partial register stall. */
|
emit_rr(as, XO_XORPS, tmp, tmp); /* Avoid partial register stall. */
|
||||||
|
checkmclim(as);
|
||||||
emit_rr(as, XO_CVTTSD2SI, dest, left);
|
emit_rr(as, XO_CVTTSD2SI, dest, left);
|
||||||
/* Can't fuse since left is needed twice. */
|
/* Can't fuse since left is needed twice. */
|
||||||
}
|
}
|
||||||
@ -713,6 +714,7 @@ static void asm_conv(ASMState *as, IRIns *ir)
|
|||||||
emit_rr(as, XO_SUBSD, dest, bias); /* Subtract 2^52+2^51 bias. */
|
emit_rr(as, XO_SUBSD, dest, bias); /* Subtract 2^52+2^51 bias. */
|
||||||
emit_rr(as, XO_XORPS, dest, bias); /* Merge bias and integer. */
|
emit_rr(as, XO_XORPS, dest, bias); /* Merge bias and integer. */
|
||||||
emit_loadn(as, bias, k);
|
emit_loadn(as, bias, k);
|
||||||
|
checkmclim(as);
|
||||||
emit_mrm(as, XO_MOVD, dest, asm_fuseload(as, lref, RSET_GPR));
|
emit_mrm(as, XO_MOVD, dest, asm_fuseload(as, lref, RSET_GPR));
|
||||||
return;
|
return;
|
||||||
} else { /* Integer to FP conversion. */
|
} else { /* Integer to FP conversion. */
|
||||||
@ -1025,6 +1027,7 @@ static void asm_href(ASMState *as, IRIns *ir)
|
|||||||
emit_jcc(as, CC_E, nilexit);
|
emit_jcc(as, CC_E, nilexit);
|
||||||
else
|
else
|
||||||
emit_sjcc(as, CC_E, l_end);
|
emit_sjcc(as, CC_E, l_end);
|
||||||
|
checkmclim(as);
|
||||||
if (irt_isnum(kt)) {
|
if (irt_isnum(kt)) {
|
||||||
if (isk) {
|
if (isk) {
|
||||||
/* Assumes -0.0 is already canonicalized to +0.0. */
|
/* Assumes -0.0 is already canonicalized to +0.0. */
|
||||||
@ -1065,7 +1068,6 @@ static void asm_href(ASMState *as, IRIns *ir)
|
|||||||
emit_rmro(as, XO_ARITHi8, XOg_CMP, dest, offsetof(Node, key.it));
|
emit_rmro(as, XO_ARITHi8, XOg_CMP, dest, offsetof(Node, key.it));
|
||||||
}
|
}
|
||||||
emit_sfixup(as, l_loop);
|
emit_sfixup(as, l_loop);
|
||||||
checkmclim(as);
|
|
||||||
|
|
||||||
/* Load main position relative to tab->node into dest. */
|
/* Load main position relative to tab->node into dest. */
|
||||||
khash = isk ? ir_khash(irkey) : 1;
|
khash = isk ? ir_khash(irkey) : 1;
|
||||||
@ -1091,6 +1093,7 @@ static void asm_href(ASMState *as, IRIns *ir)
|
|||||||
emit_rr(as, XO_ARITH(XOg_SUB), dest, tmp);
|
emit_rr(as, XO_ARITH(XOg_SUB), dest, tmp);
|
||||||
emit_shifti(as, XOg_ROL, tmp, HASH_ROT3);
|
emit_shifti(as, XOg_ROL, tmp, HASH_ROT3);
|
||||||
emit_rr(as, XO_ARITH(XOg_XOR), dest, tmp);
|
emit_rr(as, XO_ARITH(XOg_XOR), dest, tmp);
|
||||||
|
checkmclim(as);
|
||||||
emit_shifti(as, XOg_ROL, dest, HASH_ROT2);
|
emit_shifti(as, XOg_ROL, dest, HASH_ROT2);
|
||||||
emit_rr(as, XO_ARITH(XOg_SUB), tmp, dest);
|
emit_rr(as, XO_ARITH(XOg_SUB), tmp, dest);
|
||||||
emit_shifti(as, XOg_ROL, dest, HASH_ROT1);
|
emit_shifti(as, XOg_ROL, dest, HASH_ROT1);
|
||||||
@ -1375,6 +1378,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir)
|
|||||||
if (irt_islightud(ir->t)) {
|
if (irt_islightud(ir->t)) {
|
||||||
Reg dest = asm_load_lightud64(as, ir, 1);
|
Reg dest = asm_load_lightud64(as, ir, 1);
|
||||||
if (ra_hasreg(dest)) {
|
if (ra_hasreg(dest)) {
|
||||||
|
checkmclim(as);
|
||||||
asm_fuseahuref(as, ir->op1, RSET_GPR);
|
asm_fuseahuref(as, ir->op1, RSET_GPR);
|
||||||
emit_mrm(as, XO_MOV, dest|REX_64, RID_MRM);
|
emit_mrm(as, XO_MOV, dest|REX_64, RID_MRM);
|
||||||
}
|
}
|
||||||
@ -1394,6 +1398,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir)
|
|||||||
asm_guardcc(as, irt_isnum(ir->t) ? CC_AE : CC_NE);
|
asm_guardcc(as, irt_isnum(ir->t) ? CC_AE : CC_NE);
|
||||||
if (LJ_64 && irt_type(ir->t) >= IRT_NUM) {
|
if (LJ_64 && irt_type(ir->t) >= IRT_NUM) {
|
||||||
lua_assert(irt_isinteger(ir->t) || irt_isnum(ir->t));
|
lua_assert(irt_isinteger(ir->t) || irt_isnum(ir->t));
|
||||||
|
checkmclim(as);
|
||||||
emit_u32(as, LJ_TISNUM);
|
emit_u32(as, LJ_TISNUM);
|
||||||
emit_mrm(as, XO_ARITHi, XOg_CMP, RID_MRM);
|
emit_mrm(as, XO_ARITHi, XOg_CMP, RID_MRM);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user