JIT trace not invalidated after re-linking
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
JIT traces are not invalidated after a class is re-linked. The JIT code may make assumptions that are not true anymore after re-linking.
For example, in
<?php
$a=0;
class A implement Iface {
public function hello() {
global $a;
for ($i = 0; $i < 100; $i++) {
$a++;
}
}
}
we may still enter in the JITed loop after A has been re-linked (A can be re-link due to Iface being recompiled for example). The JITed code may be based on assumptions that are not true anymore (at least the run_time_cache pointer changes during linking, but I suspect that other assumptions can be made based on the parent classes or interfaces, that do not hold true after re-linking).
This is due to op_array.oplines being shared between all linked versions of the same class. oplines has pointers to JITed code.
op_array.oplines is also shared between all sub-classes, but as long as the JIT's asumptions are based on the declaring class it should be ok.
PHP Version
PHP 8.1
Operating System
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start with the PHP 8.1 example and investigate JIT traces across class re-linking; done means stale JIT code is invalidated so execution cannot retain assumptions from the prior linked class, with regression coverage for the scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100