[php-src] PR #24239: JIT: implement empty($cv) fast path in function & tracing JIT
| From: | ndossche | Date: | Sat, 10 Oct 2026 12:40:54 +0000 |
| Subject: | [php-src] PR #24239: JIT: implement empty($cv) fast path in function & tracing JIT | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39314@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24239
Author: ndossche
We can simply defer to zend_jit_bool_jmpznz() which already generates optimized paths for many
types.
Example PHP:
```php
function f(int $i) {
if (empty($i)) return 1;
return 2;
}
```
Before (function JIT):
```asm
.L1:
movl $0x414d88a0, %r15d ; opline = ISSET_ISEMPTY_CV
movabsq $0x55a80140fe00, %rax
callq *%rax ; Call VM handler
cmpl $0x414d88e0, %r15d ; check if the handler branched
jne .L2
movq 0x10(%r14), %rax ; return 1
...
.L2: ; return 2
...
```
After (function JIT):
```asm
.L1:
cmpq $0, 0x50(%r14) ; empty($i) check
je .L3
movq 0x10(%r14), %rax ; return 2
...
.L3: ; return 1
...
```