]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-137218: Update `make` for JIT stencils (#137265)
authorSavannah Bailey <savannahostrowski@gmail.com>
Fri, 19 Sep 2025 09:36:42 +0000 (10:36 +0100)
committerGitHub <noreply@github.com>
Fri, 19 Sep 2025 09:36:42 +0000 (10:36 +0100)
Makefile.pre.in
Tools/jit/_targets.py
configure
configure.ac

index a2a5f10585d27abbc585bab55b7ff7242c68e742..610269c9e0e828824b278f5b8fd378faf8017cb0 100644 (file)
@@ -3126,11 +3126,27 @@ JIT_DEPS = \
                $(srcdir)/Tools/jit/*.py \
                $(srcdir)/Python/executor_cases.c.h \
                pyconfig.h
-
-jit_stencils.h: $(JIT_DEPS)
+               
+ifneq ($(filter aarch64-apple-darwin%,$(HOST_GNU_TYPE)),)
+JIT_STENCIL_HEADER := jit_stencils-aarch64-apple-darwin.h
+else ifneq ($(filter x86_64-apple-darwin%,$(HOST_GNU_TYPE)),)
+JIT_STENCIL_HEADER := jit_stencils-x86_64-apple-darwin.h
+else ifeq ($(HOST_GNU_TYPE), aarch64-pc-windows-msvc)
+JIT_STENCIL_HEADER := jit_stencils-aarch64-pc-windows-msvc.h
+else ifeq ($(HOST_GNU_TYPE), i686-pc-windows-msvc)
+JIT_STENCIL_HEADER := jit_stencils-i686-pc-windows-msvc.h
+else ifeq ($(HOST_GNU_TYPE), x86_64-pc-windows-msvc)
+JIT_STENCIL_HEADER := jit_stencils-x86_64-pc-windows-msvc.h
+else ifneq ($(filter aarch64-%-linux-gnu,$(HOST_GNU_TYPE)),)
+JIT_STENCIL_HEADER := jit_stencils-$(HOST_GNU_TYPE).h
+else ifneq ($(filter x86_64-%-linux-gnu,$(HOST_GNU_TYPE)),)
+JIT_STENCIL_HEADER := jit_stencils-$(HOST_GNU_TYPE).h
+endif
+
+jit_stencils.h $(JIT_STENCIL_HEADER): $(JIT_DEPS)
        @REGEN_JIT_COMMAND@
 
-Python/jit.o: $(srcdir)/Python/jit.c @JIT_STENCILS_H@
+Python/jit.o: $(srcdir)/Python/jit.c jit_stencils.h $(JIT_STENCIL_HEADER)
        $(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
 
 .PHONY: regen-jit
@@ -3228,7 +3244,7 @@ clean-retain-profile: pycremoval
        -rm -rf Python/deepfreeze
        -rm -f Python/frozen_modules/*.h
        -rm -f Python/frozen_modules/MANIFEST
-       -rm -f jit_stencils.h
+       -rm -f jit_stencils*.h
        -find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
        -rm -f Include/pydtrace_probes.h
        -rm -f profile-gen-stamp
index 2185d8190a8935030685d1d3dd705ab23041f1e1..2f3969e7d0540caed8d360688b3fe779cf5e65bb 100644 (file)
@@ -551,38 +551,45 @@ def get_target(host: str) -> _COFF32 | _COFF64 | _ELF | _MachO:
     optimizer: type[_optimizers.Optimizer]
     target: _COFF32 | _COFF64 | _ELF | _MachO
     if re.fullmatch(r"aarch64-apple-darwin.*", host):
+        host = "aarch64-apple-darwin"
         condition = "defined(__aarch64__) && defined(__APPLE__)"
         optimizer = _optimizers.OptimizerAArch64
         target = _MachO(host, condition, optimizer=optimizer)
     elif re.fullmatch(r"aarch64-pc-windows-msvc", host):
-        args = ["-fms-runtime-lib=dll", "-fplt"]
+        host = "aarch64-pc-windows-msvc"
         condition = "defined(_M_ARM64)"
+        args = ["-fms-runtime-lib=dll", "-fplt"]
         optimizer = _optimizers.OptimizerAArch64
         target = _COFF64(host, condition, args=args, optimizer=optimizer)
     elif re.fullmatch(r"aarch64-.*-linux-gnu", host):
+        host = "aarch64-unknown-linux-gnu"
+        condition = "defined(__aarch64__) && defined(__linux__)"
         # -mno-outline-atomics: Keep intrinsics from being emitted.
         args = ["-fpic", "-mno-outline-atomics"]
-        condition = "defined(__aarch64__) && defined(__linux__)"
         optimizer = _optimizers.OptimizerAArch64
         target = _ELF(host, condition, args=args, optimizer=optimizer)
     elif re.fullmatch(r"i686-pc-windows-msvc", host):
+        host = "i686-pc-windows-msvc"
+        condition = "defined(_M_IX86)"
         # -Wno-ignored-attributes: __attribute__((preserve_none)) is not supported here.
         args = ["-DPy_NO_ENABLE_SHARED", "-Wno-ignored-attributes"]
         optimizer = _optimizers.OptimizerX86
-        condition = "defined(_M_IX86)"
         target = _COFF32(host, condition, args=args, optimizer=optimizer)
     elif re.fullmatch(r"x86_64-apple-darwin.*", host):
+        host = "x86_64-apple-darwin"
         condition = "defined(__x86_64__) && defined(__APPLE__)"
         optimizer = _optimizers.OptimizerX86
         target = _MachO(host, condition, optimizer=optimizer)
     elif re.fullmatch(r"x86_64-pc-windows-msvc", host):
-        args = ["-fms-runtime-lib=dll"]
+        host = "x86_64-pc-windows-msvc"
         condition = "defined(_M_X64)"
+        args = ["-fms-runtime-lib=dll"]
         optimizer = _optimizers.OptimizerX86
         target = _COFF64(host, condition, args=args, optimizer=optimizer)
     elif re.fullmatch(r"x86_64-.*-linux-gnu", host):
-        args = ["-fno-pic", "-mcmodel=medium", "-mlarge-data-threshold=0"]
+        host = "x86_64-unknown-linux-gnu"
         condition = "defined(__x86_64__) && defined(__linux__)"
+        args = ["-fno-pic", "-mcmodel=medium", "-mlarge-data-threshold=0"]
         optimizer = _optimizers.OptimizerX86
         target = _ELF(host, condition, args=args, optimizer=optimizer)
     else:
index ed6befdbced108ce7c09279d91d1409e0491546f..f6385f9d0ca6d3fbf1af7877dc8526d14aa7ee88 100755 (executable)
--- a/configure
+++ b/configure
@@ -904,7 +904,6 @@ LDSHARED
 SHLIB_SUFFIX
 DSYMUTIL_PATH
 DSYMUTIL
-JIT_STENCILS_H
 REGEN_JIT_COMMAND
 UNIVERSAL_ARCH_FLAGS
 WASM_STDLIB
@@ -10876,7 +10875,6 @@ then :
 else case e in #(
   e) as_fn_append CFLAGS_NODIST " $jit_flags"
            REGEN_JIT_COMMAND="\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir . --cflags=\"$CFLAGS_JIT\""
-           JIT_STENCILS_H="jit_stencils.h"
            if test "x$Py_DEBUG" = xtrue
 then :
   as_fn_append REGEN_JIT_COMMAND " --debug"
@@ -10884,7 +10882,6 @@ fi ;;
 esac
 fi
 
-
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $tier2_flags $jit_flags" >&5
 printf "%s\n" "$tier2_flags $jit_flags" >&6; }
 
index 5d4c5c431879539e4af73672f56de2b8e46af1b9..8cc3a0c0401f35b345e71bd692d3551a4f059686 100644 (file)
@@ -2787,13 +2787,11 @@ 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} --output-dir . --pyconfig-dir . --cflags=\"$CFLAGS_JIT\""])
-           AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
            AS_VAR_IF([Py_DEBUG],
                      [true],
                      [AS_VAR_APPEND([REGEN_JIT_COMMAND], [" --debug"])],
                      [])])
 AC_SUBST([REGEN_JIT_COMMAND])
-AC_SUBST([JIT_STENCILS_H])
 AC_MSG_RESULT([$tier2_flags $jit_flags])
 
 if test "$disable_gil" = "yes" -a "$enable_experimental_jit" != "no"; then