aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2010-09-18 18:34:38 +0200
committerMike Pall <mike>2010-09-18 18:34:38 +0200
commit52b922c1e941cfc56ae76954a80c429782a33ca6 (patch)
tree94950d45cd660e85b4270c464f19fe5d06653bfa /src
parent9203d278d04a96f4fa3fd578b2c1c917e3afd3d0 (diff)
downloadluajit-52b922c1e941cfc56ae76954a80c429782a33ca6.tar.gz
luajit-52b922c1e941cfc56ae76954a80c429782a33ca6.tar.bz2
luajit-52b922c1e941cfc56ae76954a80c429782a33ca6.zip
Avoid fusing potentially negative indexes into AREF on x64.
Diffstat (limited to 'src')
-rw-r--r--src/lj_asm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index e7f2cb72..89b569cc 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -1148,7 +1148,8 @@ static void asm_fusearef(ASMState *as, IRIns *ir, RegSet allow)
1148 /* Fuse a constant ADD (e.g. t[i+1]) into the offset. 1148 /* Fuse a constant ADD (e.g. t[i+1]) into the offset.
1149 ** Doesn't help much without ABCelim, but reduces register pressure. 1149 ** Doesn't help much without ABCelim, but reduces register pressure.
1150 */ 1150 */
1151 if (mayfuse(as, ir->op2) && ra_noreg(irx->r) && 1151 if (!LJ_64 && /* Has bad effects with negative index on x64. */
1152 mayfuse(as, ir->op2) && ra_noreg(irx->r) &&
1152 irx->o == IR_ADD && irref_isk(irx->op2)) { 1153 irx->o == IR_ADD && irref_isk(irx->op2)) {
1153 as->mrm.ofs += 8*IR(irx->op2)->i; 1154 as->mrm.ofs += 8*IR(irx->op2)->i;
1154 as->mrm.idx = (uint8_t)ra_alloc1(as, irx->op1, allow); 1155 as->mrm.idx = (uint8_t)ra_alloc1(as, irx->op1, allow);
@@ -1236,7 +1237,7 @@ static void asm_fusestrref(ASMState *as, IRIns *ir, RegSet allow)
1236 } else { 1237 } else {
1237 Reg r; 1238 Reg r;
1238 /* Fuse a constant add into the offset, e.g. string.sub(s, i+10). */ 1239 /* Fuse a constant add into the offset, e.g. string.sub(s, i+10). */
1239 if (!LJ_64 && /* NYI: has bad effects with negative index on x64. */ 1240 if (!LJ_64 && /* Has bad effects with negative index on x64. */
1240 mayfuse(as, ir->op2) && irr->o == IR_ADD && irref_isk(irr->op2)) { 1241 mayfuse(as, ir->op2) && irr->o == IR_ADD && irref_isk(irr->op2)) {
1241 as->mrm.ofs += IR(irr->op2)->i; 1242 as->mrm.ofs += IR(irr->op2)->i;
1242 r = ra_alloc1(as, irr->op1, allow); 1243 r = ra_alloc1(as, irr->op1, allow);