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

Update auto-generated native AOT metadata wrappers to use readonly structs #101895

Merged
merged 1 commit into from
May 6, 2024

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented May 6, 2024

This avoids defensive copies when these types are used for readonly fields

Also deleted some unused methods and unused arguments, and make the auto-generated code more compact.

structs

This avoids defensive copies when these types are used for readonly
fields

Also deleted some unused methods and unused arguments, and make the
auto-generated code more compact.
@jkotas jkotas changed the title Update auto-generated native AOT metadata wrappers to use readonly Update auto-generated native AOT metadata wrappers to use readonly structs May 6, 2024
@jkotas
Copy link
Member Author

jkotas commented May 6, 2024

This avoids defensive copies when these types are used for readonly fields

As observed in #101890 (comment). The crash during defensive copy of 100 byte struct.

@@ -88,7 +88,7 @@ public sealed override MethodInfo EntryPoint
MetadataReader reader = scope.Reader;

QualifiedMethodHandle entrypointHandle = scope.ScopeDefinition.EntryPoint;
if (!entrypointHandle.IsNull(reader))
if (!entrypointHandle.IsNil)
Copy link
Member Author

Choose a reason for hiding this comment

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

IsNil matches the naming convention and shape of System.Reflection.Metadata.

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@jkotas
Copy link
Member Author

jkotas commented May 6, 2024

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas jkotas merged commit 71795e0 into dotnet:main May 6, 2024
106 of 108 checks passed
@jkotas jkotas deleted the readonly branch May 6, 2024 14:57
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
…ructs (dotnet#101895)

This avoids defensive copies when these types are used for readonly fields

Also deleted some unused methods and unused arguments, and make the
auto-generated code more compact.
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
…ructs (dotnet#101895)

This avoids defensive copies when these types are used for readonly fields

Also deleted some unused methods and unused arguments, and make the
auto-generated code more compact.
@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2024
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