Skip to content

Commit aaa6424

Browse files
committed
Patch 3.14.0a5 PGO on Windows amd64
1 parent 82c07fd commit aaa6424

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

cpython-windows/build.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,20 @@ def build_cpython(
13271327
)
13281328

13291329
if pgo:
1330+
if (
1331+
meets_python_minimum_version(python_version, "3.14")
1332+
and build_platform == "x64"
1333+
):
1334+
# On 3.14.0a5, PGO cannot be run on ceval so we disable it there
1335+
# See https://github.com/python/cpython/pull/130009
1336+
# We should be able to drop this patch in 3.14.0a6
1337+
exec_and_log(
1338+
["patch", "-p1", "-i", SUPPORT / "patch-disable-pgo-ceval-3.14.patch"],
1339+
str(cpython_source_path),
1340+
env,
1341+
exit_on_error=False,
1342+
)
1343+
13301344
run_msbuild(
13311345
msbuild,
13321346
pcbuild_path,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/Python/ceval.c b/Python/ceval.c
2+
index c6a7a0f841f027..5f8f0ae69ef31b 100644
3+
--- a/Python/ceval.c
4+
+++ b/Python/ceval.c
5+
@@ -764,15 +764,10 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch)
6+
#define PY_EVAL_C_STACK_UNITS 2
7+
8+
9+
-/* _PyEval_EvalFrameDefault is too large to optimize for speed with PGO on MSVC
10+
- when the JIT is enabled or GIL is disabled. Disable that optimization around
11+
- this function only. If this is fixed upstream, we should gate this on the
12+
- version of MSVC.
13+
+/* _PyEval_EvalFrameDefault is too large to optimize for speed with PGO on MSVC.
14+
*/
15+
#if (defined(_MSC_VER) && \
16+
- defined(_Py_USING_PGO) && \
17+
- (defined(_Py_JIT) || \
18+
- defined(Py_GIL_DISABLED)))
19+
+ defined(_Py_USING_PGO))
20+
#define DO_NOT_OPTIMIZE_INTERP_LOOP
21+
#endif
22+

0 commit comments

Comments
 (0)