Skip to content

Commit 004e818

Browse files
brandtbucherdiegorusso
authored andcommitted
pythonGH-113464: Clean up JIT stencil generation (pythonGH-115800)
1 parent 0488bca commit 004e818

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Tools/jit/_targets.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class _Target(typing.Generic[_S, _R]):
4545
def _compute_digest(self, out: pathlib.Path) -> str:
4646
hasher = hashlib.sha256()
4747
hasher.update(self.triple.encode())
48-
hasher.update(self.alignment.to_bytes())
49-
hasher.update(self.prefix.encode())
48+
hasher.update(self.debug.to_bytes())
5049
# These dependencies are also reflected in _JITSources in regen.targets:
5150
hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
5251
hasher.update((out / "pyconfig.h").read_bytes())
@@ -119,6 +118,7 @@ async def _compile(
119118
"-O3",
120119
"-c",
121120
"-fno-asynchronous-unwind-tables",
121+
"-fno-builtin",
122122
# SET_FUNCTION_ATTRIBUTE on 32-bit Windows debug builds:
123123
"-fno-jump-tables",
124124
# Position-independent code adds indirection to every load and jump:
@@ -166,7 +166,7 @@ def build(self, out: pathlib.Path, *, comment: str = "") -> None:
166166
with jit_stencils.open("w") as file:
167167
file.write(digest)
168168
if comment:
169-
file.write(f"// {comment}\n")
169+
file.write(f"// {comment}\n\n")
170170
file.write("")
171171
for line in _writer.dump(stencil_groups):
172172
file.write(f"{line}\n")
@@ -310,6 +310,8 @@ def _handle_section(
310310
flags = {flag["Name"] for flag in section["Attributes"]["Flags"]}
311311
name = section["Name"]["Value"]
312312
name = name.removeprefix(self.prefix)
313+
if "Debug" in flags:
314+
return
313315
if "SomeInstructions" in flags:
314316
value = _stencils.HoleValue.CODE
315317
stencil = group.code
@@ -371,9 +373,6 @@ def _handle_relocation(
371373
addend = 0
372374
case _:
373375
raise NotImplementedError(relocation)
374-
# Turn Clang's weird __bzero calls into normal bzero calls:
375-
if symbol == "__bzero":
376-
symbol = "bzero"
377376
return _stencils.Hole(offset, kind, value, symbol, addend)
378377

379378

0 commit comments

Comments
 (0)