[php-src] PR #18353: Provide script to TSSA build in tracing JIT
| From: | nielsdos | Date: | Sat, 19 Apr 2025 12:40:58 +0000 |
| Subject: | [php-src] PR #18353: Provide script to TSSA build in tracing JIT | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-31433@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18353
Author: nielsdos
For the following script:
```php
final class Foo {
public $prop = 0;
}
function test(Foo $obj) {
$obj->prop=1;
}
$foo = new Foo;
for ($i=0;$i<3;$i++) {
test($foo);
}
```
When comparing the TSSA (via opcache.jit_debug) vs the opcache SSA (via
opcache.opt_debug_level=0x400000) we note that in TSSA, the RECV op for
test does not
infer the type of the argument to be class Foo. This is because the optimizer uses the
script pointer to figure out known classes but TSSA always sets script to
NULL. This in turn generates suboptimal assembly because zend_may_throw returns 1 due
to the unknown CE in the TSSA, resulting in an extra exception check in the assembly code.