https://github.com/python/cpython/commit/73c80f69ba37eebb5279dcdea7f0fa8ef856c143
commit: 73c80f69ba37eebb5279dcdea7f0fa8ef856c143
branch: 3.14
author: Stan Ulbrych <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2025-12-13T14:15:10Z
summary:

[3.14] gh-141808: Don't remove the JIT stencils when building with PGO 
(GH-141809) (GH-142657)

See: 
https://discuss.python.org/t/building-the-jit-with-pre-built-stencils/91838/12
(cherry picked from commit 8914148151c957aebfaab1f3c890144d1b33968d)

Co-authored-by: Miro HronĨok <[email protected]>
Co-authored-by: Mikhail Efimov <[email protected]>

files:
A Misc/NEWS.d/next/Build/2025-11-20-23-15-39.gh-issue-141808.NEewZC.rst
M Makefile.pre.in

diff --git a/Makefile.pre.in b/Makefile.pre.in
index 08ad5f4921dd5f..38a355a23f2aab 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -834,7 +834,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.
@@ -3222,7 +3222,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
@@ -3241,13 +3240,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
index 00000000000000..73220e1990006b
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2025-11-20-23-15-39.gh-issue-141808.NEewZC.rst
@@ -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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to