mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
GH-116017: Put JIT code and data on the same page (GH-116845)
This commit is contained in:
parent
f55e1880c1
commit
2c82592ab4
3 changed files with 27 additions and 34 deletions
|
|
@ -124,7 +124,7 @@ def emit_aarch64_trampoline(self, hole: Hole) -> None:
|
|||
):
|
||||
self.holes.append(hole.replace(offset=base + 4 * i, kind=kind))
|
||||
|
||||
def remove_jump(self) -> None:
|
||||
def remove_jump(self, *, alignment: int = 1) -> None:
|
||||
"""Remove a zero-length continuation jump, if it exists."""
|
||||
hole = max(self.holes, key=lambda hole: hole.offset)
|
||||
match hole:
|
||||
|
|
@ -170,7 +170,7 @@ def remove_jump(self) -> None:
|
|||
offset -= 2
|
||||
case _:
|
||||
return
|
||||
if self.body[offset:] == jump:
|
||||
if self.body[offset:] == jump and offset % alignment == 0:
|
||||
self.body = self.body[:offset]
|
||||
self.holes.remove(hole)
|
||||
|
||||
|
|
@ -199,9 +199,8 @@ def process_relocations(self, *, alignment: int = 1) -> None:
|
|||
):
|
||||
self.code.pad(alignment)
|
||||
self.code.emit_aarch64_trampoline(hole)
|
||||
self.code.pad(alignment)
|
||||
self.code.holes.remove(hole)
|
||||
self.code.remove_jump()
|
||||
self.code.remove_jump(alignment=alignment)
|
||||
self.code.pad(alignment)
|
||||
self.data.pad(8)
|
||||
for stencil in [self.code, self.data]:
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ async def _parse(self, path: pathlib.Path) -> _stencils.StencilGroup:
|
|||
if group.data.body:
|
||||
line = f"0: {str(bytes(group.data.body)).removeprefix('b')}"
|
||||
group.data.disassembly.append(line)
|
||||
group.process_relocations()
|
||||
group.process_relocations(alignment=self.alignment)
|
||||
return group
|
||||
|
||||
def _handle_section(self, section: _S, group: _stencils.StencilGroup) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue