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

Generic virtual method analysis tweaks #493

Merged
merged 2 commits into from
Dec 24, 2020

Conversation

MichalStrehovsky
Copy link
Member

@MichalStrehovsky MichalStrehovsky commented Dec 22, 2020

Three tweaks:

  • Do not go into the SearchDynamicDependencies codepath if the method cannot be overriden. I believe the SearchDynamicDependencies wouldn't come up with anything for these cases, so we might as well skip that. This mostly helps generic virtual method use in LINQ because those classes are sealed. Doesn't help much in Avalonia.
  • Don't do a while loop over the inheritance chain in SearchDynamicDependencies. I believe the dependencies on less derived methods will be injected as part of those GVMDependencies nodes so this feels unnecessary.
  • Don't mark EETypes as interesting for GVM analysis if they don't provide an implementation of an interface method that is new in this inheritance hierarchy.

Two tweaks:
* Do not go into the SearchDynamicDependencies codepath if the method cannot be overriden. I believe the SearchDynamicDependencies wouldn't come up with anything. This mostly helps generic virtual method use in LINQ. Doesn't help much in Avalonia.
* Don't do a while loop over the inheritance chain. I believe the dependencies on less derived methods will be injected as part of those GVMDependencies nodes so this feels unnecessary.
@MichalStrehovsky MichalStrehovsky added area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) labels Dec 22, 2020
@MichalStrehovsky MichalStrehovsky removed the * NO MERGE * The PR is not ready for merge yet (see discussion for detailed reasons) label Dec 23, 2020
@MichalStrehovsky
Copy link
Member Author

/azp run runtimelab-nativeaot Pri-0 Tests

@azure-pipelines
Copy link

Azure Pipelines failed to run 1 pipeline(s).

@MichalStrehovsky
Copy link
Member Author

So this drops the compilation time of the Avalonia demo app in #452 from ~12 minutes to:

  • ~9 minutes after the first commit
  • 2 minutes and 40 seconds after the second commit

Hopefully I didn't break anything,

@MichalStrehovsky
Copy link
Member Author

Azure Pipelines failed to run 1 pipeline(s).

Thanks for nothing, Azure pipelines. Great failure logs!

@MichalStrehovsky
Copy link
Member Author

/azp run runtimelab-nativeaot Pri-0 Tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -114,10 +121,10 @@ public override bool HasDynamicDependencies

public override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory factory)
{
Debug.Assert(_method.IsVirtual && _method.HasInstantiation);
Copy link
Member Author

Choose a reason for hiding this comment

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

Deleting this because we assert this in the ctor.

@@ -130,13 +137,11 @@ public override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependenci
if (!potentialOverrideType.IsDefType)
continue;

Debug.Assert(!potentialOverrideType.IsRuntimeDeterminedSubtype);
Copy link
Member Author

Choose a reason for hiding this comment

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

Deleting this because IsRuntimeDeterminedSubtype is expensive and getting one here would mean we already have a bad EEType in the system. EETypeNode asserts this is not the case.

@@ -186,23 +191,10 @@ public override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependenci
continue;
}

overrideTypeCur = potentialOverrideType;
Copy link
Member Author

Choose a reason for hiding this comment

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

Couldn't figure out when this loop would have a meaningful impact. We could consider not checking in this part of the change and keep the loop, but I don't like to have code around that nobody understands and we have no test coverage for (there's apparently no failing test with this deleted even though we test generic virtual methods in the Generics test and in the DynamicGenerics test).

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants