fix(asm): ADDQ imm8 frame adjust for 128-255 byte frames

This commit is contained in:
2026-08-28 22:11:24 +02:00
parent 78b12dd427
commit ba4d961b20
+5
View File
@@ -261,6 +261,11 @@ func subSP(size int) []byte { // SUBQ $size, SP
if size >= -128 && size <= 127 {
return []byte{0x48, 0x83, 0xEC, byte(int8(size))}
}
// 128..255 do not fit SUB's unsigned imm8, but the Go assembler
// switches to ADDQ $-size, SP whose sign-extended imm8 does.
if size >= -255 && size <= 255 {
return []byte{0x48, 0x83, 0xC4, byte(int8(-size))}
}
return append([]byte{0x48, 0x81, 0xEC}, le32(int64(size))...)
}