-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Avoid copy action for root assemblies #96363
Conversation
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue Detailsnull
|
Preserve existing marking behavior by letting MarkStep do the same work that it does for copy assemblies, including marking attributes.
With the change to MarkEntireType that calls MarkType instead of Annotations.Mark, we are now reaching MarkType for the dependency from the copy assembly to the attribute it contains, producing an unexpected IL2045. Silence this by checking the DependencyKind.
This comment was marked as resolved.
This comment was marked as resolved.
BitVector32.CreateMask(int.MinValue) was incorrectly being treated as returning constant 1. The IL from the beginning of that method: IL_0000: ldarg.0 IL_0001: brtrue.s IL_0005 IL_0003: ldc.i4.1 IL_0004: ret The brtrue.s branch was being analyzed as not taken because the argument was not 1. The branch should be analyzed as taken for any non-zero argument.
And don't set ForceParse for rooted methods. ForceParse was preventing the XML substitutions from applying. This change may make it possible for substitutions in copy assemblies to be honored...
@sbomer The EnC tests depend at runtime on the assemblies built from the projects in the (specifically when a runtime that supports hot reload tries to apply an update to a particular assembly, that assembly must have In general the assemblies in the
I would prefer not to do that, if possible. Using a Release runtime with a Release BCL with debuggable untrimmed "user code" is much closer to the actual scenario that users will be running. |
FIxing the checkRemainingErrors behavior results in too many spurious failures. Use LogDoesNotContainAttribute for now.
src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me although I'm not an expert on this codebase.
@@ -327,6 +328,8 @@ public static class GetCustomAttribute | |||
{ | |||
|
|||
[Fact] | |||
[ActiveIssue("https://github.com/dotnet/linker/issues/2078", typeof(PlatformDetection), nameof(PlatformDetection.IsTrimmedWithILLink)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondered why this wasn't hit with naot and found out illinker has this as a hardcoded list. Weird, but okay I guess. Would be nice to move this to the same plan as all the other attributes at least. I'm not convinced anyone will want to work on 2078 anytime soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed #96907
@@ -1583,7 +1583,7 @@ public bool Analyze (in CalleePayload callee, Stack<MethodDefinition> callStack) | |||
return false; | |||
|
|||
if (operand is int oint) { | |||
if (oint == 1) | |||
if (oint != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this needed? It's a good change, but surprised to see this in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes TrimmerRootAssembly (and the underlying option -a) to root all members of the assembly, without setting the action to copy. This allows us to perform branch removal and attribute removal for the assembly. This includes changes to MarkStep to ensure that rooted assemblies are marked visible to reflection. This for example ensures that parameter names don't get removed. With the change to MarkEntireType that calls MarkType instead of Annotations.Mark, we are now reaching MarkType for the dependency from the copy assembly to the attribute it contains, producing an unexpected IL2045. Silence this by checking the DependencyKind. Also fixes a bug in constant method analysis that this uncovered: BitVector32.CreateMask(int.MinValue) was incorrectly being treated as returning constant 1. The IL from the beginning of that method: IL_0000: ldarg.0 IL_0001: brtrue.s IL_0005 IL_0003: ldc.i4.1 IL_0004: ret The brtrue.s branch was being analyzed as not taken because the argument was not 1. The branch should be analyzed as taken for any non-zero argument.
Changes
TrimmerRootAssembly
(and the underlying option-a
) to root all members of the assembly, without setting the action tocopy
. This allows us to perform branch removal and attribute removal for the assembly.Fixes #95429