[php-src] PR #18573: Adjust opcache.jit_hot_loop to a prime number
| From: | arnaud-lb | Date: | Fri, 16 May 2025 16:37:00 +0000 |
| Subject: | [php-src] PR #18573: Adjust opcache.jit_hot_loop to a prime number | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-31691@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18573
Author: arnaud-lb
Loops whose number of iterations + 1 is a multiple of
opcache.jit_hot_loop will always
be traced at the exact moment the loop condition becomes false. As a result, these loops can never
be JIT'ed successfully.
Example:
```
function f() {
for ($i = 0; $i < 3; $i++) {
var_dump($i);
}
}
while (1) { f(); }
```
```
---- TRACE 1 start (loop) f() test.php:4
0006 T1 = IS_SMALLER CV0($i) int(3) ; op1(int)
0007 ;JMPNZ T1 0002
0008 RETURN null
---- TRACE 1 abort (exit from loop)
---- TRACE 1 start (loop) f() test.php:4
0006 T1 = IS_SMALLER CV0($i) int(3) ; op1(int)
0007 ;JMPNZ T1 0002
0008 RETURN null
---- TRACE 1 abort (exit from loop)
---- TRACE 1 start (loop) f() test.php:4
0006 T1 = IS_SMALLER CV0($i) int(3) ; op1(int)
0007 ;JMPNZ T1 0002
0008 RETURN null
---- TRACE 1 abort (exit from loop)
...
```
Here I adjust the default value of opcache.jit_hot_loop to a prime number, so this can
not happen.