Repository navigation
Recognize static field intrinsics before Wasm static helpers - #135801
Merged
davidwrighton merged 1 commit intoOct 19, 2026
Merged
Conversation
Restore intrinsic reads of IntPtr.Zero, UIntPtr.Zero, String.Empty, and BitConverter.IsLittleEndian on the ReadyToRun Wasm path while retaining address-taking and ordinary static access behavior. Add regression coverage for optimized and unoptimized regular and composite compilations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/crossgen-contrib |
This was referenced Oct 15, 2026
Closed
jtschuster
approved these changes
Oct 16, 2026
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.
Description
Extract the independent static-field intrinsic fix from #135553 onto
main.Recognize existing static-field intrinsics before selecting Wasm static-base helpers. Reads of
IntPtr.Zero,UIntPtr.Zero, andBitConverter.IsLittleEndiancan use constants, whileString.Emptycan use a string handle. Address-taking, writes, and ordinary static-field accesses retain their existing handling, including main's target-aware thread-static check.Add a regression theory covering optimized/unoptimized and regular/composite compilation, with fixtures for both intrinsic reads and address-taking.
Source commit:
717befe76a5. This PR does not include two-phase compilation, direct calls, or the prolog/frame-identity changes.Historical size and codegen measurements
These matched before/after measurements were collected on the original development branch, not on this newly extracted/rebased PR. The comparisons used identical input assemblies, profiles, compiler options, references, and JIT binaries. Brotli used quality 11 and window 22.
Emitted method-body nodes shrank by 30,932 bytes in retail and 27,637 bytes in composite, with their counts unchanged. In the isolated intrinsic-read fixture, zero and endianness reads shrank from 47 to 17 Wasm body bytes and eliminated the static-base helper call; the empty-string read shrank from 47 to 24 bytes. Address-taking bodies were unchanged.
These are historical size/codegen results, not throughput benchmarks or a guarantee of equivalent savings on current main.
Validation
git diff --check upstream/main...split/r2r-static-intrinsics— passed.IsThreadStaticForTarget(field)handling.This remains a draft; build and runtime validation on the independent branch are outstanding.
Note
This PR was prepared with GitHub Copilot.