Skip to content
New issue

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

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

Already on GitHub? # to your account

Validate the Kept attribute against the presence of EEType in NativeAOT #81830

Merged
merged 3 commits into from
Feb 10, 2023

Conversation

vitek-karas
Copy link
Member

Previously we validated the Kept on types against the presence of constructed EEType. But the compiler avoids constructed types as much as possible and the tests do use cases where the type in question is never instantiated (or fully static type). Validating against the presence of EEType (basically a method table) is much closer to the ILLink behavior which validates the presence of the type in IL metadata.

Fixes #80408

Previously we validated the Kept on types against the presence of constructed EEType. But the compiler avoids constructed types as much as possible and the tests do use cases where the type in question is never instantiated (or fully static type). Validating against the presence of EEType (basically a method table) is much closer to the ILLink behavior which validates the presence of the type in IL metadata.

Fixes dotnet#80408
@ghost
Copy link

ghost commented Feb 8, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

Previously we validated the Kept on types against the presence of constructed EEType. But the compiler avoids constructed types as much as possible and the tests do use cases where the type in question is never instantiated (or fully static type). Validating against the presence of EEType (basically a method table) is much closer to the ILLink behavior which validates the presence of the type in IL metadata.

Fixes #80408

Author: vitek-karas
Assignees: vitek-karas
Labels:

area-NativeAOT-coreclr

Milestone: -

Copy link
Contributor

@tlakollo tlakollo left a comment

Choose a reason for hiding this comment

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

Looks good to me

}

void AddMethod (MethodDesc method)
void AddMethod (MethodDesc method)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: seems like now this line is not well indented

@@ -691,6 +691,8 @@ public IEnumerable<TypeDesc> ConstructedEETypes
}
}
}

public DependencyAnalyzerBase<NodeFactory> Graph => _graph;
Copy link
Member

Choose a reason for hiding this comment

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

Could you expose this on CompilationResults instead? If the whole graph is public, there's no point to have CompilationResults.

I kind of like that IEETypeNode and IMethodBodyNode are implementation details. Going over the graph exposes e.g. the duality of Constructed/Unconstructed types (some types will appear twice).

Copy link
Member

Choose a reason for hiding this comment

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

(I mean expose a way to get to the list of all method tables constructed or not. I don't mean a way to get to every marked node.)

{
foreach (var node in MarkedNodes)
{
if (node is IEETypeNode)
Copy link
Member

Choose a reason for hiding this comment

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

Note this will have duplicates if constructed and unconstructed forms exist. Probably fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

The infra must handle duplicates for other reasons already, so this is not a problem.

@vitek-karas
Copy link
Member Author

2 known failures, I created dotnet/arcade#12531 for the infra problem.

@vitek-karas vitek-karas merged commit 47a45cb into dotnet:main Feb 10, 2023
@vitek-karas vitek-karas deleted the ValidateKeptOnEEType branch February 10, 2023 08:29
@ghost ghost locked as resolved and limited conversation to collaborators Mar 12, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NativeAOT test infrastructure should mark indirect structures as Kept
3 participants