8000 GH-113464: Generate a more efficient JIT by brandtbucher · Pull Request #118512 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-113464: Generate a more efficient JIT #118512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix AArch64 folds
  • Loading branch information
brandtbucher committed May 1, 2024
commit c40bb341d647f9011acdfd24dff523f3167f35a2
10 changes: 8 additions & 2 deletions Python/jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ patch_aarch64_12(unsigned char *location, uint64_t value)
set_bits(loc32, 10, value, shift, 12);
}

static inline void
patch_aarch64_12x(unsigned char *location, uint64_t value)
{
patch_aarch64_12(location, value);
}

// 16-bit low part of an absolute address.
static inline void
patch_aarch64_16a(unsigned char *location, uint64_t value)
Expand Down Expand Up @@ -295,7 +301,7 @@ patch_aarch64_26r(unsigned char *location, uint64_t value)
set_bits(loc32, 0, value, 2, 26);
}

// A pair of patch_aarch64_21rx and patch_aarch64_12.
// A pair of patch_aarch64_21rx and patch_aarch64_12x.
static inline void
patch_aarch64_33rx(unsigned char *location, uint64_t value)
{
Expand Down Expand Up @@ -331,7 +337,7 @@ patch_aarch64_33rx(unsigned char *location, uint64_t value)
return;
}
patch_aarch64_21rx(location, value);
patch_aarch64_12(location + 4, value);
patch_aarch64_12x(location + 4, value);
}

// 32-bit relative address.
Expand Down
10 changes: 5 additions & 5 deletions Tools/jit/_stencils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class HoleValue(enum.Enum):
# aarch64-apple-darwin:
"ARM64_RELOC_BRANCH26": "patch_aarch64_26r",
"ARM64_RELOC_GOT_LOAD_PAGE21": "patch_aarch64_21rx",
"ARM64_RELOC_GOT_LOAD_PAGEOFF12": "patch_aarch64_12",
"ARM64_RELOC_GOT_LOAD_PAGEOFF12": "patch_aarch64_12x",
"ARM64_RELOC_PAGE21": "patch_aarch64_21r",
"ARM64_RELOC_PAGEOFF12": "patch_aarch64_12",
"ARM64_RELOC_UNSIGNED": "patch_64",
Expand All @@ -62,18 +62,18 @@ class HoleValue(enum.Enum):
"IMAGE_REL_ARM64_BRANCH26": "patch_aarch64_26r",
"IMAGE_REL_ARM64_PAGEBASE_REL21": "patch_aarch64_21rx",
"IMAGE_REL_ARM64_PAGEOFFSET_12A": "patch_aarch64_12",
"IMAGE_REL_ARM64_PAGEOFFSET_12L": "patch_aarch64_12",
"IMAGE_REL_ARM64_PAGEOFFSET_12L": "patch_aarch64_12x",
# i686-pc-windows-msvc:
"IMAGE_REL_I386_DIR32": "patch_32",
"IMAGE_REL_I386_REL32": "patch_x86_64_32rx",
# aarch64-unknown-linux-gnu:
"R_AARCH64_ABS64": "patch_64",
"R_AARCH64_ADD_ABS_LO12_NC": "patch_aarch64_12",
"R_AARCH64_ADR_GOT_PAGE": "patch_aarch64_21rx",
"R_AARCH64_ADR_PREL_PG_HI21": "patch_aarch64_21rx",
"R_AARCH64_ADR_PREL_PG_HI21": "patch_aarch64_21r",
"R_AARCH64_CALL26": "patch_aarch64_26r",
"R_AARCH64_JUMP26": "patch_aarch64_26r",
"R_AARCH64_LD64_GOT_LO12_NC": "patch_aarch64_12",
"R_AARCH64_LD64_GOT_LO12_NC": "patch_aarch64_12x",
"R_AARCH64_MOVW_UABS_G0_NC": "patch_aarch64_16a",
"R_AARCH64_MOVW_UABS_G1_NC": "patch_aarch64_16b",
"R_AARCH64_MOVW_UABS_G2_NC": "patch_aarch64_16c",
Expand Down Expand Up @@ -141,7 +141,7 @@ def fold(self, other: typing.Self) -> typing.Self | None:
and self.symbol == other.symbol
and self.addend == other.addend
and self.func == "patch_aarch64_21rx"
and other.func == "patch_aarch64_12"
and other.func == "patch_aarch64_12x"
):
folded = self.replace()
folded.func = "patch_aarch64_33rx"
Expand Down
0