Repository navigation
Avoid unnecessary arithmetic spills after completed exception regions - #661
Open
jogibear9988 wants to merge 1 commit into
Open
jogibear9988 wants to merge 1 commit into
jogibear9988 wants to merge 1 commit into
Conversation
The global try-expression count forces extra left-value spills even when the right operand can only load an atomic value and cannot enter a protected region. Keep that value on the stack for parameter/constant/default RHS operands and retain spills for complex or opaque intrinsic operands. Validation: Release solution build and full Standard/LightExpression runners on .NET 8, .NET 10 and .NET Framework. Right operands observing mutations made by a completed finalizer, parameter/constant/default variants, and an intrinsic LightExpression constant that emits an exception region.
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.
The global try-expression count forces extra left-value spills even when the right operand can only load an atomic value and cannot enter a protected region.
Keep that value on the stack for parameter/constant/default RHS operands and retain spills for complex or opaque intrinsic operands.
Right operands observing mutations made by a completed finalizer, parameter/constant/default variants, and an intrinsic LightExpression constant that emits an exception region.
Validation: Release solution build; full Standard and LightExpression runners on .NET 8, .NET 10 and .NET Framework. net8.0: 562 TestX cases and 1744 legacy cases; net10.0: 562 TestX cases and 1745 legacy cases; net472: 543 TestX cases and 1610 legacy cases.
Shared-workload measurements
Base:
bac81d0734c0(master); patch:019767854711. Windows ARM64, SDK 10.0.301; .NET 8.0.28 and 10.0.9. Expression trees and invocation adapters are prepared outside the timed loops. Strict FEC compilation, tiered compilation disabled, one pinned logical processor, two opposite-load-order processes per runtime, seven alternating paired samples per process, 30 ms calibration target; medians of 14 samples.Both columns below are FEC. “System trees” names the expression API, not the System compiler. Compilation includes delegate creation; invocation measures the returned delegate through the same adapter on each side. Managed allocations use GC.GetAllocatedBytesForCurrentThread.
arithmetic_after_tryref_compoundscalar_addtry_finallyarithmetic_after_tryref_compoundscalar_addtry_finallyarithmetic_after_tryref_compoundscalar_addtry_finallyarithmetic_after_tryref_compoundscalar_addtry_finallyEmitted IL matched byte-for-byte for 12/16 shared control delegates. Observed compilation changes range from -12.7% to +17.5%; invocation changes from -12.1% to +19.4%. Slower results are retained. Even identical-IL controls vary, so these short machine timings do not establish a blanket runtime speedup or absence of regressions.
Managed allocations were unchanged on every shared workload in this run.
Longer confirmation run
Same base, patch and paired protocol, with a 150 ms calibration target instead of 30 ms. These results are additional measurements of the same code; they do not replace slower observations above.
arithmetic_after_tryref_compoundscalar_addtry_finallyarithmetic_after_tryref_compoundscalar_addtry_finallyarithmetic_after_tryref_compoundscalar_addtry_finallyarithmetic_after_tryref_compoundscalar_addtry_finally