Admit implicit arguments object reads#3033
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands production unified-bytecode routing to admit read-only uses of the implicit arguments object (e.g., arguments[0]) by compiling those loads as environment-backed dynamic identifier reads, and by extending the first-boundary computed read candidate logic accordingly.
Changes:
- Update unified-bytecode production eligibility to allow implicit
argumentsidentifier reads when ordinary dynamic identifier environment operations are permitted. - Extend the computed property read “first boundary” compilation/eligibility path to treat implicit
argumentsreads as valid bases (compiled viaLoadDynamicIdentifier). - Update tests and the expansion contract documentation to reflect that implicit
argumentsreads now take the unified-bytecode production fast path.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionInvocationTests.cs | Updates invocation test to assert implicit arguments[0] uses the production fast path. |
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionEligibilityTests.cs | Updates eligibility test to accept implicit arguments read and assert dynamic identifier load is present. |
| src/Asynkron.JsEngine/Execution/UnifiedBytecode/UnifiedBytecodeProductionEligibility.cs | Broadens eligibility scanning/candidate detection to permit implicit arguments reads under allowed dynamic identifier operations. |
| src/Asynkron.JsEngine/Execution/UnifiedBytecode/UnifiedBytecodeCompiler.cs | Allows compiling implicit arguments loads (as dynamic identifier loads) and wires this into first-boundary computed reads. |
| src/Asynkron.JsEngine/Ast/TypedAstEvaluator.SyncFunctionInvoker.cs | Reworks activation gating to enable the new implicit arguments read path. |
| docs/unified-bytecode-expansion-contract.md | Updates the eligibility/contract ledger to reflect the new admitted arguments read behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3940
to
3948
| private bool CanUseProductionUnifiedBytecodeImplicitArgumentsObjectReadPath(ExecutionPlan plan) | ||
| { | ||
| return _usesArguments && | ||
| _argumentsObjectNeeded && | ||
| !_hasDirectEvalInBodyOrParameters && | ||
| !_hasClosureWithObject && | ||
| !_hasCapturedActivationInClosure && | ||
| UnifiedBytecodeProductionEligibility.ContainsOnlyTypeOfImplicitArgumentsObjectDependency(plan); | ||
| UnifiedBytecodeProductionEligibility.ContainsOnlyImplicitArgumentsObjectReadDependency(plan); | ||
| } |
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
UnifiedBytecodeProductionEligibilityTests.Evaluate_ArgumentsAccess_AcceptsImplicitArgumentsObjectRead|FullyQualifiedNameUnifiedBytecodeProductionEligibilityTests.Evaluate_TypeOfImplicitArgumentsObject_AcceptsLiteralObjectType|FullyQualifiedNameUnifiedBytecodeProductionEligibilityTests.Evaluate_UpdateImplicitArgumentsObject_DeclinesWithDynamicLookupDependency|FullyQualifiedNameUnifiedBytecodeProductionEligibilityTests.Evaluate_CallImplicitArgumentsObject_DeclinesWithArgumentsDependency|FullyQualifiedNameUnifiedBytecodeProductionInvocationTests.ImplicitArgumentsObjectRead_UsesUnifiedBytecodeProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionInvocationTests.TypeOfImplicitArgumentsObject_UsesUnifiedBytecodeProductionFastPath|FullyQualifiedName~UnifiedBytecodeProductionInvocationTests.UpdateImplicitArgumentsObject_DeclinesAndFallsBack'UnifiedBytecodeProductionEligibilityTests|FullyQualifiedNameUnifiedBytecodeProductionInvocationTests|FullyQualifiedNameUnifiedBytecodeProductionSpreadCallTests|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests|FullyQualifiedNameExpressionProgramLoweringTests|FullyQualifiedNameExpressionProgramCoverageMapTests|FullyQualifiedName~AstFreeExecutionAssertionTests'