11New JIT implementation
22======================
33
4- This branch contains a new ** experimental ** JIT implementation based
5- on [ IR - Lightweight JIT Compilation Framework] ( https://github.com/dstogov/ir ) .
4+ This branch provides a new JIT implementation based on [ IR - Lightweight
5+ JIT Compilation Framework] ( https://github.com/dstogov/ir ) .
66
77Despite of the PHP 8.* JIT approach, that generates native code directly from
8- PHP byte-code, this implementation generates intermediate representation (IR) and
9- delegates all lower-level tasks to IR Framework.
8+ PHP byte-code, this implementation generates intermediate representation (IR)
9+ and delegates all lower-level tasks to the IR Framework. IR for JIT is like an
10+ AST for compiler.
1011
11- Both IR and PHP JIT implementation are under development. Only 50% of PHP byte-code
12- instructions are covered. Windows support is missing yet. ZTS and CLANG builds are
13- not tested. Few * .phpt tests fail...
12+ Key benefits of the new JIT implementation:
13+ - Usage of IR opens possibilities for better optimization and register
14+ allocation (the resulting native code is more efficient)
15+ - PHP doesn't have to care about most low-level details (different CPUs,
16+ calling conventions, TLS details, etc)
17+ - it's mach easier to implement support for new targets (e.g. RISCV)
18+ - IR framework is going to be developed separately from PHP and may accept
19+ contibutions from other projects (new optimizations, improvemets, bug fixes)
1420
15- New IR based JIT is disabled by default. It may be enable during PHP build process,
16- running configured with ** --enable-opcache-jit-ir** . Otherwise, PHP is going to be
17- built with old JIT implementation.
21+ Disadvantages:
22+ - JIT compilation becomes slower (this is almost invisible for tracing
23+ JIT, but function JIT compilation of Wordpress becomes 4 times slower)
24+
25+ IR Framework is included into PHP as a GIT submodule. It should be fetched by
26+
27+ `` git submodule update --init --recursive ``
28+
29+ The new JIT implementation sucessfully passes all CI workflows, but it's still
30+ not mature and may cause failures. To reduce risks, this patch doesn't remove
31+ the old JIT implementation (that is the same as PHP-8.3 JIT). It's possible
32+ to build PHP with the old JIT by configuring with ** --disable-opcache-jit-ir** .
33+ In the future the old implementation should be removed.
1834
1935Building and Testing
2036====================
@@ -34,7 +50,7 @@ cd php-ir
3450git submodule update --init --recursive
3551./buildconf --force
3652mkdir install
37- ./configure --enable-opcache-jit-ir -- with-capstone --prefix=`pwd`/install --with-config-file-path=`pwd`/install/etc
53+ ./configure --with-capstone --prefix=`pwd`/install --with-config-file-path=`pwd`/install/etc
3854make
3955make install
4056mkdir install/etc
0 commit comments