Admit captured closure reads to production bytecode - #3039
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the production unified-bytecode fast path to include read-only captured-closure reads for ordinary (non-arrow) function expressions, while keeping captured writes excluded. It also updates the activation-proof test expectations and the unified-bytecode expansion contract documentation to reflect the new routing rules.
Changes:
- Add a new production-fast-path admission route for ordinary functions with captured-closure activation reads.
- Add/adjust tests to validate captured-closure read admission and captured-closure write exclusion.
- Update the unified-bytecode expansion contract documentation to describe the newly admitted captured-closure read-only subset.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionInvocationTests.cs | Adds invocation-level tests ensuring captured-closure reads use the production unified-bytecode fast path and captured writes do not. |
| tests/Asynkron.JsEngine.Tests/ActivationSemanticsProofPackTests.cs | Updates the activation-semantics proof to expect production unified-bytecode fast-path usage for closure capture reads. |
| src/Asynkron.JsEngine/Ast/TypedAstEvaluator.SyncFunctionInvoker.cs | Introduces a new eligibility gate (CanUseProductionUnifiedBytecodeCapturedClosureActivation) and threads it through the activation descriptor/fast-path decision logic. |
| docs/unified-bytecode-expansion-contract.md | Documents the newly admitted captured-closure read-only routing subset and clarifies the captured-activation decline description. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
685
to
+687
| Assert.Equal(42d, result); | ||
| Assert.Contains(CurrentLogger!.Collector.Snapshot(), | ||
| static record => record.Message.Contains(SimpleIrActivationFastPathLog, StringComparison.Ordinal)); | ||
| static record => record.Message.Contains(UnifiedBytecodeProductionFastPathLog, StringComparison.Ordinal)); |
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.
Summary
Verification
UnifiedBytecodeProductionInvocationTests.FunctionExpression_CapturedOuterEnvironmentRead_UsesUnifiedBytecodeProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionInvocationTests.FunctionExpression_CapturedOuterEnvironmentWrite_DoesNotUseUnifiedBytecodeProductionFastPath|FullyQualifiedName~UnifiedBytecodeProductionInvocationTests.ArrowFunction_CapturedOuterEnvironmentRead_UsesUnifiedBytecodeProductionFastPath'