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

Add IsReferenceOrContainsReferences Equivalent for ITypeDescriptors #530

Closed
Washi1337 opened this issue Mar 6, 2024 · 0 comments · Fixed by #539
Closed

Add IsReferenceOrContainsReferences Equivalent for ITypeDescriptors #530

Washi1337 opened this issue Mar 6, 2024 · 0 comments · Fixed by #539
Labels
dotnet Issues related to AsmResolver.DotNet enhancement
Milestone

Comments

@Washi1337
Copy link
Owner

Problem Description

.NET Core comes with the IsReferenceOrContainsReferences<T> JIT intrinsic which infers from the given type whether the type is a managed reference type or contains managed references in one of its fields. It is mainly used to infer whether a type needs to be GC-tracked and finalized. This value is inferred during the type layout pass when building a method table at runtime.

Currently AsmResolver does not have an equivalent way for ITypeDescriptors.

Proposal

Add a ReferenceOrContainsReferences flag to the MemoryLayoutAttributes enum.

Alternatives

We could add a property or extension method to ITypeDescriptor directly, however this would require its own full pass on the entire type.

Additional Context

@Washi1337 Washi1337 added enhancement dotnet Issues related to AsmResolver.DotNet labels Mar 6, 2024
@Washi1337 Washi1337 added this to the 6.0.0 milestone Mar 15, 2024
@Washi1337 Washi1337 linked a pull request Mar 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet Issues related to AsmResolver.DotNet enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant