GH-131278: Add option to build with computed gotos on Windows with clang-cl (GH-131279)

This commit is contained in:
Chris Eibl 2025-03-17 21:32:23 +01:00 committed by GitHub
parent 94f4d87aeb
commit 468a7aaeb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,2 @@
Add optimizing flag ``WITH_COMPUTED_GOTOS`` to Windows builds for when
using a compiler that supports it (currently clang-cl). Patch by Chris Eibl.

View file

@ -107,6 +107,7 @@
<PreprocessorDefinitions Condition="'$(UseJIT)' == 'true'">_Py_JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(UseTIER2)' != '' and '$(UseTIER2)' != '0'">_Py_TIER2=$(UseTIER2);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(UseTailCallInterp)' == 'true'">Py_TAIL_CALL_INTERP=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(WITH_COMPUTED_GOTOS)' != ''">HAVE_COMPUTED_GOTOS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>

View file

@ -310,6 +310,27 @@ See
for more on this topic.
Optimization flags
------------------
You can set optimization flags either via
* environment variables, for example:
set WITH_COMPUTED_GOTOS=true
* or pass them as parameters to `build.bat`, for example:
build.bat "/p:WITH_COMPUTED_GOTOS=true"
* or put them in `msbuild.rsp` in the `PCbuild` directory, one flag per line.
Supported flags are:
* WITH_COMPUTED_GOTOS: build the interpreter using "computed gotos".
Currently only supported by clang-cl.
Static library
--------------