-
Notifications
You must be signed in to change notification settings - Fork 128
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
Rethink how SubStepsDispatcher is used to mark types and assemblies #1735
Comments
This was referenced Jan 20, 2021
sbomer
added a commit
that referenced
this issue
Jan 22, 2021
Track pending marked members This enables tracking of pending marked items which need to be fully marked by MarkStep. Contributes to #1735 - this change is in preparation for running custom steps during MarkStep, where they could change the Annotations state in ways that interact with other marking logic. The idea is that custom steps can call Annotations methods without triggering a lot of other processing, because the full logic is deferred. This way custom steps don't need to be re-entrant. This change causes Annotations.Mark to place members into a set of "pending" items which will get fully marked ("processed") later. "pending" items are already considered marked. AddPreservedMethod conceptually adds a conditional dependency from source -> destination - so if source gets marked, destination should get marked. This change will immediately call Annotations.Mark on the destination if the source is already marked, and otherwise track the condition to be applied if the source gets marked later. SetPreserve can change the TypePreserve of a type after it has been marked. This change will track any changes to TypePreserve and apply them later even for types which have already been marked. This works a little differently from AddPreservedMethod, to avoid traversing type members in Annotations. Note that once we allow custom steps to run during during MarkStep, Process will call ProcessMarkedPending - but this isn't required in this change. The intention here is just to add adding extra tracking (that will actually be used by #1666), while mostly preserving existing behavior.
@sbomer - you're the expert on delay loading (well, let me rephrase, you probably remember more than me 😉). Is this still a problem? I though we redesigned the Xamarin custom steps to avoid the problem. |
I think this is done. The relevant steps have been changed to use the |
agocke
pushed a commit
to dotnet/runtime
that referenced
this issue
Nov 16, 2022
Track pending marked members This enables tracking of pending marked items which need to be fully marked by MarkStep. Contributes to dotnet/linker#1735 - this change is in preparation for running custom steps during MarkStep, where they could change the Annotations state in ways that interact with other marking logic. The idea is that custom steps can call Annotations methods without triggering a lot of other processing, because the full logic is deferred. This way custom steps don't need to be re-entrant. This change causes Annotations.Mark to place members into a set of "pending" items which will get fully marked ("processed") later. "pending" items are already considered marked. AddPreservedMethod conceptually adds a conditional dependency from source -> destination - so if source gets marked, destination should get marked. This change will immediately call Annotations.Mark on the destination if the source is already marked, and otherwise track the condition to be applied if the source gets marked later. SetPreserve can change the TypePreserve of a type after it has been marked. This change will track any changes to TypePreserve and apply them later even for types which have already been marked. This works a little differently from AddPreservedMethod, to avoid traversing type members in Annotations. Note that once we allow custom steps to run during during MarkStep, Process will call ProcessMarkedPending - but this isn't required in this change. The intention here is just to add adding extra tracking (that will actually be used by dotnet/linker#1666), while mostly preserving existing behavior. Commit migrated from dotnet/linker@24ba73a
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As part of #1164 work we need to rethink how we are going to allow custom steps to mark additional elements either conditionally or unconditionally. Currently, many custom steps are run before mark as BaseSubStep called via SubStepsDispatcher which means they assume that
context.GetAssemblies ()
returns full assemblies set. This needs to change if we want to really delay load assemblies.The logic inside these custom sub-steps is usually something that marks type or type members when the type is found. Here are a few examples
It seems like if we had a solution on how to run additional marking logic for types and members conditionally we could convert these SubSteps into something that does not need
GetAssemblies
call.@vitek-karas @sbomer
The text was updated successfully, but these errors were encountered: