Skip to content

Remove unnecessary _featureCheckValues cache from ILLink - #127302

Merged
sbomer merged 1 commit into
dotnet:mainfrom
sbomer:remove-stub-cache
Apr 28, 2026
Merged

sbomer merged 1 commit into
dotnet:mainfrom
sbomer:remove-stub-cache

Conversation

@sbomer

@sbomer sbomer commented Apr 22, 2026

Copy link
Copy Markdown
Member

Now that CodeRewriterStep runs before SweepStep (#127090), the _featureCheckValues cache in MemberActionStore and the eager pre-computation in MarkStep are no longer needed.

The cache was added in #104995 to preserve feature attribute values before they could be swept away. With the step reordering, attributes are still present when CodeRewriterStep processes them.

This cleanup was suggested in #127090 (comment)

This content was created with assistance from AI.

Now that CodeRewriterStep runs before SweepStep (changed in dotnet#127090),
the FeatureSwitchDefinition and FeatureGuard attributes are still
present when CodeRewriterStep needs them. The _featureCheckValues
cache in MemberActionStore and the eager pre-computation in MarkStep
were added in dotnet#104995 to work around the old ordering where attributes
could be swept before CodeRewriterStep ran. They are no longer needed.

Co-authored-by: Copilot <[email protected]>
Assisted-by: Claude:claude-opus-4.6-1m
Copilot AI review requested due to automatic review settings April 22, 2026 22:38
@github-actions github-actions Bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Apr 22, 2026
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Apr 22, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/illink
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes now-unnecessary feature-check caching logic in the ILLinker, relying on the updated pipeline ordering where CodeRewriterStep runs before SweepStep so feature attributes remain available when stubbing decisions are made.

Changes:

  • Remove the _featureCheckValues cache from MemberActionStore and evaluate feature-check values directly from attributes/settings when needed.
  • Remove MarkStep’s eager precomputation of stub values for ConvertToStub methods, since attribute sweeping no longer precedes rewriting.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/tools/illink/src/linker/Linker/MemberActionStore.cs Deletes the feature-check memoization and associated System.Diagnostics using; computes feature-check results on demand.
src/tools/illink/src/linker/Linker.Steps/MarkStep.cs Removes precomputation of stub values for ConvertToStub methods, aligning behavior with the reordered step pipeline.

@sbomer

sbomer commented Apr 28, 2026 •

Copy link
Copy Markdown
Member Author

/ba-g "Timeout in browser-wasm linux Release LibraryTestsCoreCLR"

@sbomer
sbomer merged commit 86b1771 into dotnet:main Apr 28, 2026
91 of 100 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Apr 28, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 29, 2026
@sbomer
sbomer deleted the remove-stub-cache branch June 26, 2026 18:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants