]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-141808: Don't remove the JIT stencils when building with PGO (GH-141809...
authorMiro Hrončok <miro@hroncok.cz>
Sat, 20 Dec 2025 11:58:01 +0000 (12:58 +0100)
committerGitHub <noreply@github.com>
Sat, 20 Dec 2025 11:58:01 +0000 (12:58 +0100)
See: https://discuss.python.org/t/building-the-jit-with-pre-built-stencils/91838/12
(cherry picked from commit 8914148151c957aebfaab1f3c890144d1b33968d)
(cherry picked from commit 73c80f69ba37eebb5279dcdea7f0fa8ef856c143)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
Makefile.pre.in
Misc/NEWS.d/next/Build/2025-11-20-23-15-39.gh-issue-141808.NEewZC.rst [new file with mode: 0644]

index 066e71f012a6512f34a8bc75a6e28ad1350573f9..ecf77bdc41cc679afff9d0a933c9a171cd624ff8 100644 (file)
@@ -730,7 +730,7 @@ check-app-store-compliance:
 
 # Profile generation build must start from a clean tree.
 profile-clean-stamp:
-       $(MAKE) clean
+       $(MAKE) clean-profile
        touch $@
 
 # Compile with profile generation enabled.
@@ -2972,7 +2972,6 @@ 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
        -find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
        -rm -f Include/pydtrace_probes.h
        -rm -f profile-gen-stamp
@@ -2991,13 +2990,21 @@ profile-removal:
        rm -f profile-run-stamp
        rm -f profile-bolt-stamp
 
-.PHONY: clean
-clean: clean-retain-profile clean-bolt
+.PHONY: clean-profile
+clean-profile: clean-retain-profile clean-bolt
        @if test @DEF_MAKE_ALL_RULE@ = profile-opt -o @DEF_MAKE_ALL_RULE@ = bolt-opt; then \
                rm -f profile-gen-stamp profile-clean-stamp; \
                $(MAKE) profile-removal; \
        fi
 
+# gh-141808: The JIT stencils are deliberately kept in clean-profile
+.PHONY: clean-jit-stencils
+clean-jit-stencils:
+       -rm -f jit_stencils*.h
+
+.PHONY: clean
+clean: clean-profile clean-jit-stencils
+
 .PHONY: clobber
 clobber: clean
        -rm -f $(BUILDPYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
diff --git a/Misc/NEWS.d/next/Build/2025-11-20-23-15-39.gh-issue-141808.NEewZC.rst b/Misc/NEWS.d/next/Build/2025-11-20-23-15-39.gh-issue-141808.NEewZC.rst
new file mode 100644 (file)
index 0000000..73220e1
--- /dev/null
@@ -0,0 +1,4 @@
+When running ``make clean-retain-profile``, keep the
+generated JIT stencils. That way, the stencils are not generated twice when
+Profile-guided optimization (PGO) is used. It also allows distributors to
+supply their own pre-built JIT stencils.