Skip to content

Commit db110ff

Browse files
Fix builds, address review
1 parent 8a2423d commit db110ff

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Programs/test_frozenmain.h generated
9595
Python/Python-ast.c generated
9696
Python/executor_cases.c.h generated
9797
Python/generated_cases.c.h generated
98+
Python/generated_tail_call_handlers.c.h generated
9899
Python/optimizer_cases.c.h generated
99100
Python/opcode_targets.h generated
100101
Python/stdlib_module_names.h generated

.github/workflows/tail-call.yml

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

Tools/c-analyzer/cpython/_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def clean_lines(text):
8080
Python/deepfreeze/*.c
8181
Python/frozen_modules/*.h
8282
Python/generated_cases.c.h
83+
Python/generated_tail_call_handlers.c.h
8384
Python/executor_cases.c.h
8485
Python/optimizer_cases.c.h
8586

Tools/jit/template.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
goto LABEL ## _tier_two; \
5050
} while (0)
5151

52+
#undef CEVAL_GOTO
53+
#define CEVAL_GOTO(LABEL) \
54+
do { \
55+
goto LABEL ## _tier_two; \
56+
} while (0)
57+
58+
5259
#undef GOTO_TIER_TWO
5360
#define GOTO_TIER_TWO(EXECUTOR) \
5461
do { \

0 commit comments

Comments
 (0)