@@ -4,7 +4,7 @@ New JIT implementation
44This branch provides a new JIT implementation based on [ IR - Lightweight
55JIT Compilation Framework] ( https://github.com/dstogov/ir ) .
66
7- Despite of the PHP 8.* JIT approach, that generates native code directly from
7+ As opposed to the PHP 8.* JIT approach that generates native code directly from
88PHP byte-code, this implementation generates intermediate representation (IR)
99and delegates all lower-level tasks to the IR Framework. IR for JIT is like an
1010AST for compiler.
@@ -22,58 +22,11 @@ Disadvantages:
2222- JIT compilation becomes slower (this is almost invisible for tracing
2323 JIT, but function JIT compilation of Wordpress becomes 4 times slower)
2424
25- IR Framework is included into PHP as a GIT submodule. It should be fetched by
26-
27- `` git submodule update --init --recursive ``
25+ The necessary part of the IR Framework is embedded into php-src. So, the PR
26+ doesn't introduce new dependencies.
2827
2928The new JIT implementation successfully passes all CI workflows, but it's still
3029not mature and may cause failures. To reduce risks, this patch doesn't remove
3130the old JIT implementation (that is the same as PHP-8.3 JIT). It's possible
3231to build PHP with the old JIT by configuring with ** --disable-opcache-jit-ir** .
3332In the future the old implementation should be removed.
34-
35- Building and Testing
36- ====================
37-
38- Install pre-requested libraries. PHP and their extensions may require different libraries.
39- JIT itself needs just ** libcapstone** to produce disassembler output.
40-
41- ```
42- sudo dbf install capstone-devel
43- ```
44-
45- Build PHP
46-
47- ```
48- git clone -b php-ir --single-branch git@github.com:dstogov/php-src.git php-ir
49- cd php-ir
50- git submodule update --init --recursive
51- ./buildconf --force
52- mkdir install
53- ./configure --with-capstone --prefix=`pwd`/install --with-config-file-path=`pwd`/install/etc
54- make
55- make install
56- mkdir install/etc
57- cat > install/etc/php.ini <<EOL
58- zend_extension=opcache.so
59- opcache.enable=1
60- opcache.enable_cli=1
61- opcache.optimization_level=-1
62- opcache.jit_buffer_size=32M
63- opcache.jit=tracing
64- opcache.huge_code_pages=1
65- EOL
66- ```
67-
68- Check if opcache s loaded
69-
70- ```
71- sapi/cli/php -v | grep -i opcache
72- ```
73-
74- See JIT in action
75-
76- ```
77- sapi/cli/php -d opcache.jit=tracing -d opcache.jit_debug=1 Zend/bench.php
78- sapi/cli/php -d opcache.jit=function -d opcache.jit_debug=1 Zend/bench.php
79- ```
0 commit comments