void-packages/srcpkgs/LuaJIT/patches/aarch64-register-allocation...

30 lines
1.0 KiB
Diff

From: Jason Teplitz <jason@tensyr.com>
Date: Mon, 9 Oct 2017 23:03:09 +0000
Subject: Fix register allocation bug in arm64
---
src/lj_asm_arm64.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git src/lj_asm_arm64.h src/lj_asm_arm64.h
index 8fd92e7..549f8a6 100644
--- src/lj_asm_arm64.h
+++ src/lj_asm_arm64.h
@@ -871,7 +871,7 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
int bigofs = !emit_checkofs(A64I_LDRx, ofs);
RegSet allow = RSET_GPR;
Reg dest = (ra_used(ir) || bigofs) ? ra_dest(as, ir, RSET_GPR) : RID_NONE;
- Reg node = ra_alloc1(as, ir->op1, allow);
+ Reg node = ra_alloc1(as, ir->op1, ra_hasreg(dest) ? rset_clear(allow, dest) : allow);
Reg key = ra_scratch(as, rset_clear(allow, node));
Reg idx = node;
uint64_t k;
@@ -879,7 +879,6 @@ static void asm_hrefk(ASMState *as, IRIns *ir)
rset_clear(allow, key);
if (bigofs) {
idx = dest;
- rset_clear(allow, dest);
kofs = (int32_t)offsetof(Node, key);
} else if (ra_hasreg(dest)) {
emit_opk(as, A64I_ADDx, dest, node, ofs, allow);