Keep boolean condition snapshots in native storage - #106
Open
yavon007 wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Conditions with operand cleanup must save their result before releasing the
operands. Both branch conditions and short-circuit right operands currently
box that saved result in
php::Var, even when its type is known to be boolean.Use
php::Boolonly for inferred boolean snapshots, normalizing the emittedvalue through
php::toBoolbefore the existing cleanup. Keep other resulttypes boxed. Evaluation order, short-circuit behavior, and operand cleanup
remain intact. Add code-generation coverage for the optimized boolean cases
and a mixed-return call that must retain the Variant fallback.
Static initializer lambdas start their temporary counter after captured outer
locals, preventing initializer array temporaries from accidentally reusing an
outer boolean snapshot. A PHPT covers nested static arrays after a condition.
The complete 135-file compiler self-build, its --version invocation, and
compiling/running the regression with the resulting compiler all pass locally.
Validation: focused codegen/evaluation-order tests pass; separately compiled
existing short-circuit, condition-side-effect, and weak-reference lifetime
cases match expected stdout with empty stderr. The 51-assertion dungeon suite
matches PHP. Independent review found no remaining issue.
On Linux ARM64, GCC O2, PHP 8.5.10 ZTS and PHPX 4b3a472, two final-source
alternating baseline/candidate measurement batches reduce normal-only elapsed
time by 5.18% and 4.73% (100,000 games/sample), and exception-heavy elapsed
time by 6.26% and 3.75% (20,000 games/sample). Each batch uses one warmup pair
and five measured pairs; output is checked every time. The game sources are
unchanged. The command function replaces six Variant temporaries with Bool.
This PR is based directly on master and does not include or require #105.
The reported performance experiment included #105 (
10629f60) in both binaries;neither binary included #104. These percentages have not been remeasured
without #105.
Results are workload/platform-specific. Other platforms and Python
interoperability have not been runtime-tested for this change.