Skip to content

Commit 7202f02

Browse files
committed
Allow enabling the JIT on macOS
1 parent fec8f6b commit 7202f02

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
@@ -454,11 +454,13 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then
454454

455455
# Allow users to enable the experimental JIT on 3.13+
456456
if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" ]]; then
457+
CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --enable-experimental-jit=yes-off"
457458

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

464466
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)