GH-115802: JIT "small" code for Windows (GH-115964)

This commit is contained in:
Brandt Bucher 2024-02-29 08:11:28 -08:00 committed by GitHub
parent 45d8871dc4
commit f0df35eeca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 129 additions and 96 deletions

View file

@ -96,7 +96,7 @@ class Stencil:
instruction |= ((base - hole.offset) >> 2) & 0x03FFFFFF
self.body[where] = instruction.to_bytes(4, sys.byteorder)
self.disassembly += [
f"{base + 4 * 0: x}: d2800008 mov x8, #0x0",
f"{base + 4 * 0:x}: d2800008 mov x8, #0x0",
f"{base + 4 * 0:016x}: R_AARCH64_MOVW_UABS_G0_NC {hole.symbol}",
f"{base + 4 * 1:x}: f2a00008 movk x8, #0x0, lsl #16",
f"{base + 4 * 1:016x}: R_AARCH64_MOVW_UABS_G1_NC {hole.symbol}",
@ -162,6 +162,13 @@ class StencilGroup:
):
self.code.emit_aarch64_trampoline(hole)
continue
elif (
hole.kind in {"IMAGE_REL_AMD64_REL32"}
and hole.value is HoleValue.ZERO
):
raise ValueError(
f"Add PyAPI_FUNC(...) or PyAPI_DATA(...) to declaration of {hole.symbol}!"
)
holes.append(hole)
stencil.holes[:] = holes
self.code.pad(alignment)