rfc:jit-ir
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:jit-ir [2023/09/20 12:07] – edit for speling and grammar derick | rfc:jit-ir [2023/10/24 09:43] (current) – Updated "Implemenetation" section dmitry | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: A new JIT implementation based on IR Framework ====== | ====== PHP RFC: A new JIT implementation based on IR Framework ====== | ||
- | * Version: | + | * Version: |
* Date: 2023-09-20 | * Date: 2023-09-20 | ||
* Author: Dmitry Stogov, dmitry@php.net | * Author: Dmitry Stogov, dmitry@php.net | ||
- | * Status: | + | * Status: Accepted |
* First Published at: http:// | * First Published at: http:// | ||
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 implemention | + | JIT is a quite complex subsystem. Its first implementation |
- | The main goal of a separate IR Framework development is the collaboration with other compiler experts (sharing expertise, contribution, | + | The main goal of a separate IR Framework development is the collaboration with other compiler experts (sharing expertise, contribution, |
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, and I am working on a presentation with explanations to publish soon. I have already shared this with a few core PHP developers. | + | The details of the IR framework are complex. |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 57: | Line 57: | ||
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). | ||
- | This is quite a good result for an Optimizing JIT compiler. In my tests PHP, the new JIT may produce ~15MB of native code per second. | + | This is quite a good result for an Optimizing JIT compiler. In my tests, |
==== Zend VM ==== | ==== Zend VM ==== | ||
Line 113: | Line 113: | ||
It is also possible to support new JIT targets (e.g. RISCV), almost independently of PHP. | It is also possible to support new JIT targets (e.g. RISCV), almost independently of PHP. | ||
+ | |||
+ | Finally, we may try to completely avoid the manual IR construction in JIT. We may introduce a single formal specification for VM instructions in a C-like language, convert it to IR and then use partial evaluation to generate VM and JIT handlers (similar to Truffle). | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
- | Merge the new JIT implementation into PHP master? | + | Voting opened 2023-10-06 and closes 2023-10-19. |
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | |||
+ | 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. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Line 125: | Line 143: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | After the project is implemented, | + | - merged into master via 25cb2a40d640b64f8881a894f2247d46a781ef75 |
- | + | | |
- | | + | |
- | - a link to the git commit(s) | + | |
- | - a link to the PHP manual entry for the feature | + | |
- | - a link to the language specification section (if any) | + | |
===== References ===== | ===== References ===== |
rfc/jit-ir.1695211656.txt.gz · Last modified: 2023/09/20 12:07 by derick