Skip to content

Remove unnecessary _featureCheckValues cache from ILLink#127302

Open
sbomer wants to merge 1 commit intodotnet:mainfrom
sbomer:remove-stub-cache
Open

Remove unnecessary _featureCheckValues cache from ILLink#127302
sbomer wants to merge 1 commit intodotnet:mainfrom
sbomer:remove-stub-cache

Conversation

@sbomer
Copy link
Copy Markdown
Member

@sbomer sbomer commented Apr 22, 2026

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 <223556219+Copilot@users.noreply.github.com>
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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants