Skip to content

Defer SAVE_OPLINE() on the INSTANCEOF fast path - #23304

Closed
staabm wants to merge 1 commit into
php:masterfrom
staabm:defer-opline-instanceof
Closed

Defer SAVE_OPLINE() on the INSTANCEOF fast path#23304
staabm wants to merge 1 commit into
php:masterfrom
staabm:defer-opline-instanceof

Conversation

@staabm

@staabm staabm commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

disclaimer: this change was generated by claude opus. I have little experience with php-src development


The object paths (inline cache and instanceof walk) run no user code and cannot throw; only releasing a TMP operand (destructor), fetching a late-bound class (op2 UNUSED) and the undefined-variable warning need the opline saved, and now save it explicitly.


after PR

➜  php-src git:(defer-opline-instanceof) ✗ sapi/cli/php -n -d opcache.enable_cli=0 instanceof_fast_path_repro.php    
PHP 8.6.0-dev
iterations=30000000 rounds=7

case              best(s)     avg(s)      sink
----------------------------------------------------
baseline          0.107433    0.108387    0
class-hit         0.140877    0.141352    0
interface-hit     0.148452    0.148903    0

instanceof / baseline ratios (best time, lower is better):
class-hit          1.3113x
interface-hit      1.3818x

before PR

➜  php-src git:(defer-opline-instanceof) ✗ sapi/cli/php_old -n -d opcache.enable_cli=0 instanceof_fast_path_repro.php
PHP 8.6.0-dev
iterations=30000000 rounds=7

case              best(s)     avg(s)      sink
----------------------------------------------------
baseline          0.107452    0.107877    0
class-hit         0.141088    0.141534    0
interface-hit     0.148680    0.149026    0

instanceof / baseline ratios (best time, lower is better):
class-hit          1.3130x
interface-hit      1.3837x

using instanceof_fast_path_repro.php

The object paths (inline cache and instanceof walk) run no user code
and cannot throw; only releasing a TMP operand (destructor), fetching a
late-bound class (op2 UNUSED) and the undefined-variable warning need
the opline saved, and now save it explicitly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants