Skip to content

GH-113464: Clean up JIT stencil generation #115800

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 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
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
11 changes: 5 additions & 6 deletions Tools/jit/_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class _Target(typing.Generic[_S, _R]):
def _compute_digest(self, out: pathlib.Path) -> str:
hasher = hashlib.sha256()
hasher.update(self.triple.encode())
hasher.update(self.alignment.to_bytes())
hasher.update(self.prefix.encode())
hasher.update(self.debug.to_bytes())
# These dependencies are also reflected in _JITSources in regen.targets:
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
hasher.update((out / "pyconfig.h").read_bytes())
Expand Down Expand Up @@ -119,6 +118,7 @@ async def _compile(
"-O3",
"-c",
"-fno-asynchronous-unwind-tables",
"-fno-builtin",
# SET_FUNCTION_ATTRIBUTE on 32-bit Windows debug builds:
"-fno-jump-tables",
# Position-independent code adds indirection to every load and jump:
Expand Down Expand Up @@ -166,7 +166,7 @@ def build(self, out: pathlib.Path, *, comment: str = "") -> None:
with jit_stencils.open("w") as file:
file.write(digest)
if comment:
file.write(f"// {comment}\n")
file.write(f"// {comment}\n\n")
file.write("")
for line in _writer.dump(stencil_groups):
file.write(f"{line}\n")
Expand Down Expand Up @@ -310,6 +310,8 @@ def _handle_section(
flags = {flag["Name"] for flag in section["Attributes"]["Flags"]}
name = section["Name"]["Value"]
name = name.removeprefix(self.prefix)
if "Debug" in flags:
return
if "SomeInstructions" in flags:
value = _stencils.HoleValue.CODE
stencil = group.code
Expand Down Expand Up @@ -371,9 +373,6 @@ def _handle_relocation(
addend = 0
case _:
raise NotImplementedError(relocation)
# Turn Clang's weird __bzero calls into normal bzero calls:
if symbol == "__bzero":
symbol = "bzero"
return _stencils.Hole(offset, kind, value, symbol, addend)


Expand Down