Repository navigation
Invoke runtime expression values with ref arguments - #663
Open
jogibear9988 wants to merge 1 commit into
Open
jogibear9988 wants to merge 1 commit into
jogibear9988 wants to merge 1 commit into
Conversation
Extend runtime Expression<TDelegate> invocation to ref storage and property/indexer copyback. Compile the receiver once per invocation, preserve operand ordering, and copy property temporaries back only after successful completion. Tests cover parameter/array addresses, getter/setter counts, exceptions, protected arguments and compilation flags. System loses property copyback for the protected-argument shape; that case uses an explicit temporary/writeback control.
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.
Extend runtime Expression invocation to ref storage and property/indexer copyback. Compile the receiver once per invocation, preserve operand ordering, and copy property temporaries back only after successful completion.
Tests cover parameter/array addresses, getter/setter counts, exceptions, protected arguments and compilation flags. System loses property copyback for the protected-argument shape; that case uses an explicit temporary/writeback control.
Validation
Full Release solution build and Standard/LightExpression native runners pass for net8.0, net10.0 and net472. net8.0: 688 TestX and 1744 legacy cases; net10.0: 688 TestX and 1745 legacy cases; net472: 669 TestX and 1610 legacy cases.
Measurements
FEC on master
da14580f10fd19ae2361a8e91cfad4b2dfec182a→ this changee527f33e56b6e2cd51c64555613d1826163e07d8. Windows ARM64; .NET 8.0.28 and 10.0.9; SDK 10.0.301.Trees, API conversions and invocation adapters are built before measurement. Compilation includes delegate creation; runtime measures the compiled delegate through the same adapter. Both sides are FEC: “System trees” names the expression API, not the System compiler.
Two opposite-load-order process rounds; seven alternating paired samples per round; medians of 14 samples, 100 ms calibration target. Verified task-local runtimes; tiered compilation disabled; each process pinned to one logical CPU. Allocations use GC.GetAllocatedBytesForCurrentThread. Slower observations are retained. Timing variation, including unchanged IL controls, prevents a blanket speedup or no-regression claim.
delegate_invokeref_callruntime_expression_plainscalar_adddelegate_invokeref_callruntime_expression_plainscalar_adddelegate_invokeref_callruntime_expression_plainscalar_adddelegate_invokeref_callruntime_expression_plainscalar_addShared-workload emitted IL is unchanged.
Allocation changes: none beyond measurement rounding in these shared workloads.
Affected cases without a valid master baseline
Master rejects these trees or generates a delegate with incorrect behavior, so they are excluded from comparative timings. Patch-only measurements use 14 samples, a 30 ms calibration target, and the same compilation/runtime separation.
fixed_caseexercises this PR’s added behavior.fixed_casefixed_casefixed_casefixed_caseThe affected runtime invocation includes System Compile on every call; it does not cache the compiled expression.