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

Enable more ILLinker skipped tests on native AOT #110353

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

MichalStrehovsky
Copy link
Member

Progress towards #82447.

Copy link
Contributor

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

@@ -1188,7 +1188,7 @@ class FieldTypeAlsoImplementsInterface : IAnnotatedInterface
public NestedFieldType _nestedField;

[Kept]
public class NestedFieldType
public struct NestedFieldType
Copy link
Member Author

@MichalStrehovsky MichalStrehovsky Dec 3, 2024

Choose a reason for hiding this comment

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

Native AOT will still try to optimize out the MethodTable of a type even if it's used as the type of a reflection-visible field so this wasn't kept. It is not able to optimize it out if the type of the field is a struct since reflection APIs (FieldInfo.GetValue) will create a default-initialized boxed version when called.

(The test infrastructure is looking for MethodTables, not for type metadata. We would have the metadata only.)

@MichalStrehovsky
Copy link
Member Author

@sbomer could you please have a look when you get a chance?

Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

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

LGTM modulo comments. Thanks!

@@ -1557,17 +1557,17 @@ class UsedByDerived
{
class AnnotatedBase
{
[Kept]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[Kept (By = Tool.Trimmer /* The object.GetType() call is statically unreachable, this could be trimmed */)]
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 file an issue for this and link it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, filed #110563.

@@ -1616,7 +1616,7 @@ class AnnotatedInterface
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)]
interface IBase
{
[Kept]
[Kept (By = Tool.Trimmer /* interface method is not target of reflection */)]
Copy link
Member

Choose a reason for hiding this comment

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

Is this something that should be fixed in ILLink? If so, mind filing an issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, so looking at this, this is a bug. Good catch. I thing I got confused by the RequirePublicMethods below, thinking the annotation was just PublicMethods (made the same mistake right now as I was trying to repro).

This should be kept because the actual annotation is .All, not just PublicMethods. We have an existing bug for this so I linked it here.

@MichalStrehovsky MichalStrehovsky merged commit 731a96b into dotnet:main Dec 10, 2024
112 checks passed
@MichalStrehovsky MichalStrehovsky deleted the moreillinktests branch December 10, 2024 13:21
hez2010 pushed a commit to hez2010/runtime that referenced this pull request Dec 14, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants