mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
GH-114809: Add support for macOS multi-arch builds with the JIT enabled (#131751)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com> Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
This commit is contained in:
parent
2b67db7ce3
commit
26c0248b54
7 changed files with 152 additions and 102 deletions
78
configure.ac
78
configure.ac
|
@ -1802,41 +1802,6 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
# Check for --enable-experimental-jit:
|
||||
AC_MSG_CHECKING([for --enable-experimental-jit])
|
||||
AC_ARG_ENABLE([experimental-jit],
|
||||
[AS_HELP_STRING([--enable-experimental-jit@<:@=no|yes|yes-off|interpreter@:>@],
|
||||
[build the experimental just-in-time compiler (default is no)])],
|
||||
[],
|
||||
[enable_experimental_jit=no])
|
||||
case $enable_experimental_jit in
|
||||
no) jit_flags=""; tier2_flags="" ;;
|
||||
yes) jit_flags="-D_Py_JIT"; tier2_flags="-D_Py_TIER2=1" ;;
|
||||
yes-off) jit_flags="-D_Py_JIT"; tier2_flags="-D_Py_TIER2=3" ;;
|
||||
interpreter) jit_flags=""; tier2_flags="-D_Py_TIER2=4" ;;
|
||||
interpreter-off) jit_flags=""; tier2_flags="-D_Py_TIER2=6" ;; # Secret option
|
||||
*) AC_MSG_ERROR(
|
||||
[invalid argument: --enable-experimental-jit=$enable_experimental_jit; expected no|yes|yes-off|interpreter]) ;;
|
||||
esac
|
||||
AS_VAR_IF([tier2_flags],
|
||||
[],
|
||||
[],
|
||||
[AS_VAR_APPEND([CFLAGS_NODIST], [" $tier2_flags"])])
|
||||
AS_VAR_IF([jit_flags],
|
||||
[],
|
||||
[],
|
||||
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
|
||||
AS_VAR_SET([REGEN_JIT_COMMAND],
|
||||
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py $host"])
|
||||
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
|
||||
AS_VAR_IF([Py_DEBUG],
|
||||
[true],
|
||||
[AS_VAR_APPEND([REGEN_JIT_COMMAND], [" --debug"])],
|
||||
[])])
|
||||
AC_SUBST([REGEN_JIT_COMMAND])
|
||||
AC_SUBST([JIT_STENCILS_H])
|
||||
AC_MSG_RESULT([$tier2_flags $jit_flags])
|
||||
|
||||
# Enable optimization flags
|
||||
AC_SUBST([DEF_MAKE_ALL_RULE])
|
||||
AC_SUBST([DEF_MAKE_RULE])
|
||||
|
@ -2652,42 +2617,50 @@ AS_VAR_IF([ac_cv_gcc_compat], [yes], [
|
|||
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
|
||||
LIPO_32BIT_FLAGS=""
|
||||
ARCH_RUN_32BIT=""
|
||||
ARCH_TRIPLES=`echo {ppc,i386}-apple-darwin`
|
||||
;;
|
||||
64-bit)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
|
||||
LIPO_32BIT_FLAGS=""
|
||||
ARCH_RUN_32BIT="true"
|
||||
ARCH_TRIPLES=`echo {ppc64,x86_64}-apple-darwin`
|
||||
;;
|
||||
all)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
|
||||
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
|
||||
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
|
||||
ARCH_TRIPLES=`echo {i386,ppc,ppc64,x86_64}-apple-darwin`
|
||||
;;
|
||||
universal2)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
|
||||
LIPO_32BIT_FLAGS=""
|
||||
LIPO_INTEL64_FLAGS="-extract x86_64"
|
||||
ARCH_RUN_32BIT="true"
|
||||
ARCH_TRIPLES=`echo {aarch64,x86_64}-apple-darwin`
|
||||
;;
|
||||
intel)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
|
||||
LIPO_32BIT_FLAGS="-extract i386"
|
||||
ARCH_RUN_32BIT="/usr/bin/arch -i386"
|
||||
ARCH_TRIPLES=`echo {i386,x86_64}-apple-darwin`
|
||||
;;
|
||||
intel-32)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch i386"
|
||||
LIPO_32BIT_FLAGS=""
|
||||
ARCH_RUN_32BIT=""
|
||||
ARCH_TRIPLES=i386-apple-darwin
|
||||
;;
|
||||
intel-64)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch x86_64"
|
||||
LIPO_32BIT_FLAGS=""
|
||||
ARCH_RUN_32BIT="true"
|
||||
ARCH_TRIPLES=x86_64-apple-darwin
|
||||
;;
|
||||
3-way)
|
||||
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
|
||||
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
|
||||
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
|
||||
ARCH_TRIPLES=`echo {i386,ppc,x86_64}-apple-darwin`
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|3-way])
|
||||
|
@ -2778,6 +2751,41 @@ AS_VAR_IF([ac_cv_gcc_compat], [yes], [
|
|||
esac
|
||||
])
|
||||
|
||||
# Check for --enable-experimental-jit:
|
||||
AC_MSG_CHECKING([for --enable-experimental-jit])
|
||||
AC_ARG_ENABLE([experimental-jit],
|
||||
[AS_HELP_STRING([--enable-experimental-jit@<:@=no|yes|yes-off|interpreter@:>@],
|
||||
[build the experimental just-in-time compiler (default is no)])],
|
||||
[],
|
||||
[enable_experimental_jit=no])
|
||||
case $enable_experimental_jit in
|
||||
no) jit_flags=""; tier2_flags="" ;;
|
||||
yes) jit_flags="-D_Py_JIT"; tier2_flags="-D_Py_TIER2=1" ;;
|
||||
yes-off) jit_flags="-D_Py_JIT"; tier2_flags="-D_Py_TIER2=3" ;;
|
||||
interpreter) jit_flags=""; tier2_flags="-D_Py_TIER2=4" ;;
|
||||
interpreter-off) jit_flags=""; tier2_flags="-D_Py_TIER2=6" ;; # Secret option
|
||||
*) AC_MSG_ERROR(
|
||||
[invalid argument: --enable-experimental-jit=$enable_experimental_jit; expected no|yes|yes-off|interpreter]) ;;
|
||||
esac
|
||||
AS_VAR_IF([tier2_flags],
|
||||
[],
|
||||
[],
|
||||
[AS_VAR_APPEND([CFLAGS_NODIST], [" $tier2_flags"])])
|
||||
AS_VAR_IF([jit_flags],
|
||||
[],
|
||||
[],
|
||||
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
|
||||
AS_VAR_SET([REGEN_JIT_COMMAND],
|
||||
["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host}"])
|
||||
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
|
||||
AS_VAR_IF([Py_DEBUG],
|
||||
[true],
|
||||
[AS_VAR_APPEND([REGEN_JIT_COMMAND], [" --debug"])],
|
||||
[])])
|
||||
AC_SUBST([REGEN_JIT_COMMAND])
|
||||
AC_SUBST([JIT_STENCILS_H])
|
||||
AC_MSG_RESULT([$tier2_flags $jit_flags])
|
||||
|
||||
case "$ac_cv_cc_name" in
|
||||
mpicc)
|
||||
CFLAGS_NODIST="$CFLAGS_NODIST"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue