Repository navigation
Make invocation values addressable for ref arguments - #607
Merged
dadhi merged 2 commits intoNov 9, 2026
Merged
Conversation
Forward ref-argument context into invocation emission and materialize value-returning delegate or inlined invocation results in typed temporaries. Preserve genuine byref-return aliases and ignored-result side effects.
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.
A value returned by delegate invocation cannot currently be used reliably as a ref argument. Materialize the value once in a typed temporary. Preserve genuine byref-return aliases, inlined invocation results and discarded-result effects.
Validation
The focused regression reproduces a failure or crash on master
a0950432and passes with this change. Release solution build passes with zero warnings/errors. Both Standard and LightExpression native suites run.Measurements
Compare master
a0950432with this commitde1f8aab. Windows ARM64, Release; .NET 8.0.28 and 10.0.9. Compilation uses prebuilt trees; invocation uses precompiled delegates and excludes expression construction/compilation. Standard and LightExpression are measured separately.Two fresh process rounds reverse version-loading order, pin execution to one logical CPU, disable tiered compilation, warm both versions, and alternate measurement order. Values below are medians across 14 samples per side (seven per round; 30 ms calibration target).
Measured compilation and invocation allocations match master on every control. Control delegate IL matches master.
Identical-master control runs also varied: compilation -15.2% to +23.4%, invocation -21.5% to +8.9%. Timings below are observations, not a speedup or universal performance-neutrality claim. Cases that fail or produce invalid IL on master have no meaningful before/after invocation ratio; the table uses executable controls that return the expected result in both versions. Framework correctness is tested above; its performance is not measured here.
All table pairs are master → this change.
B/opis allocated bytes per operation.add_controldelegate_invokeinlined_invokeadd_controldelegate_invokeinlined_invokeadd_controldelegate_invokeinlined_invokeadd_controldelegate_invokeinlined_invoke