[php-src] PR #25381: JIT: Minor optimizations to static property access

From: Date: Tue, 10 Nov 2026 23:03:55 +0000
Subject: [php-src] PR #25381: JIT: Minor optimizations to static property access
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40523@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25381 Author: ndossche This PHP code: ```php <?php final class Foo { public static $prop = 1; function foo() { $test = 0; for ($i = 0; $i < 100; $i++) $test += static::$prop; return $test; } } (new Foo)->foo(); ``` previously generated these loop checks: ```asm .L3: cmpq $0x64, %rbx jge jit$$trace_exit_1 movq 0x20(%r14), %rax ; dependency for scope check movq 0x40(%r14), %rcx ; load runtime cache ptr movq 8(%rcx), %rcx ; scope check cmpq 0x10(%rax), %rcx ; scope check jne .L5 ; scope check movq 0x40(%r14), %rax ; load runtime cache ptr movq 0x10(%rax), %rax testq %rax, %rax je .L5 cmpb $0, 8(%rax) je .L6 ``` Notice how the commented lines are unnecessary: the runtime cache ptr is loaded twice, and the dependency isn't necessary for this final CE case. Now it generates this: ```asm .L3: cmpq $0x64, %rbx jge jit$$trace_exit_1 movq 0x40(%r14), %rcx movq 0x10(%rcx), %rax testq %rax, %rax je .L5 cmpb $0, 8(%rax) je .L6 ``` This is almost optimal, the last check isn't necessary but that's out of scope here.

« previous php.git-pulls (#40523) next »