Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call CheckProcessed before enqueuing to MarkStep._methods #3139

Merged
merged 3 commits into from
Nov 29, 2022

Conversation

jtschuster
Copy link
Member

Fixes #3137

We unconditionally add a method to the MarkStep._methods queue and perform a filtering check in ProcessMethod later. This causes _methods to grow to be as large as 110 mb in some cases (see #3126 (comment)). If we instead perform the filtering check before enqueuing the method, MarkStep_methods reach a max size of ~14mb (in the same repro).

@jtschuster jtschuster changed the title CheckProcessed before enqueuing to MarkStep._methods Call CheckProcessed before enqueuing to MarkStep._methods Nov 28, 2022
Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

src/linker/Linker.Steps/MarkStep.cs Show resolved Hide resolved
src/linker/Linker.Steps/MarkStep.cs Outdated Show resolved Hide resolved
// Temporarily switch to the original source for marking this method
// this is for the same reason as for tracking, but this time so that we report potential
// warnings from a better place.
MarkType (method.DeclaringType, new DependencyInfo (DependencyKind.DeclaringTypeOfCalledMethod, method), new MessageOrigin (reason.Source as IMemberDefinition ?? method));
Copy link
Member

Choose a reason for hiding this comment

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

Just a note - interesting that this one is using reason.Source as the origin. Not related to your change (so I wouldn't try to address it here) but I think we have some redundancy here between the reason and origin, that will likely lead to inconsistencies.

@jtschuster jtschuster merged commit 261e911 into dotnet:main Nov 29, 2022
tlakollo pushed a commit to tlakollo/linker that referenced this pull request Dec 20, 2022
* Call CheckProcessed before enqueuing to MarkStep._methods to avoid redundantly adding methods

Commit migrated from dotnet@261e911
tlakollo pushed a commit to tlakollo/runtime that referenced this pull request Dec 22, 2022
…ker#3139)

* Call CheckProcessed before enqueuing to MarkStep._methods to avoid redundantly adding methods

Commit migrated from dotnet/linker@261e911
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.

Move CheckProcessed filter from ProcessMethod to MarkMethod to avoid adding to _methods queue
3 participants