Skip to content

Commit 0da8681

Browse files
committed
Allow enabling the JIT on macOS
1 parent 17d5ca7 commit 0da8681

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

cpython-unix/build-cpython.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,13 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then
427427

428428
# Allow users to enable the experimental JIT on 3.13+
429429
if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then
430+
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off"
430431

431-
# The JIT build is failing on macOS due to compiler errors
432-
# Only enable on Linux / 3.13 until that's fixed upstream
433-
if [[ "${PYBUILD_PLATFORM}" != "macos" ]]; then
434-
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off"
432+
# The JIT build process is separate from the normal build and doesn't read our standard
433+
# compiler flags so we need to patch our Clang toolchain into the includes.
434+
# This is only necessary on macOS.
435+
if [[ "${PYBUILD_PLATFORM}" = "macos" ]]; then
436+
patch -p1 -i "${ROOT}/patch-jit-include-flags.patch"
435437
fi
436438

437439
if [[ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_13}" ]]; then
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py
2+
index 7eb433e2a5b..cd838daa8c5 100644
3+
--- a/Tools/jit/_targets.py
4+
+++ b/Tools/jit/_targets.py
5+
@@ -113,6 +113,7 @@ async def _compile(
6+
"-D_PyJIT_ACTIVE",
7+
"-D_Py_JIT",
8+
"-I.",
9+
+ f"-I${os.environ['TOOLS_PATH']}/deps/include",
10+
f"-I{CPYTHON / 'Include'}",
11+
f"-I{CPYTHON / 'Include' / 'internal'}",
12+
f"-I{CPYTHON / 'Include' / 'internal' / 'mimalloc'}",

0 commit comments

Comments
 (0)