Skip to content

Load captured struct member receivers from their existing box - #662

Open
jogibear9988 wants to merge 1 commit into
dadhi:masterfrom
jogibear9988:fix/arithmetic-value-operands-20261114
Open

jogibear9988 wants to merge 1 commit into
dadhi:masterfrom
jogibear9988:fix/arithmetic-value-operands-20261114

Conversation

@jogibear9988

@jogibear9988 jogibear9988 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Member access on a captured nonnullable struct loaded a value copy where writable storage was required. Use the existing boxed storage for field and instance receivers, preserving mutations across calls and removing unnecessary getter-copy IL.

Covers writable captured fields, temporary operator results, repeated calls and the existing Issue347 execution/opcode regression.

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 change 53d06c7e941eee0b980f940f2d632240c231dd75. 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.

Runtime / API Workload Compile μs, master → patch Compile B/op Runtime ns, master → patch Runtime B/op
net10.0 / LightExpression class_setter 9.720 → 9.477 944.0 5.742 → 5.420 0.0
net10.0 / LightExpression nested_lambda 14.407 → 20.824 2048.1 5.285 → 4.307 0.0
net10.0 / LightExpression ref_call 12.330 → 8.001 928.0 5.737 → 5.025 0.0
net10.0 / LightExpression scalar_add 7.744 → 9.806 872.0 3.476 → 5.260 0.0
net10.0 / System trees class_setter 24.428 → 16.927 944.4 8.174 → 6.902 0.0
net10.0 / System trees nested_lambda 26.044 → 36.199 2048.1 7.355 → 7.730 0.0
net10.0 / System trees ref_call 13.420 → 9.407 928.0 6.843 → 7.472 0.0
net10.0 / System trees scalar_add 18.430 → 16.398 872.1 6.769 → 8.622 0.0
net8.0 / LightExpression class_setter 24.167 → 19.196 944.0 11.816 → 7.571 0.0
net8.0 / LightExpression nested_lambda 35.271 → 41.436 2048.1 10.493 → 12.246 0.0
net8.0 / LightExpression ref_call 15.402 → 15.527 928.0 6.842 → 9.389 0.0
net8.0 / LightExpression scalar_add 16.700 → 12.997 872.0 11.543 → 12.074 0.0
net8.0 / System trees class_setter 23.102 → 34.518 944.3 7.631 → 9.292 0.0
net8.0 / System trees nested_lambda 23.403 → 34.552 2048.1 6.314 → 6.688 0.0
net8.0 / System trees ref_call 15.582 → 14.123 928.0 7.962 → 9.869 0.0
net8.0 / System trees scalar_add 22.371 → 11.451 872.1 7.721 → 10.212 0.0

Shared-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_case exercises this PR’s added behavior.

Runtime / API Case Compile μs Compile B/op Runtime ns Runtime B/op
net10.0 / LightExpression captured_getter 31.652 3216.0 7.661 0.0
net10.0 / LightExpression fixed_case 18.356 3232.2 4.750 0.0
net10.0 / System trees captured_getter 32.408 3217.3 9.819 0.0
net10.0 / System trees fixed_case 28.095 3233.1 9.586 0.0
net8.0 / LightExpression captured_getter 49.127 3216.0 10.696 0.0
net8.0 / LightExpression fixed_case 54.520 3232.7 8.460 0.0
net8.0 / System trees captured_getter 46.776 3220.6 18.523 0.0
net8.0 / System trees fixed_case 62.044 3238.6 18.725 0.0

Member access on a captured nonnullable struct loaded a value copy where writable storage was required. Use the existing boxed storage for field and instance receivers, preserving mutations across calls and removing unnecessary getter-copy IL.

Covers writable captured fields, temporary operator results, repeated calls and the existing Issue347 execution/opcode regression.
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.

1 participant