Skip to content

Allow enabling the JIT on macOS #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,13 @@ if [ -n "${CPYTHON_OPTIMIZED}" ]; then

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

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

if [[ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_13}" ]]; then
Expand Down
12 changes: 12 additions & 0 deletions cpython-unix/patch-jit-include-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py
index 7eb433e2a5b..cd838daa8c5 100644
--- a/Tools/jit/_targets.py
+++ b/Tools/jit/_targets.py
@@ -113,6 +113,7 @@ async def _compile(
"-D_PyJIT_ACTIVE",
"-D_Py_JIT",
"-I.",
+ f"-I${os.environ['TOOLS_PATH']}/deps/include",
f"-I{CPYTHON / 'Include'}",
f"-I{CPYTHON / 'Include' / 'internal'}",
f"-I{CPYTHON / 'Include' / 'internal' / 'mimalloc'}",
Loading