You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Tools/jit/README.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,15 @@ The JIT Compiler
3
3
4
4
This version of CPython can be built with an experimental just-in-time compiler. While most everything you already know about building and using CPython is unchanged, you will probably need to install a compatible version of LLVM first.
5
5
6
-
###Installing LLVM
6
+
## Installing LLVM
7
7
8
-
The JIT compiler does not require end users to install any third-party dependencies, but part of it must be *built* using 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).
8
+
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).
9
9
10
10
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.
11
11
12
12
It's easy to install all of the required tools:
13
13
14
-
####Linux
14
+
### Linux
15
15
16
16
Install LLVM 16 on Ubuntu/Debian:
17
17
@@ -21,7 +21,7 @@ chmod +x llvm.sh
21
21
sudo ./llvm.sh 16
22
22
```
23
23
24
-
####macOS
24
+
### macOS
25
25
26
26
Install LLVM 16 with [Homebrew](https://brew.sh):
27
27
@@ -31,16 +31,18 @@ $ brew install llvm@16
31
31
32
32
Homebrew won't add any of the tools to your `$PATH`. That's okay; the build script knows how to find them.
33
33
34
-
####Windows
34
+
### Windows
35
35
36
36
LLVM 16 can be installed on Windows by using the installers published on [LLVM's GitHub releases page](https://github.com/llvm/llvm-project/releases/tag/llvmorg-16.0.6).
37
37
38
38
[Here's a recent one.](https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/LLVM-16.0.6-win64.exe)**When installing, be sure to select the option labeled "Add LLVM to the system PATH".**
39
39
40
-
###Building
40
+
## Building
41
41
42
42
For `PCbuild`-based builds, pass the new `--experimental-jit` option to `build.bat`.
43
43
44
44
For all other builds, pass the new `--enable-experimental-jit` option to `configure`.
45
45
46
46
Otherwise, just configure and build as you normally would. Cross-compiling "just works", since the JIT is built for the host platform.
47
+
48
+
[^why-llvm]: Clang is specifically needed because it's the only C compiler with support for guaranteed tail calls (`musttail`), which are required by CPython's continuation-passing-style approach to JIT compilation. Since LLVM also includes other functionalities we need (namely, object file parsing and disassembly), it's convenient to only support one toolchain at this time.
0 commit comments