Skip to content

Commit d4387f1

Browse files
committed
Merge branch 'main' into issue-108303-reperf
2 parents 15c0618 + 4742047 commit d4387f1

File tree

773 files changed

+28831
-9464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

773 files changed

+28831
-9464
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
root = true
22

3-
[*.{py,c,cpp,h,rst,md,yml}]
3+
[*.{py,c,cpp,h,js,rst,md,yml}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
@@ -11,5 +11,5 @@ indent_size = 4
1111
[*.rst]
1212
indent_size = 3
1313

14-
[*.yml]
14+
[*.{js,yml}]
1515
indent_size = 2

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Programs/test_frozenmain.h generated
9494
Python/Python-ast.c generated
9595
Python/executor_cases.c.h generated
9696
Python/generated_cases.c.h generated
97+
Python/tier2_redundancy_eliminator_bytecodes.c.h generated
9798
Python/opcode_targets.h generated
9899
Python/stdlib_module_names.h generated
99100
Tools/peg_generator/pegen/grammar_parser.py generated

.github/CODEOWNERS

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ configure* @erlend-aasland @corona10
2121
**/*context* @1st1
2222
**/*genobject* @markshannon
2323
**/*hamt* @1st1
24+
**/*jit* @brandtbucher
2425
Objects/set* @rhettinger
2526
Objects/dict* @methane @markshannon
2627
Objects/typevarobject.c @JelleZijlstra
@@ -36,12 +37,40 @@ Python/flowgraph.c @markshannon @iritkatriel
3637
Python/ast_opt.c @isidentical
3738
Python/bytecodes.c @markshannon @gvanrossum
3839
Python/optimizer*.c @markshannon @gvanrossum
40+
Python/optimizer_analysis.c @Fidget-Spinner
41+
Python/tier2_redundancy_eliminator_bytecodes.c @Fidget-Spinner
3942
Lib/test/test_patma.py @brandtbucher
40-
Lib/test/test_peepholer.py @brandtbucher
4143
Lib/test/test_type_*.py @JelleZijlstra
4244
Lib/test/test_capi/test_misc.py @markshannon @gvanrossum
4345
Tools/c-analyzer/ @ericsnowcurrently
4446

47+
# dbm
48+
**/*dbm* @corona10 @erlend-aasland @serhiy-storchaka
49+
50+
# runtime state/lifecycle
51+
**/*pylifecycle* @ericsnowcurrently
52+
**/*pystate* @ericsnowcurrently
53+
**/*preconfig* @ericsnowcurrently
54+
**/*initconfig* @ericsnowcurrently
55+
**/*pathconfig* @ericsnowcurrently
56+
**/*sysmodule* @ericsnowcurrently
57+
**/*bltinmodule* @ericsnowcurrently
58+
**/*gil* @ericsnowcurrently
59+
Include/internal/pycore_runtime.h @ericsnowcurrently
60+
Include/internal/pycore_interp.h @ericsnowcurrently
61+
Include/internal/pycore_tstate.h @ericsnowcurrently
62+
Include/internal/pycore_*_state.h @ericsnowcurrently
63+
Include/internal/pycore_*_init.h @ericsnowcurrently
64+
Include/internal/pycore_atexit.h @ericsnowcurrently
65+
Include/internal/pycore_freelist.h @ericsnowcurrently
66+
Include/internal/pycore_global_objects.h @ericsnowcurrently
67+
Include/internal/pycore_obmalloc.h @ericsnowcurrently
68+
Include/internal/pycore_pymem.h @ericsnowcurrently
69+
Modules/main.c @ericsnowcurrently
70+
Programs/_bootstrap_python.c @ericsnowcurrently
71+
Programs/python.c @ericsnowcurrently
72+
Tools/build/generate_global_objects.py @ericsnowcurrently
73+
4574
# Exceptions
4675
Lib/traceback.py @iritkatriel
4776
Lib/test/test_except*.py @iritkatriel
@@ -50,13 +79,13 @@ Objects/exceptions.c @iritkatriel
5079
Python/traceback.c @iritkatriel
5180

5281
# Hashing
53-
**/*hashlib* @tiran
54-
**/*pyhash* @tiran
55-
**/*sha* @tiran
56-
**/*md5* @tiran
57-
**/*blake* @tiran
58-
/Modules/_blake2/** @tiran
59-
/Modules/_sha3/** @tiran
82+
**/*hashlib* @gpshead @tiran
83+
**/*pyhash* @gpshead @tiran
84+
**/sha* @gpshead @tiran
85+
Modules/md5* @gpshead @tiran
86+
**/*blake* @gpshead @tiran
87+
Modules/_blake2/** @gpshead @tiran
88+
Modules/_hacl/** @gpshead
6089

6190
# logging
6291
**/*logging* @vsajip
@@ -76,7 +105,20 @@ Python/traceback.c @iritkatriel
76105
# Import (including importlib).
77106
**/*import* @brettcannon @ericsnowcurrently @ncoghlan @warsaw
78107
/Python/import.c @kumaraditya303
79-
**/*importlib/resources/* @jaraco @warsaw @FFY00
108+
Python/dynload_*.c @ericsnowcurrently
109+
**/*freeze* @ericsnowcurrently
110+
**/*frozen* @ericsnowcurrently
111+
**/*modsupport* @ericsnowcurrently
112+
**/*modulefinder* @ericsnowcurrently
113+
**/*moduleobject* @ericsnowcurrently
114+
**/*multiphase* @ericsnowcurrently
115+
**/*pkgutil* @ericsnowcurrently
116+
**/*pythonrun* @ericsnowcurrently
117+
**/*runpy* @ericsnowcurrently
118+
**/*singlephase* @ericsnowcurrently
119+
Lib/test/test_module/ @ericsnowcurrently
120+
Doc/c-api/module.rst @ericsnowcurrently
121+
**/*importlib/resources/* @jaraco @warsaw @FFY00
80122
**/importlib/metadata/* @jaraco @warsaw
81123

82124
# Dates and times
@@ -120,6 +162,9 @@ Lib/ast.py @isidentical
120162
/Lib/unittest/mock.py @cjw296
121163
/Lib/test/test_unittest/testmock/* @cjw296
122164

165+
# multiprocessing
166+
**/*multiprocessing* @gpshead
167+
123168
# SQLite 3
124169
**/*sqlite* @berkerpeksag @erlend-aasland
125170

@@ -187,11 +232,13 @@ Doc/c-api/stable.rst @encukou
187232
**/*zipfile/_path/* @jaraco
188233

189234
# Argument Clinic
190-
/Tools/clinic/** @erlend-aasland @AlexWaygood
191-
/Lib/test/test_clinic.py @erlend-aasland @AlexWaygood
235+
/Tools/clinic/** @erlend-aasland
236+
/Lib/test/test_clinic.py @erlend-aasland
192237
Doc/howto/clinic.rst @erlend-aasland
193238

194239
# Subinterpreters
240+
**/*interpreteridobject.* @ericsnowcurrently
241+
**/*crossinterp* @ericsnowcurrently
195242
Lib/test/support/interpreters/ @ericsnowcurrently
196243
Modules/_xx*interp*module.c @ericsnowcurrently
197244
Lib/test/test_interpreters/ @ericsnowcurrently

.github/workflows/build.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,13 @@ jobs:
131131
- uses: actions/setup-python@v5
132132
with:
133133
python-version: '3.x'
134+
- name: Runner image version
135+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
134136
- name: Restore config.cache
135-
uses: actions/cache@v3
137+
uses: actions/cache@v4
136138
with:
137139
path: config.cache
138-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
140+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
139141
- name: Install Dependencies
140142
run: sudo ./.github/workflows/posix-deps-apt.sh
141143
- name: Add ccache to PATH
@@ -250,19 +252,21 @@ jobs:
250252
strategy:
251253
fail-fast: false
252254
matrix:
253-
openssl_ver: [1.1.1w, 3.0.11, 3.1.3]
255+
openssl_ver: [1.1.1w, 3.0.13, 3.1.5, 3.2.1]
254256
env:
255257
OPENSSL_VER: ${{ matrix.openssl_ver }}
256258
MULTISSL_DIR: ${{ github.workspace }}/multissl
257259
OPENSSL_DIR: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}
258260
LD_LIBRARY_PATH: ${{ github.workspace }}/multissl/openssl/${{ matrix.openssl_ver }}/lib
259261
steps:
260262
- uses: actions/checkout@v4
263+
- name: Runner image version
264+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
261265
- name: Restore config.cache
262-
uses: actions/cache@v3
266+
uses: actions/cache@v4
263267
with:
264268
path: config.cache
265-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
269+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
266270
- name: Register gcc problem matcher
267271
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
268272
- name: Install Dependencies
@@ -274,7 +278,7 @@ jobs:
274278
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
275279
- name: 'Restore OpenSSL build'
276280
id: cache-openssl
277-
uses: actions/cache@v3
281+
uses: actions/cache@v4
278282
with:
279283
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
280284
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -304,7 +308,7 @@ jobs:
304308
needs: check_source
305309
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
306310
env:
307-
OPENSSL_VER: 3.0.11
311+
OPENSSL_VER: 3.0.13
308312
PYTHONSTRICTEXTENSIONBUILD: 1
309313
steps:
310314
- uses: actions/checkout@v4
@@ -319,7 +323,7 @@ jobs:
319323
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
320324
- name: 'Restore OpenSSL build'
321325
id: cache-openssl
322-
uses: actions/cache@v3
326+
uses: actions/cache@v4
323327
with:
324328
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
325329
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -341,11 +345,13 @@ jobs:
341345
run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
342346
- name: Bind mount sources read-only
343347
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
348+
- name: Runner image version
349+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
344350
- name: Restore config.cache
345-
uses: actions/cache@v3
351+
uses: actions/cache@v4
346352
with:
347353
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
348-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
354+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
349355
- name: Configure CPython out-of-tree
350356
working-directory: ${{ env.CPYTHON_BUILDDIR }}
351357
run: |
@@ -375,7 +381,7 @@ jobs:
375381
./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -r ${GITHUB_WORKSPACE}/Tools/requirements-hypothesis.txt
376382
- name: 'Restore Hypothesis database'
377383
id: cache-hypothesis-database
378-
uses: actions/cache@v3
384+
uses: actions/cache@v4
379385
with:
380386
path: ./hypothesis
381387
key: hypothesis-database-${{ github.head_ref || github.run_id }}
@@ -415,16 +421,18 @@ jobs:
415421
needs: check_source
416422
if: needs.check_source.outputs.run_tests == 'true'
417423
env:
418-
OPENSSL_VER: 3.0.11
424+
OPENSSL_VER: 3.0.13
419425
PYTHONSTRICTEXTENSIONBUILD: 1
420426
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
421427
steps:
422428
- uses: actions/checkout@v4
429+
- name: Runner image version
430+
run: echo "IMAGE_VERSION=${ImageVersion}" >> $GITHUB_ENV
423431
- name: Restore config.cache
424-
uses: actions/cache@v3
432+
uses: actions/cache@v4
425433
with:
426434
path: config.cache
427-
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
435+
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ needs.check_source.outputs.config_hash }}
428436
- name: Register gcc problem matcher
429437
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
430438
- name: Install Dependencies
@@ -440,7 +448,7 @@ jobs:
440448
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
441449
- name: 'Restore OpenSSL build'
442450
id: cache-openssl
443-
uses: actions/cache@v3
451+
uses: actions/cache@v4
444452
with:
445453
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
446454
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}

.github/workflows/jit.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: JIT
2+
on:
3+
pull_request:
4+
paths:
5+
- '**jit**'
6+
- 'Python/bytecodes.c'
7+
- 'Python/optimizer*.c'
8+
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
9+
push:
10+
paths:
11+
- '**jit**'
12+
- 'Python/bytecodes.c'
13+
- 'Python/optimizer*.c'
14+
- 'Python/tier2_redundancy_eliminator_bytecodes.c'
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
jit:
23+
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
24+
runs-on: ${{ matrix.runner }}
25+
timeout-minutes: 60
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
target:
30+
- i686-pc-windows-msvc/msvc
31+
- x86_64-pc-windows-msvc/msvc
32+
- x86_64-apple-darwin/clang
33+
- aarch64-apple-darwin/clang
34+
- x86_64-unknown-linux-gnu/gcc
35+
- x86_64-unknown-linux-gnu/clang
36+
- aarch64-unknown-linux-gnu/gcc
37+
- aarch64-unknown-linux-gnu/clang
38+
debug:
39+
- true
40+
- false
41+
llvm:
42+
- 16
43+
include:
44+
- target: i686-pc-windows-msvc/msvc
45+
architecture: Win32
46+
runner: windows-latest
47+
compiler: msvc
48+
- target: x86_64-pc-windows-msvc/msvc
49+
architecture: x64
50+
runner: windows-latest
51+
compiler: msvc
52+
- target: x86_64-apple-darwin/clang
53+
architecture: x86_64
54+
runner: macos-13
55+
compiler: clang
56+
- target: aarch64-apple-darwin/clang
57+
architecture: aarch64
58+
runner: macos-14
59+
compiler: clang
60+
- target: x86_64-unknown-linux-gnu/gcc
61+
architecture: x86_64
62+
runner: ubuntu-latest
63+
compiler: gcc
64+
- target: x86_64-unknown-linux-gnu/clang
65+
architecture: x86_64
66+
runner: ubuntu-latest
67+
compiler: clang
68+
- target: aarch64-unknown-linux-gnu/gcc
69+
architecture: aarch64
70+
runner: ubuntu-latest
71+
compiler: gcc
72+
# These fail because of emulation, not because of the JIT:
73+
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv
74+
- target: aarch64-unknown-linux-gnu/clang
75+
architecture: aarch64
76+
runner: ubuntu-latest
77+
compiler: clang
78+
# These fail because of emulation, not because of the JIT:
79+
exclude: test_unix_events test_init test_process_pool test_shutdown test_multiprocessing_fork test_cmd_line test_faulthandler test_os test_perf_profiler test_posix test_signal test_socket test_subprocess test_threading test_venv
80+
env:
81+
CC: ${{ matrix.compiler }}
82+
steps:
83+
- uses: actions/checkout@v4
84+
- uses: actions/setup-python@v5
85+
with:
86+
python-version: '3.11'
87+
88+
- name: Windows
89+
if: runner.os == 'Windows'
90+
run: |
91+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
92+
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
93+
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
94+
95+
- name: macOS
96+
if: runner.os == 'macOS'
97+
run: |
98+
brew install llvm@${{ matrix.llvm }}
99+
export SDKROOT="$(xcrun --show-sdk-path)"
100+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
101+
make all --jobs 4
102+
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
103+
104+
- name: Native Linux
105+
if: runner.os == 'Linux' && matrix.architecture == 'x86_64'
106+
run: |
107+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
108+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
109+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
110+
make all --jobs 4
111+
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
112+
113+
- name: Emulated Linux
114+
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
115+
run: |
116+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
117+
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
118+
./configure --prefix="$(pwd)/../build"
119+
make install --jobs 4
120+
make clean --jobs 4
121+
export HOST=${{ matrix.architecture }}-linux-gnu
122+
sudo apt install --yes "gcc-$HOST" qemu-user
123+
${{ !matrix.debug && matrix.compiler == 'clang' && './configure --enable-optimizations' || '' }}
124+
${{ !matrix.debug && matrix.compiler == 'clang' && 'make profile-run-stamp --jobs 4' || '' }}
125+
export CC="${{ matrix.compiler == 'clang' && 'clang --target=$HOST' || '$HOST-gcc' }}"
126+
export CPP="$CC --preprocess"
127+
export HOSTRUNNER=qemu-${{ matrix.architecture }}
128+
export QEMU_LD_PREFIX="/usr/$HOST"
129+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
130+
make all --jobs 4
131+
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3

0 commit comments

Comments
 (0)