summaryrefslogtreecommitdiff
path: root/src/gc/handletablecore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gc/handletablecore.cpp')
-rw-r--r--src/gc/handletablecore.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/gc/handletablecore.cpp b/src/gc/handletablecore.cpp
index 5776c26ace..00ab6a24b9 100644
--- a/src/gc/handletablecore.cpp
+++ b/src/gc/handletablecore.cpp
@@ -961,12 +961,12 @@ BOOL SegmentHandleAsyncPinHandles (TableSegment *pSegment)
}
// Replace an async pin handle with one from default domain
-void SegmentRelocateAsyncPinHandles (TableSegment *pSegment, HandleTable *pTargetTable)
+bool SegmentRelocateAsyncPinHandles (TableSegment *pSegment, HandleTable *pTargetTable)
{
CONTRACTL
{
GC_NOTRIGGER;
- THROWS;
+ NOTHROW;
MODE_COOPERATIVE;
}
CONTRACTL_END;
@@ -975,7 +975,7 @@ void SegmentRelocateAsyncPinHandles (TableSegment *pSegment, HandleTable *pTarge
if (uBlock == BLOCK_INVALID)
{
// There is no pinning handles.
- return;
+ return true;
}
for (uBlock = 0; uBlock < pSegment->bEmptyLine; uBlock ++)
{
@@ -1003,12 +1003,21 @@ void SegmentRelocateAsyncPinHandles (TableSegment *pSegment, HandleTable *pTarge
overlapped->m_userObject = NULL;
}
BashMTForPinnedObject(ObjectToOBJECTREF(value));
- overlapped->m_pinSelf = CreateAsyncPinningHandle((HHANDLETABLE)pTargetTable,ObjectToOBJECTREF(value));
+
+ overlapped->m_pinSelf = HndCreateHandle((HHANDLETABLE)pTargetTable, HNDTYPE_ASYNCPINNED, ObjectToOBJECTREF(value));
+ if (!overlapped->m_pinSelf)
+ {
+ // failed to allocate a new handle - callers have to handle this.
+ return false;
+ }
+
*pValue = NULL;
}
pValue ++;
} while (pValue != pLast);
}
+
+ return true;
}
// Mark all non-pending AsyncPinHandle ready for cleanup.
@@ -1067,6 +1076,7 @@ void TableRelocateAsyncPinHandles(HandleTable *pTable, HandleTable *pTargetTable
BOOL fGotException = FALSE;
TableSegment *pSegment = pTable->pSegmentList;
+ bool wasSuccessful = true;
#ifdef _DEBUG
// on debug builds, execute the OOM path 10% of the time.
@@ -1075,21 +1085,18 @@ void TableRelocateAsyncPinHandles(HandleTable *pTable, HandleTable *pTargetTable
#endif
// Step 1: replace pinning handles with ones from default domain
- EX_TRY
+ while (pSegment)
{
- while (pSegment)
+ wasSuccessful = wasSuccessful && SegmentRelocateAsyncPinHandles (pSegment, pTargetTable);
+ if (!wasSuccessful)
{
- SegmentRelocateAsyncPinHandles (pSegment, pTargetTable);
- pSegment = pSegment->pNextSegment;
+ break;
}
+
+ pSegment = pSegment->pNextSegment;
}
- EX_CATCH
- {
- fGotException = TRUE;
- }
- EX_END_CATCH(SwallowAllExceptions);
- if (!fGotException)
+ if (wasSuccessful)
{
return;
}
@@ -2719,9 +2726,8 @@ void TableFreeBulkUnpreparedHandles(HandleTable *pTable, uint32_t uType, const O
{
CONTRACTL
{
- THROWS;
+ NOTHROW;
WRAPPER(GC_TRIGGERS);
- INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END;