[php-src] PR #24086: JIT: Avoid object type check if the object is known to be a type
| From: | ndossche | Date: | Fri, 02 Oct 2026 22:14:30 +0000 |
| Subject: | [php-src] PR #24086: JIT: Avoid object type check if the object is known to be a type | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39095@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24086
Author: ndossche
Follow-up for https://github.com/php/php-src/pull/24052
Before:
```asm
mov %r15,%r14
lea 0x50(%r14),%rdi ; &CV0($o)
cmpb $0x8,0x58(%r14) ; Check IS_OBJECT
jne not_an_object ; ...
mov (%rdi),%rax ; Z_OBJ_P($o)
lea -0x77280f9(%rip),%rcx ; ce to compare against
cmp 0x10(%rax),%rcx ; Z_OBJ_P($o)->ce == ce
je wrong_ce
...
```
After:
```asm
mov %r15,%r14
lea 0x50(%r14),%rdi ; &CV0($o)
mov (%rdi),%rax ; Z_OBJ_P($o) (known to be an object)
lea -0x77280f9(%rip),%rcx ; ce to compare against
cmp 0x10(%rax),%rcx ; Z_OBJ_P($o)->ce == ce
je wrong_ce
...
```
This also helps with an
?Foo type check: it can skip the IS_OBJECT and IS_NULL check.
This also simplifies zend_jit_verify_arg_type: the (type == IS_UNKNOWN || type ==
IS_OBJECT) check becomes always-true.