summaryrefslogtreecommitdiff
path: root/ext/opcache/jit/README.md
blob: 2cc08d2827a235a7d0ae0d79d21d3f114981b30b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Opcache JIT
===========

This is the implementation of Opcache's JIT (Just-In-Time compiler),
This converts the PHP Virtual Machine's opcodes into x64/x86 assembly,
on POSIX platforms and Windows.

It generates native code directly from PHP byte-code and information collected
by the SSA static analysis framework (a part of the opcache optimizer).
Code is usually generated separately for each PHP byte-code instruction. Only
a few combinations are considered together (e.g. compare + conditional jump).

See [the JIT RFC](https://wiki.php.net/rfc/jit) for more details.

DynAsm
------

This uses [DynAsm](https://luajit.org/dynasm.html) (developed for LuaJIT project)
for the generation of native code.  It's a very lightweight and advanced tool,
but does assume good, and very low-level development knowledge of target
assembler languages. In the past we tried LLVM, but its code generation speed
was almost 100 times slower, making it prohibitively expensive to use.

[The unofficial DynASM Documentation](https://corsix.github.io/dynasm-doc/tutorial.html)
has a tutorial, reference, and instruction listing.

`zend_jit_x86.dasc` gets automatically converted to `zend_jit_x86.c` by the bundled
`dynasm` during `make`.