mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
GH-125498: Update JIT builds to use LLVM 19 and preserve_none (GH-125499)
This commit is contained in:
parent
597d814334
commit
c29bbe2101
11 changed files with 69 additions and 78 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
import dataclasses
|
||||
import enum
|
||||
import sys
|
||||
import typing
|
||||
|
||||
import _schema
|
||||
|
@ -132,8 +133,18 @@ class Hole:
|
|||
def __post_init__(self) -> None:
|
||||
self.func = _PATCH_FUNCS[self.kind]
|
||||
|
||||
def fold(self, other: typing.Self) -> typing.Self | None:
|
||||
def fold(self, other: typing.Self, body: bytes) -> typing.Self | None:
|
||||
"""Combine two holes into a single hole, if possible."""
|
||||
instruction_a = int.from_bytes(
|
||||
body[self.offset : self.offset + 4], byteorder=sys.byteorder
|
||||
)
|
||||
instruction_b = int.from_bytes(
|
||||
body[other.offset : other.offset + 4], byteorder=sys.byteorder
|
||||
)
|
||||
reg_a = instruction_a & 0b11111
|
||||
reg_b1 = instruction_b & 0b11111
|
||||
reg_b2 = (instruction_b >> 5) & 0b11111
|
||||
|
||||
if (
|
||||
self.offset + 4 == other.offset
|
||||
and self.value == other.value
|
||||
|
@ -141,6 +152,7 @@ class Hole:
|
|||
and self.addend == other.addend
|
||||
and self.func == "patch_aarch64_21rx"
|
||||
and other.func == "patch_aarch64_12x"
|
||||
and reg_a == reg_b1 == reg_b2
|
||||
):
|
||||
# These can *only* be properly relaxed when they appear together and
|
||||
# patch the same value:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue