[php-src] PR #22347: Elide the type check on typed property writes when the value type is statically proven
| From: | azjezz | Date: | Tue, 16 Jun 2026 22:39:35 +0000 |
| Subject: | [php-src] PR #22347: Elide the type check on typed property writes when the value type is statically proven | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36475@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22347
Author: azjezz
Assigning to a typed property runs
zend_assign_to_typed_prop() on every write, a
zend_never_inline call that verifies (and may coerce) the value against the property
type. When the optimizer can already prove the value satisfies the property type with no coercion,
that check is pure overhead.
This is extremely common: constructor property promotion, plain $this->x = $x from
typed parameters, and fluent setters all hit it on every call. Neither the DFA optimizer nor the JIT
elided it before.