diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50b0469867c1a4..a8e706608cafff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -167,14 +167,12 @@ jobs: - true interpreter: - switch-case + - tail-call exclude: # Skip Win32 on free-threaded builds - { arch: Win32, free-threading: true } - include: - # msvc::musttail is currently only supported on x64, - # and only supported on 3.15+. - - { arch: x64, free-threading: false, interpreter: tail-call } - - { arch: x64, free-threading: true, interpreter: tail-call } + # Skip Win32 on tail-call interpreter builds + - { arch: Win32, interpreter: tail-call } uses: $/.github/workflows/reusable-windows.yml with: arch: ${{ matrix.arch }} diff --git a/.github/workflows/reusable-windows.yml b/.github/workflows/reusable-windows.yml index eb6c22f2c4cf43..a03c1ff7b2fc88 100644 --- a/.github/workflows/reusable-windows.yml +++ b/.github/workflows/reusable-windows.yml @@ -37,6 +37,17 @@ jobs: - name: Register MSVC problem matcher if: inputs.arch != 'Win32' run: echo "::add-matcher::.github/problem-matchers/msvc.json" + - name: Select native ARM64 MSBuild + if: inputs.arch == 'arm64' + shell: pwsh + run: | + # The x86-hosted linker can run out of heap space during LTCG. + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $msbuild = & $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.ARM64 -find 'MSBuild\Current\Bin\arm64\MSBuild.exe' + if (!$msbuild -or !(Test-Path -LiteralPath $msbuild -PathType Leaf)) { + throw 'Native ARM64 MSBuild was not found.' + } + ('MSBUILD="{0}"' -f $msbuild) >> $env:GITHUB_ENV - name: Build CPython # msvc::musttail is not supported for debug builds, so we have to # switch to release. diff --git a/InternalDocs/interpreter.md b/InternalDocs/interpreter.md index fa89996aa65429..987ac7bbed181b 100644 --- a/InternalDocs/interpreter.md +++ b/InternalDocs/interpreter.md @@ -525,8 +525,9 @@ There are three different types of interpreters to choose from based on compiler [preserve_none](https://clang.llvm.org/docs/AttributeReference.html#preserve-none) calling convention between the small C functions that implement individual Python opcodes. - Not all compilers support these and if they do not all targets might be supported (for example, - MSVC currently only supports x64 and only in optimized builds). + Support depends on the compiler and target architecture. With MSVC, the + tail-calling interpreter is available only in optimized builds. The minimum + MSVC version is 14.50 for x64 and 14.52 for ARM64. In addition, compilers must do [escape analysis](https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-musttail) of the lifetimes of automatic variables, function parameters, and temporaries to ensure proper tail-calls. They