void-packages/srcpkgs/LuaJIT/patches/aarch64-register-allocation-bug-fix.patch
Đoàn Trần Công Danh ec4c2d75fa srcpkgs/[A-Z]*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

29 lines
1 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
--- a/src/lj_asm_arm64.h
+++ b/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);