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 support for weak interior pointer GC handles #4921

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/SOS/Strike/strike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8887,6 +8887,8 @@ class GCHandlesImpl
mType = HNDTYPE_DEPENDENT;
else if (_stricmp(type, "WeakWinRT") == 0)
mType = HNDTYPE_WEAK_WINRT;
else if (_stricmp(type, "WeakInteriorPointer") == 0)
mType = HNDTYPE_WEAK_INTERIOR_POINTER;
else
sos::Throw<sos::Exception>("Unknown handle type '%s'.", type.GetPtr());
}
Expand Down Expand Up @@ -9055,6 +9057,10 @@ class GCHandlesImpl
type = "WeakWinRT";
if (pStats) pStats->weakWinRTHandleCount++;
break;
case HNDTYPE_WEAK_INTERIOR_POINTER:
type = "WeakInteriorPointer";
if (pStats) pStats->weakInteriorPointerHandleCount++;
break;
default:
DebugBreak();
type = "Unknown";
Expand All @@ -9074,6 +9080,8 @@ class GCHandlesImpl
mOut.WriteRow(data[i].Handle, type, ObjectPtr(objAddr), Decimal(size), ObjectPtr(data[i].Secondary), mtName);
else if (data[i].Type == HNDTYPE_WEAK_WINRT)
mOut.WriteRow(data[i].Handle, type, ObjectPtr(objAddr), Decimal(size), Pointer(data[i].Secondary), mtName);
else if (data[i].Type == HNDTYPE_WEAK_INTERIOR_POINTER)
mOut.WriteRow(data[i].Handle, type, ObjectPtr(objAddr), Decimal(size), Pointer(data[i].Secondary), mtName);
else
mOut.WriteRow(data[i].Handle, type, ObjectPtr(objAddr), Decimal(size), "", mtName);
}
Expand All @@ -9098,6 +9106,7 @@ class GCHandlesImpl
PrintHandleRow("Weak Long Handles:", pStats->weakLongHandleCount);
PrintHandleRow("Weak Short Handles:", pStats->weakShortHandleCount);
PrintHandleRow("Weak WinRT Handles:", pStats->weakWinRTHandleCount);
PrintHandleRow("Weak Interior Pointer Handles:", pStats->weakInteriorPointerHandleCount);
PrintHandleRow("Variable Handles:", pStats->variableCount);
PrintHandleRow("SizedRef Handles:", pStats->sizedRefCount);
PrintHandleRow("Dependent Handles:", pStats->dependentCount);
Expand Down
5 changes: 4 additions & 1 deletion src/SOS/Strike/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class MethodTable;
#define HNDTYPE_ASYNCPINNED (7)
#define HNDTYPE_SIZEDREF (8)
#define HNDTYPE_WEAK_WINRT (9)
#define HNDTYPE_WEAK_INTERIOR_POINTER (10)


class BaseObject
{
Expand Down Expand Up @@ -1722,11 +1724,12 @@ struct GCHandleStatistics
DWORD sizedRefCount;
DWORD dependentCount;
DWORD weakWinRTHandleCount;
DWORD weakInteriorPointerHandleCount;
DWORD unknownHandleCount;
GCHandleStatistics()
: strongHandleCount(0), pinnedHandleCount(0), asyncPinnedHandleCount(0), refCntHandleCount(0),
weakLongHandleCount(0), weakShortHandleCount(0), variableCount(0), sizedRefCount(0),
dependentCount(0), weakWinRTHandleCount(0), unknownHandleCount(0)
dependentCount(0), weakWinRTHandleCount(0), weakInteriorPointerHandleCount(0), unknownHandleCount(0)
{}
~GCHandleStatistics()
{
Expand Down