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

Fix FnPtrTypeDesc::GetManagedClassObject #82325

Merged
merged 2 commits into from
Feb 18, 2023
Merged

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Feb 17, 2023

The code was missing support for allocating RuntimeType objects on frozen heap

Fixes #82252

@@ -349,8 +349,7 @@ bool TypeHandle::IsManagedClassObjectPinned() const
{
LIMITED_METHOD_DAC_CONTRACT;

// Function pointers are always mapped to typeof(IntPtr)
return !GetLoaderAllocator()->CanUnload() || IsFnPtrType();
return !GetLoaderAllocator()->CanUnload();
Copy link
Member

Choose a reason for hiding this comment

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

Missed this -- prevents FPs from being moved during GC \ causing GC holes perhaps?

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 logic in this method has to be in sync with what GetManagedClassObject returns. If it is not in sync, it will lead to all sorts of problems.

@ghost ghost assigned jkotas Feb 17, 2023
@ghost
Copy link

ghost commented Feb 17, 2023

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Issue Details

The code was missing support for allocating RuntimeType objects on frozen heap

Fixes #82252

Author: jkotas
Assignees: -
Labels:

area-System.Reflection

Milestone: -

}

GCPROTECT_END();
if (m_hExposedClassObject == NULL)
Copy link
Member

Choose a reason for hiding this comment

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

I see that this pattern was recently changed to support frozen heaps, so this copy-paste above was stale.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right

Copy link
Member

@steveharter steveharter left a comment

Choose a reason for hiding this comment

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

Thanks!

The code was missing support for allocating RuntimeType objects on frozen heap

Fixes dotnet#82252
@BruceForstall
Copy link
Member

/azp run runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@EgorBo
Copy link
Member

EgorBo commented Feb 18, 2023

Ouch, thanks! It turns out to be a FOH-related issue indeed 😞

@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2023
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.

Assertion failed: GCHeapUtilities::GetGCHeap()->IsInFrozenSegment(obj)
4 participants