mirror of
https://github.com/python/cpython
synced 2026-09-29 11:30:29 +03:00
gh-118335: Configure Tier 2 interpreter at build time (#118339)
The code for Tier 2 is now only compiled when configured with `--enable-experimental-jit[=yes|interpreter]`. We drop support for `PYTHON_UOPS` and -`Xuops`, but you can disable the interpreter or JIT at runtime by setting `PYTHON_JIT=0`. You can also build it without enabling it by default using `--enable-experimental-jit=yes-off`; enable with `PYTHON_JIT=1`. On Windows, the `build.bat` script supports `--experimental-jit`, `--experimental-jit-off`, `--experimental-interpreter`. In the C code, `_Py_JIT` is defined as before when the JIT is enabled; the new variable `_Py_TIER2` is defined when the JIT *or* the interpreter is enabled. It is actually a bitmask: 1: JIT; 2: default-off; 4: interpreter.
This commit is contained in:
parent
9c468e2c5d
commit
7d83f7bcc4
32 changed files with 181 additions and 42 deletions
|
|
@ -108,6 +108,12 @@
|
|||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions Condition="'$(UseJIT)' == 'true'">_Py_JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(UseTIER2)' != '0'">_Py_TIER2=$(UseTIER2);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ echo. overrides -c and -d
|
|||
echo. --disable-gil Enable experimental support for running without the GIL.
|
||||
echo. --test-marker Enable the test marker within the build.
|
||||
echo. --regen Regenerate all opcodes, grammar and tokens.
|
||||
echo. --experimental-jit Enable the experimental just-in-time compiler.
|
||||
echo. --experimental-jit Enable the experimental just-in-time compiler.
|
||||
echo. --experimental-jit-off Ditto but off by default (PYTHON_JIT=1 enables).
|
||||
echo. --experimental-interpreter Enable the experimental Tier 2 interpreter.
|
||||
echo.
|
||||
echo.Available flags to avoid building certain modules.
|
||||
echo.These flags have no effect if '-e' is not given:
|
||||
|
|
@ -66,6 +68,7 @@ set verbose=/nologo /v:m /clp:summary
|
|||
set kill=
|
||||
set do_pgo=
|
||||
set pgo_job=-m test --pgo
|
||||
set UseTIER2=0
|
||||
|
||||
:CheckOpts
|
||||
if "%~1"=="-h" goto Usage
|
||||
|
|
@ -86,7 +89,10 @@ if "%~1"=="--disable-gil" (set UseDisableGil=true) & shift & goto CheckOpts
|
|||
if "%~1"=="--test-marker" (set UseTestMarker=true) & shift & goto CheckOpts
|
||||
if "%~1"=="-V" shift & goto Version
|
||||
if "%~1"=="--regen" (set Regen=true) & shift & goto CheckOpts
|
||||
if "%~1"=="--experimental-jit" (set UseJIT=true) & shift & goto CheckOpts
|
||||
if "%~1"=="--experimental-jit" (set UseJIT=true) & (set UseTIER2=1) & shift & goto CheckOpts
|
||||
if "%~1"=="--experimental-jit-off" (set UseJIT=true) & (set UseTIER2=3) & shift & goto CheckOpts
|
||||
if "%~1"=="--experimental-interpreter" (set UseTIER2=4) & shift & goto CheckOpts
|
||||
if "%~1"=="--experimental-interpreter-off" (set UseTIER2=6) & shift & goto CheckOpts
|
||||
rem These use the actual property names used by MSBuild. We could just let
|
||||
rem them in through the environment, but we specify them on the command line
|
||||
rem anyway for visibility so set defaults after this
|
||||
|
|
@ -179,6 +185,7 @@ echo on
|
|||
/p:DisableGil=%UseDisableGil%^
|
||||
/p:UseTestMarker=%UseTestMarker% %GITProperty%^
|
||||
/p:UseJIT=%UseJIT%^
|
||||
/p:UseTIER2=%UseTIER2%^
|
||||
%1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
|
||||
@echo off
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@
|
|||
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(UseJIT)' == 'true'">_Py_JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(UseTIER2)' != '0'">_Py_TIER2=$(UseTIER2);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue