Skip to content

Commit 27b849e

Browse files
committed
[skip ci] Add a README for Opcache's JIT.
Mention information that would be useful for working on new features or bug fixes for the JIT. Closes GH-5585
1 parent 25aa125 commit 27b849e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

ext/opcache/jit/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Opcache JIT
2+
===========
3+
4+
This is the implementation of Opcache's JIT (Just-In-Time compiler),
5+
This converts the PHP Virtual Machine's opcodes into x64/x86 assembly,
6+
on POSIX platforms and Windows.
7+
8+
It generates native code directly from PHP byte-code and information collected
9+
by SSA static analysis framework (a part of the opcache optimizer).
10+
Code is usually generated separately for each PHP byte-code instruction. Only
11+
a few combinations are considered together (e.g. compare + conditional jump).
12+
13+
See [the JIT RFC](https://wiki.php.net/rfc/jit) for more details.
14+
15+
DynAsm
16+
------
17+
18+
This uses [DynAsm](https://luajit.org/dynasm.html) (developed for LuaJIT project)
19+
for the generation of native code. It's a very lightweight and advanced tool,
20+
but does assume good, and very low-level development knowledge of target
21+
assembler languages. In the past we tried LLVM, but its code generation speed
22+
was almost 100 times slower, making it prohibitively expensive to use.
23+
24+
[The unofficial DynASM Documentation](https://corsix.github.io/dynasm-doc/tutorial.html)
25+
has a tutorial, reference, and instruction listing.
26+
27+
`zend_jit_x86.dasc` gets automatically converted to `zend_jit_x86.c` by the bundled
28+
`dynasm` during `make`.

0 commit comments

Comments
 (0)