rfc:jit-ir
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
rfc:jit-ir [2023/10/24 09:43] – Updated "Implemenetation" section dmitry | rfc:jit-ir [2025/01/17 11:22] (current) – Link to correct merge commits, and fix typos/grammar theodorejb | ||
---|---|---|---|
Line 7: | Line 7: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | The first version of JIT for PHP was released in PHP-8.0 (https:// | + | The first version of JIT for PHP was released in PHP-8.0 (https:// |
- | A smarter JIT compiler with some Intermediate Representation was planned a long time. The real work was started in January 2022. | + | A smarter JIT compiler with some Intermediate Representation was planned |
This proposal is the result of these 1.75 years of work. | This proposal is the result of these 1.75 years of work. | ||
Line 29: | Line 29: | ||
At the current state the PR doesn' | At the current state the PR doesn' | ||
- | JIT is a quite complex subsystem. Its first implementation will likely have bugs, but I am confident that these can be addressed. We have more time to fix potential issues, the sooner this proposal passes, and the patch is merged. | + | JIT is a quite complex subsystem. Its first implementation will likely have bugs, but I am confident that these can be addressed. We have more time to fix potential issues the sooner this proposal passes, and the patch is merged. |
- | The main goal of a separate IR Framework development is the collaboration with other compiler experts (sharing expertise, | + | The main goal of a separate IR Framework development is the collaboration with other compiler experts (sharing expertise, |
The necessary part of the IR Framework is embedded into the PHP source tree, and won't introduce any new external dependencies. | The necessary part of the IR Framework is embedded into the PHP source tree, and won't introduce any new external dependencies. | ||
- | The details of the IR framework are complex. This [[https:// | + | The details of the IR framework are complex. This [[https:// |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 53: | Line 53: | ||
Because the IR Framework provides more optimizations and has a smarter Register Allocator, the JIT produces a bit faster (5-10%) and smaller code. | Because the IR Framework provides more optimizations and has a smarter Register Allocator, the JIT produces a bit faster (5-10%) and smaller code. | ||
- | This is visible with **bench.php** and **micro_bench.php**. The speed of the real-life applications is not affected. | + | This is visible with **bench.php** and **micro_bench.php**. The speed of real-life applications is not affected. |
The compilation speed of the Tracing JIT is almost the same. The compilation speed of the Function JIT is up to 4 times slower (tested on Wordpress). | The compilation speed of the Tracing JIT is almost the same. The compilation speed of the Function JIT is up to 4 times slower (tested on Wordpress). | ||
Line 72: | Line 72: | ||
==== php.ini Defaults ==== | ==== php.ini Defaults ==== | ||
- | The PR does not introduce new php.ini | + | The PR does not introduce new php.ini |
It adds few new IR related JIT debugging capabilities that may be enabled through **opcache.jit_debug** directive bits: | It adds few new IR related JIT debugging capabilities that may be enabled through **opcache.jit_debug** directive bits: | ||
Line 107: | Line 107: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | The usage of IR opens the door for more powerful optimizations. Some of these are going to be PHP independent (e.g.): the planned | + | The usage of IR opens the door for more powerful optimizations. Some of these are going to be PHP independent (e.g. the planned introduction of new loop optimization passes, |
- | introduction of new loop optimization passes, | + | |
The other part is PHP specific (for example, we can extend CPU register usage for more instructions). | The other part is PHP specific (for example, we can extend CPU register usage for more instructions). | ||
Line 128: | Line 127: | ||
Secondary vote: Should we keep the old JIT implementation for a while or remove it right after merge? | Secondary vote: Should we keep the old JIT implementation for a while or remove it right after merge? | ||
- | Note, that old implementation is not going to be tested (by CI) and we can't guarantee its work anyway. | + | Note, that old implementation is not going to be tested (by CI) and we can't guarantee its functionality |
<doodle title=" | <doodle title=" | ||
Line 143: | Line 142: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | - merged into master via 25cb2a40d640b64f8881a894f2247d46a781ef75 | + | - merged into master via https:// |
- | - old JIT implementation is removed via be275433d936e41d95b2fd656464bcc4d7138b76 | + | - old JIT implementation is removed via https:// |
===== References ===== | ===== References ===== |
rfc/jit-ir.txt · Last modified: 2025/01/17 11:22 by theodorejb