Skip to content

Commit

Permalink
ILLink: Remove ScopeStack from MarkStep (dotnet#102282)
Browse files Browse the repository at this point in the history
Removes the ScopeStack from the MarkStep to make the MessageOrigin flow clearly traceable. This should be very helpful as we transition to the dependency analysis framework.

The changes were fairly mechanical, each place that pushed a scope onto the stack, a new MessageOrigin was created, and all places that used ScopeStack.CurrentScope added a new origin parameter, and the parameter bubbled up to the ProcessX methods.

Passing MessageOrigin by value was slightly faster than as an in parameter (and overall this is slightly faster than main), so I made MessageOrigin.ILOffset a non-nullable int to make the struct a bit smaller. I ran the aspnetcore benchmarks trim step and didn't run into issues, so the stack should be large enough to handle it.
  • Loading branch information
jtschuster committed May 17, 2024
1 parent fdc3797 commit 333b3d8
Show file tree
Hide file tree
Showing 5 changed files with 386 additions and 570 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void MarkInterfaceImplementation (in MessageOrigin origin, InterfaceImplementati
if (!_enabled)
return;

_markStep.MarkInterfaceImplementation (interfaceImplementation, null, new DependencyInfo (dependencyKind, origin.Provider));
_markStep.MarkInterfaceImplementation (interfaceImplementation, origin, new DependencyInfo (dependencyKind, origin.Provider));
}

internal void MarkConstructorsOnType (in MessageOrigin origin, TypeDefinition type, Func<MethodDefinition, bool>? filter, BindingFlags? bindingFlags = null)
Expand Down
141 changes: 0 additions & 141 deletions src/tools/illink/src/linker/Linker.Steps/MarkScopeStack.cs

This file was deleted.

Loading

0 comments on commit 333b3d8

Please sign in to comment.