Skip to content

Commit cb640b6

Browse files
Fidget-Spinnergarrettgu10blurb-it[bot]hugovk
authored
gh-128563: A new tail-calling interpreter (GH-128718)
Co-authored-by: Garrett Gu <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 555dc50 commit cb640b6

16 files changed

+3883
-623
lines changed

Diff for: .github/workflows/tail-call.yml

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Tail calling interpreter
2+
on:
3+
pull_request:
4+
paths:
5+
- 'Python/bytecodes.c'
6+
- 'Python/ceval.c'
7+
- 'Python/ceval_macros.h'
8+
push:
9+
paths:
10+
- 'Python/bytecodes.c'
11+
- 'Python/ceval.c'
12+
- 'Python/ceval_macros.h'
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
env:
23+
FORCE_COLOR: 1
24+
25+
jobs:
26+
tail-call:
27+
name: ${{ matrix.target }}
28+
runs-on: ${{ matrix.runner }}
29+
timeout-minutes: 90
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
target:
34+
# Un-comment as we add support for more platforms for tail-calling interpreters.
35+
# - i686-pc-windows-msvc/msvc
36+
# - x86_64-pc-windows-msvc/msvc
37+
# - aarch64-pc-windows-msvc/msvc
38+
- x86_64-apple-darwin/clang
39+
- aarch64-apple-darwin/clang
40+
- x86_64-unknown-linux-gnu/gcc
41+
- aarch64-unknown-linux-gnu/gcc
42+
llvm:
43+
- 19
44+
include:
45+
# - target: i686-pc-windows-msvc/msvc
46+
# architecture: Win32
47+
# runner: windows-latest
48+
# - target: x86_64-pc-windows-msvc/msvc
49+
# architecture: x64
50+
# runner: windows-latest
51+
# - target: aarch64-pc-windows-msvc/msvc
52+
# architecture: ARM64
53+
# runner: windows-latest
54+
- target: x86_64-apple-darwin/clang
55+
architecture: x86_64
56+
runner: macos-13
57+
- target: aarch64-apple-darwin/clang
58+
architecture: aarch64
59+
runner: macos-14
60+
- target: x86_64-unknown-linux-gnu/gcc
61+
architecture: x86_64
62+
runner: ubuntu-24.04
63+
- target: aarch64-unknown-linux-gnu/gcc
64+
architecture: aarch64
65+
runner: ubuntu-24.04-arm
66+
steps:
67+
- uses: actions/checkout@v4
68+
with:
69+
persist-credentials: false
70+
- uses: actions/setup-python@v5
71+
with:
72+
python-version: '3.11'
73+
74+
- name: Native Windows (debug)
75+
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
76+
run: |
77+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
78+
./PCbuild/build.bat --tail-call-interp -d -p ${{ matrix.architecture }}
79+
./PCbuild/rt.bat -d -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
80+
81+
# No tests (yet):
82+
- name: Emulated Windows (release)
83+
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
84+
run: |
85+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.0
86+
./PCbuild/build.bat --tail-call-interp -p ${{ matrix.architecture }}
87+
88+
# The `find` line is required as a result of https://github.com/actions/runner-images/issues/9966.
89+
# This is a bug in the macOS runner image where the pre-installed Python is installed in the same
90+
# directory as the Homebrew Python, which causes the build to fail for macos-13. This line removes
91+
# the symlink to the pre-installed Python so that the Homebrew Python is used instead.
92+
- name: Native macOS (debug)
93+
if: runner.os == 'macOS'
94+
run: |
95+
brew update
96+
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
97+
brew install llvm@${{ matrix.llvm }}
98+
export SDKROOT="$(xcrun --show-sdk-path)"
99+
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
100+
export PATH="/usr/local/opt/llvm/bin:$PATH"
101+
CC=clang-19 ./configure --with-tail-call-interp --with-pydebug
102+
make all --jobs 4
103+
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
104+
105+
- name: Native Linux (release)
106+
if: runner.os == 'Linux'
107+
run: |
108+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
109+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
110+
CC=clang-19 ./configure --with-tail-call-interp
111+
make all --jobs 4
112+
./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
113+

0 commit comments

Comments
 (0)