Skip to content
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
Cleanup
  • Loading branch information
brandtbucher committed May 20, 2025
commit 049491dd1da00d0c5b3050a266a0cded89565a53
8 changes: 3 additions & 5 deletions Tools/jit/_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class _Target(typing.Generic[_S, _R]):
debug: bool = False
verbose: bool = False
known_symbols: dict[str, int] = dataclasses.field(default_factory=dict)
pyconfig: pathlib.Path | None = None
pyconfig_dir: pathlib.Path = pathlib.Path.cwd().resolve()

def _get_nop(self) -> bytes:
if re.fullmatch(r"aarch64-.*", self.triple):
Expand All @@ -64,8 +64,7 @@ def _compute_digest(self) -> str:
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())
assert self.pyconfig is not None
hasher.update(self.pyconfig.read_bytes())
hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes())
for dirpath, _, filenames in sorted(os.walk(TOOLS_JIT)):
for filename in filenames:
hasher.update(pathlib.Path(dirpath, filename).read_bytes())
Expand Down Expand Up @@ -120,15 +119,14 @@ async def _compile(
self, opname: str, c: pathlib.Path, tempdir: pathlib.Path
) -> _stencils.StencilGroup:
o = tempdir / f"{opname}.o"
assert self.pyconfig is not None
args = [
f"--target={self.triple}",
"-DPy_BUILD_CORE_MODULE",
"-D_DEBUG" if self.debug else "-DNDEBUG",
f"-D_JIT_OPCODE={opname}",
"-D_PyJIT_ACTIVE",
"-D_Py_JIT",
f"-I{self.pyconfig.parent}",
f"-I{self.pyconfig_dir}",
f"-I{CPYTHON / 'Include'}",
f"-I{CPYTHON / 'Include' / 'internal'}",
f"-I{CPYTHON / 'Include' / 'internal' / 'mimalloc'}",
Expand Down
2 changes: 1 addition & 1 deletion Tools/jit/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
target.debug = args.debug
target.force = args.force
target.verbose = args.verbose
target.pyconfig = args.pyconfig_dir / "pyconfig.h"
target.pyconfig_dir = args.pyconfig_dir
target.build(
comment=comment,
force=args.force,
Expand Down
2 changes: 1 addition & 1 deletion configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2776,7 +2776,7 @@ AS_VAR_IF([jit_flags],
[],
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
AS_VAR_SET([REGEN_JIT_COMMAND],
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host}"])
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir ."])
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
AS_VAR_IF([Py_DEBUG],
[true],
Expand Down
Loading