mirror of
https://github.com/python/cpython
synced 2026-09-29 09:40:29 +03:00
gh-118335: Configure Tier 2 interpreter at build time (#118339)
The code for Tier 2 is now only compiled when configured with `--enable-experimental-jit[=yes|interpreter]`. We drop support for `PYTHON_UOPS` and -`Xuops`, but you can disable the interpreter or JIT at runtime by setting `PYTHON_JIT=0`. You can also build it without enabling it by default using `--enable-experimental-jit=yes-off`; enable with `PYTHON_JIT=1`. On Windows, the `build.bat` script supports `--experimental-jit`, `--experimental-jit-off`, `--experimental-interpreter`. In the C code, `_Py_JIT` is defined as before when the JIT is enabled; the new variable `_Py_TIER2` is defined when the JIT *or* the interpreter is enabled. It is actually a bitmask: 1: JIT; 2: default-off; 4: interpreter.
This commit is contained in:
parent
9c468e2c5d
commit
7d83f7bcc4
32 changed files with 181 additions and 42 deletions
|
|
@ -411,6 +411,7 @@ NON_ESCAPING_FUNCTIONS = (
|
|||
"PyCell_New",
|
||||
"PyFloat_AS_DOUBLE",
|
||||
"_PyFrame_PushUnchecked",
|
||||
"Py_FatalError",
|
||||
)
|
||||
|
||||
ESCAPING_FUNCTIONS = (
|
||||
|
|
|
|||
|
|
@ -7,18 +7,18 @@ This version of CPython can be built with an experimental just-in-time compiler.
|
|||
|
||||
The JIT compiler does not require end users to install any third-party dependencies, but part of it must be *built* using LLVM[^why-llvm]. You are *not* required to build the rest of CPython using LLVM, or even the same version of LLVM (in fact, this is uncommon).
|
||||
|
||||
LLVM version 16 is required. Both `clang` and `llvm-readobj` need to be installed and discoverable (version suffixes, like `clang-16`, are okay). It's highly recommended that you also have `llvm-objdump` available, since this allows the build script to dump human-readable assembly for the generated code.
|
||||
LLVM version 18 is required. Both `clang` and `llvm-readobj` need to be installed and discoverable (version suffixes, like `clang-18`, are okay). It's highly recommended that you also have `llvm-objdump` available, since this allows the build script to dump human-readable assembly for the generated code.
|
||||
|
||||
It's easy to install all of the required tools:
|
||||
|
||||
### Linux
|
||||
|
||||
Install LLVM 16 on Ubuntu/Debian:
|
||||
Install LLVM 18 on Ubuntu/Debian:
|
||||
|
||||
```sh
|
||||
wget https://apt.llvm.org/llvm.sh
|
||||
chmod +x llvm.sh
|
||||
sudo ./llvm.sh 16
|
||||
sudo ./llvm.sh 18
|
||||
```
|
||||
|
||||
### macOS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue