Skip to content

Admit captured closure reads to production bytecode - #3039

Merged
rogeralsing merged 1 commit into
mainfrom
codex/unified-bytecode-loop-79-captured-closure
Jun 2, 2026
Merged

Admit captured closure reads to production bytecode#3039
rogeralsing merged 1 commit into
mainfrom
codex/unified-bytecode-loop-79-captured-closure

Conversation

@rogeralsing

Copy link
Copy Markdown
Contributor

Summary

  • admit read-only ordinary captured closure reads to production unified bytecode
  • keep captured writes off the production route with a nearby no-route proof
  • update activation proof and unified bytecode expansion contract

Verification

  • rtk dotnet test tests/Asynkron.JsEngine.Tests -c Release --filter 'FullyQualifiedNameUnifiedBytecodeProductionInvocationTests.FunctionExpression_CapturedOuterEnvironmentRead_UsesUnifiedBytecodeProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionInvocationTests.FunctionExpression_CapturedOuterEnvironmentWrite_DoesNotUseUnifiedBytecodeProductionFastPath|FullyQualifiedName~UnifiedBytecodeProductionInvocationTests.ArrowFunction_CapturedOuterEnvironmentRead_UsesUnifiedBytecodeProductionFastPath'
  • rtk dotnet test tests/Asynkron.JsEngine.Tests -c Release --filter 'FullyQualifiedName~UnifiedBytecodeProductionInvocationTests'
  • rtk dotnet test tests/Asynkron.JsEngine.Tests -c Release --filter 'FullyQualifiedName~UnifiedBytecodeProduction'
  • rtk dotnet test tests/Asynkron.JsEngine.Tests -c Release --filter 'FullyQualifiedName~ActivationSemanticsProofPackTests'
  • rtk dotnet build Asynkron.JsEngine.sln -c Release
  • rtk rg "EvaluateExpression(|ProfileEvaluateExpression(" src/Asynkron.JsEngine/Ast/TypedAstEvaluator.ExecutionPlanRunner*
  • rtk ./tools/profile forloop --memory (6.86 MB)
  • rtk git diff --check

Copilot AI review requested due to automatic review settings June 2, 2026 01:10
@rogeralsing
rogeralsing merged commit 8e834b1 into main Jun 2, 2026
@rogeralsing
rogeralsing deleted the codex/unified-bytecode-loop-79-captured-closure branch June 2, 2026 01:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants