Skip to content

Commit 43740f7

Browse files
committed
Add Py_JIT_ENABLED variable to pyconfig.h
1 parent 616468b commit 43740f7

File tree

5 files changed

+66
-10
lines changed

5 files changed

+66
-10
lines changed

PCbuild/_freeze_module.vcxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,12 @@
449449
<PropertyGroup Condition="$(DisableGil) == 'true'">
450450
<PyConfigHText>$(PyConfigHText.Replace('#undef Py_GIL_DISABLED', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
451451
</PropertyGroup>
452+
<PropertyGroup Condition="$(UseJIT) == 'true'">
453+
<PyConfigHText>$(PyConfigHText.Replace('#undef Py_JIT_ENABLED', '#define Py_JIT_ENABLED 1'))</PyConfigHText>
454+
</PropertyGroup>
455+
<PropertyGroup Condition="$(UseTIER2) == 'true'">
456+
<PyConfigHText>$(PyConfigHText.Replace('#undef Py_JIT_ENABLED', '#define Py_JIT_ENABLED "interpreter"'))</PyConfigHText>
457+
</PropertyGroup>
452458
<Message Text="Updating pyconfig.h" Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
453459
<WriteLinesToFile File="$(IntDir)pyconfig.h"
454460
Lines="$(PyConfigHText)"

PCbuild/pythoncore.vcxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,12 @@
705705
<PropertyGroup Condition="$(DisableGil) == 'true'">
706706
<PyConfigHText>$(PyConfigHText.Replace('/* #define Py_GIL_DISABLED 1 */', '#define Py_GIL_DISABLED 1'))</PyConfigHText>
707707
</PropertyGroup>
708+
<PropertyGroup Condition="$(UseJIT) == 'true'">
709+
<PyConfigHText>$(PyConfigHText.Replace('/* #define Py_JIT_ENABLED 1 */', '#define Py_JIT_ENABLED 1'))</PyConfigHText>
710+
</PropertyGroup>
711+
<PropertyGroup Condition="$(UseTIER2) == 'true'">
712+
<PyConfigHText>$(PyConfigHText.Replace('/* #define Py_JIT_ENABLED "interpreter" */', '#define Py_JIT_ENABLED "interpreter"'))</PyConfigHText>
713+
</PropertyGroup>
708714
<Message Text="Updating pyconfig.h" Condition="$(PyConfigHText.TrimEnd()) != $(OldPyConfigH.TrimEnd())" />
709715
<WriteLinesToFile File="$(IntDir)pyconfig.h"
710716
Lines="$(PyConfigHText)"

configure

Lines changed: 30 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,11 +1820,26 @@ AC_ARG_ENABLE([experimental-jit],
18201820
[],
18211821
[enable_experimental_jit=no])
18221822
case $enable_experimental_jit in
1823-
no) jit_flags=""; tier2_flags="" ;;
1824-
yes) jit_flags="-D_Py_JIT"; tier2_flags="-D_Py_TIER2=1" ;;
1825-
yes-off) jit_flags="-D_Py_JIT"; tier2_flags="-D_Py_TIER2=3" ;;
1826-
interpreter) jit_flags=""; tier2_flags="-D_Py_TIER2=4" ;;
1827-
interpreter-off) jit_flags=""; tier2_flags="-D_Py_TIER2=6" ;; # Secret option
1823+
no)
1824+
jit_flags="";
1825+
tier2_flags="";
1826+
AC_DEFINE([Py_JIT_ENABLED], [1], [Define to 1 if you want to build an interpreter with JIT]) ;;
1827+
yes)
1828+
jit_flags="-D_Py_JIT";
1829+
tier2_flags="-D_Py_TIER2=1";
1830+
AC_DEFINE([Py_JIT_ENABLED], [1], [Define to 1 if you want to build an interpreter with JIT]) ;;
1831+
yes-off)
1832+
jit_flags="-D_Py_JIT";
1833+
tier2_flags="-D_Py_TIER2=3";
1834+
AC_DEFINE([Py_JIT_ENABLED], [1], [Define to 1 if you want to build an interpreter with JIT]) ;;
1835+
interpreter)
1836+
jit_flags="";
1837+
tier2_flags="-D_Py_TIER2=4";
1838+
AC_DEFINE([Py_JIT_ENABLED], ["interpreter"], [Define to interpreter if you want to build an interpreter with enabled tier 2 interpreter]) ;;
1839+
interpreter-off)
1840+
jit_flags="";
1841+
tier2_flags="-D_Py_TIER2=6";
1842+
AC_DEFINE([Py_JIT_ENABLED], ["interpreter"], [Define to interpreter if you want to build an interpreter with enabled tier 2 interpreter]) ;; # Secret option
18281843
*) AC_MSG_ERROR(
18291844
[invalid argument: --enable-experimental-jit=$enable_experimental_jit; expected no|yes|yes-off|interpreter]) ;;
18301845
esac

pyconfig.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,10 @@
16951695
/* Defined if _Complex C type is available. */
16961696
#undef Py_HAVE_C_COMPLEX
16971697

1698+
/* Define to interpreter if you want to build an interpreter with enabled tier
1699+
2 interpreter */
1700+
#undef Py_JIT_ENABLED
1701+
16981702
/* Define if year with century should be normalized for strftime. */
16991703
#undef Py_NORMALIZE_CENTURY
17001704

0 commit comments

Comments
 (0)