summaryrefslogtreecommitdiff
path: root/src/gc/objecthandle.cpp
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-11-18 19:01:50 +0100
committerJan Vorlicek <janvorli@microsoft.com>2015-11-18 19:01:50 +0100
commit8a1abac8f17553f97b2613784db4bde1f5edda96 (patch)
tree5718520afd416f267d976065be079c3daf32067a /src/gc/objecthandle.cpp
parent76942bb17c28084b0fdad8b6836fb433d9302789 (diff)
downloadcoreclr-8a1abac8f17553f97b2613784db4bde1f5edda96.tar.gz
coreclr-8a1abac8f17553f97b2613784db4bde1f5edda96.tar.bz2
coreclr-8a1abac8f17553f97b2613784db4bde1f5edda96.zip
Replace most windows style types by c++ types
This change replaces DWORD, LONGLONG, ULONGLONG, SIZE_T, BYTE, LONG32 and few more by standard c++ types. The DWORD still remains present in signatures of Windows APIs used by the GC. There are few issues with those that need to get fixed.
Diffstat (limited to 'src/gc/objecthandle.cpp')
-rw-r--r--src/gc/objecthandle.cpp182
1 files changed, 91 insertions, 91 deletions
diff --git a/src/gc/objecthandle.cpp b/src/gc/objecthandle.cpp
index 5816f529bc..6929fdf86e 100644
--- a/src/gc/objecthandle.cpp
+++ b/src/gc/objecthandle.cpp
@@ -272,8 +272,8 @@ void CALLBACK PinObject(_UNCHECKED_OBJECTREF *pObjRef, LPARAM *pExtraInfo, LPARA
pOverlapped->m_userObjectInternal = static_cast<void*>(OBJECTREFToObject(pOverlapped->m_userObject));
ArrayBase* pUserObject = (ArrayBase*)OBJECTREFToObject(pOverlapped->m_userObject);
Object **ppObj = (Object**)pUserObject->GetDataPtr(TRUE);
- SIZE_T num = pUserObject->GetNumComponents();
- for (SIZE_T i = 0; i < num; i ++)
+ size_t num = pUserObject->GetNumComponents();
+ for (size_t i = 0; i < num; i ++)
{
callback(ppObj + i, (ScanContext *)lp1, GC_CALL_PINNED);
}
@@ -414,7 +414,7 @@ void CALLBACK ScanPointerForProfilerAndETW(_UNCHECKED_OBJECTREF *pObjRef, LPARAM
// Get a hold of the heap ID that's tacked onto the end of the scancontext struct.
ProfilingScanContext *pSC = (ProfilingScanContext *)lp1;
- DWORD rootFlags = 0;
+ uint32_t rootFlags = 0;
BOOL isDependent = FALSE;
OBJECTHANDLE handle = (OBJECTHANDLE)(pRef);
@@ -444,7 +444,7 @@ void CALLBACK ScanPointerForProfilerAndETW(_UNCHECKED_OBJECTREF *pObjRef, LPARAM
#ifdef FEATURE_REDHAWK
{
// Set the appropriate ETW flags for the current strength of this variable handle
- UINT nVarHandleType = GetVariableHandleType(handle);
+ uint32_t nVarHandleType = GetVariableHandleType(handle);
if (((nVarHandleType & VHT_WEAK_SHORT) != 0) ||
((nVarHandleType & VHT_WEAK_LONG) != 0))
{
@@ -485,7 +485,7 @@ void CALLBACK ScanPointerForProfilerAndETW(_UNCHECKED_OBJECTREF *pObjRef, LPARAM
{
BEGIN_PIN_PROFILER(CORProfilerTrackGC());
g_profControlBlock.pProfInterface->RootReference2(
- (BYTE *)*pRef,
+ (uint8_t *)*pRef,
kEtwGCRootKindHandle,
(EtwGCRootFlags)rootFlags,
pRef,
@@ -497,8 +497,8 @@ void CALLBACK ScanPointerForProfilerAndETW(_UNCHECKED_OBJECTREF *pObjRef, LPARAM
BEGIN_PIN_PROFILER(CORProfilerTrackConditionalWeakTableElements());
pSec = (_UNCHECKED_OBJECTREF)HndGetHandleExtraInfo(handle);
g_profControlBlock.pProfInterface->ConditionalWeakTableElementReference(
- (BYTE*)*pRef,
- (BYTE*)pSec,
+ (uint8_t*)*pRef,
+ (uint8_t*)pSec,
pRef,
&pSC->pHeapId);
END_PIN_PROFILER();
@@ -552,7 +552,7 @@ void CALLBACK UpdatePointerPinned(_UNCHECKED_OBJECTREF *pObjRef, LPARAM *pExtraI
//----------------------------------------------------------------------------
// flags describing the handle types
-static const UINT s_rgTypeFlags[] =
+static const uint32_t s_rgTypeFlags[] =
{
HNDF_NORMAL, // HNDTYPE_WEAK_SHORT
HNDF_NORMAL, // HNDTYPE_WEAK_LONG
@@ -742,7 +742,7 @@ HandleTableBucket *Ref_CreateHandleTableBucket(ADIndex uADIndex)
walk = &g_HandleTableMap;
HandleTableMap *last = NULL;
- UINT offset = 0;
+ uint32_t offset = 0;
result = new HandleTableBucket;
result->pTable = NULL;
@@ -764,7 +764,7 @@ HandleTableBucket *Ref_CreateHandleTableBucket(ADIndex uADIndex)
for (;;) {
// Do we have free slot
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++) {
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++) {
if (walk->pBuckets[i] == 0) {
for (int uCPUindex=0; uCPUindex < n_slots; uCPUindex++)
HndSetHandleTableIndex(result->pTable[uCPUindex], i+offset);
@@ -860,7 +860,7 @@ int getSlotNumber(ScanContext* sc)
}
// <TODO> - reexpress as complete only like hndtable does now!!! -fmh</REVISIT_TODO>
-void Ref_EndSynchronousGC(UINT condemned, UINT maxgen)
+void Ref_EndSynchronousGC(uint32_t condemned, uint32_t maxgen)
{
LIMITED_METHOD_CONTRACT;
@@ -870,7 +870,7 @@ void Ref_EndSynchronousGC(UINT condemned, UINT maxgen)
// tell the table we finished a GC
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++) {
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++) {
HHANDLETABLE hTable = walk->pTable[i];
if (hTable)
HndNotifyGcCycleComplete(hTable, condemned, maxgen);
@@ -941,7 +941,7 @@ void SetDependentHandleSecondary(OBJECTHANDLE handle, OBJECTREF objref)
* N.B. This routine is not a macro since we do validation in RETAIL.
* We always validate the type here because it can come from external callers.
*/
-OBJECTHANDLE CreateVariableHandle(HHANDLETABLE hTable, OBJECTREF object, UINT type)
+OBJECTHANDLE CreateVariableHandle(HHANDLETABLE hTable, OBJECTREF object, uint32_t type)
{
WRAPPER_NO_CONTRACT;
@@ -962,11 +962,11 @@ OBJECTHANDLE CreateVariableHandle(HHANDLETABLE hTable, OBJECTREF object, UINT ty
*
* Retrieves the dynamic type of a variable-strength handle.
*/
-UINT GetVariableHandleType(OBJECTHANDLE handle)
+uint32_t GetVariableHandleType(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
- return (UINT)HndGetHandleExtraInfo(handle);
+ return (uint32_t)HndGetHandleExtraInfo(handle);
}
/*
@@ -977,7 +977,7 @@ UINT GetVariableHandleType(OBJECTHANDLE handle)
* N.B. This routine is not a macro since we do validation in RETAIL.
* We always validate the type here because it can come from external callers.
*/
-void UpdateVariableHandleType(OBJECTHANDLE handle, UINT type)
+void UpdateVariableHandleType(OBJECTHANDLE handle, uint32_t type)
{
WRAPPER_NO_CONTRACT;
@@ -1007,7 +1007,7 @@ void UpdateVariableHandleType(OBJECTHANDLE handle, UINT type)
* Changes the dynamic type of a variable-strength handle. Unlike UpdateVariableHandleType we assume that the
* types have already been validated.
*/
-UINT CompareExchangeVariableHandleType(OBJECTHANDLE handle, UINT oldType, UINT newType)
+uint32_t CompareExchangeVariableHandleType(OBJECTHANDLE handle, uint32_t oldType, uint32_t newType)
{
WRAPPER_NO_CONTRACT;
@@ -1015,7 +1015,7 @@ UINT CompareExchangeVariableHandleType(OBJECTHANDLE handle, UINT oldType, UINT n
_ASSERTE(IS_VALID_VHT_VALUE(oldType) && IS_VALID_VHT_VALUE(newType));
// attempt to store the type in the handle's extra info
- return (UINT)HndCompareExchangeHandleExtraInfo(handle, HNDTYPE_VARIABLE, (LPARAM)oldType, (LPARAM)newType);
+ return (uint32_t)HndCompareExchangeHandleExtraInfo(handle, HNDTYPE_VARIABLE, (LPARAM)oldType, (LPARAM)newType);
}
@@ -1025,17 +1025,17 @@ UINT CompareExchangeVariableHandleType(OBJECTHANDLE handle, UINT oldType, UINT n
* Convenience function for tracing variable-strength handles.
* Wraps HndScanHandlesForGC.
*/
-void TraceVariableHandles(HANDLESCANPROC pfnTrace, LPARAM lp1, LPARAM lp2, UINT uEnableMask, UINT condemned, UINT maxgen, UINT flags)
+void TraceVariableHandles(HANDLESCANPROC pfnTrace, LPARAM lp1, LPARAM lp2, uint32_t uEnableMask, uint32_t condemned, uint32_t maxgen, uint32_t flags)
{
WRAPPER_NO_CONTRACT;
// set up to scan variable handles with the specified mask and trace function
- UINT type = HNDTYPE_VARIABLE;
+ uint32_t type = HNDTYPE_VARIABLE;
struct VARSCANINFO info = { (LPARAM)uEnableMask, pfnTrace, lp2 };
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i++)
if (walk->pBuckets[i] != NULL)
{
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[getSlotNumber((ScanContext*) lp1)];
@@ -1060,17 +1060,17 @@ void TraceVariableHandles(HANDLESCANPROC pfnTrace, LPARAM lp1, LPARAM lp2, UINT
loop scan version of TraceVariableHandles for single-thread-managed Ref_* functions
should be kept in sync with the code above
*/
-void TraceVariableHandlesBySingleThread(HANDLESCANPROC pfnTrace, LPARAM lp1, LPARAM lp2, UINT uEnableMask, UINT condemned, UINT maxgen, UINT flags)
+void TraceVariableHandlesBySingleThread(HANDLESCANPROC pfnTrace, LPARAM lp1, LPARAM lp2, uint32_t uEnableMask, uint32_t condemned, uint32_t maxgen, uint32_t flags)
{
WRAPPER_NO_CONTRACT;
// set up to scan variable handles with the specified mask and trace function
- UINT type = HNDTYPE_VARIABLE;
+ uint32_t type = HNDTYPE_VARIABLE;
struct VARSCANINFO info = { (LPARAM)uEnableMask, pfnTrace, lp2 };
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
// this is the one of Ref_* function performed by single thread in MULTI_HEAPS case, so we need to loop through all HT of the bucket
@@ -1088,19 +1088,19 @@ void TraceVariableHandlesBySingleThread(HANDLESCANPROC pfnTrace, LPARAM lp1, LPA
//----------------------------------------------------------------------------
-void Ref_TracePinningRoots(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promote_func* fn)
+void Ref_TracePinningRoots(uint32_t condemned, uint32_t maxgen, ScanContext* sc, Ref_promote_func* fn)
{
WRAPPER_NO_CONTRACT;
LOG((LF_GC, LL_INFO10000, "Pinning referents of pinned handles in generation %u\n", condemned));
// pin objects pointed to by pinning handles
- UINT types[2] = {HNDTYPE_PINNED, HNDTYPE_ASYNCPINNED};
- UINT flags = sc->concurrent ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t types[2] = {HNDTYPE_PINNED, HNDTYPE_ASYNCPINNED};
+ uint32_t flags = sc->concurrent ? HNDGCF_ASYNC : HNDGCF_NORMAL;
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[getSlotNumber((ScanContext*) sc)];
@@ -1123,7 +1123,7 @@ void Ref_TracePinningRoots(UINT condemned, UINT maxgen, ScanContext* sc, Ref_pro
}
-void Ref_TraceNormalRoots(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promote_func* fn)
+void Ref_TraceNormalRoots(uint32_t condemned, uint32_t maxgen, ScanContext* sc, Ref_promote_func* fn)
{
WRAPPER_NO_CONTRACT;
@@ -1131,13 +1131,13 @@ void Ref_TraceNormalRoots(UINT condemned, UINT maxgen, ScanContext* sc, Ref_prom
// promote objects pointed to by strong handles
// during ephemeral GCs we also want to promote the ones pointed to by sizedref handles.
- UINT types[2] = {HNDTYPE_STRONG, HNDTYPE_SIZEDREF};
- UINT uTypeCount = (((condemned >= maxgen) && !GCHeap::GetGCHeap()->IsConcurrentGCInProgress()) ? 1 : _countof(types));
- UINT flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t types[2] = {HNDTYPE_STRONG, HNDTYPE_SIZEDREF};
+ uint32_t uTypeCount = (((condemned >= maxgen) && !GCHeap::GetGCHeap()->IsConcurrentGCInProgress()) ? 1 : _countof(types));
+ uint32_t flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[getSlotNumber(sc)];
@@ -1164,11 +1164,11 @@ void Ref_TraceNormalRoots(UINT condemned, UINT maxgen, ScanContext* sc, Ref_prom
if (!sc->concurrent)
{
// promote ref-counted handles
- UINT type = HNDTYPE_REFCOUNTED;
+ uint32_t type = HNDTYPE_REFCOUNTED;
walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[getSlotNumber(sc)];
@@ -1186,12 +1186,12 @@ void Ref_TraceNormalRoots(UINT condemned, UINT maxgen, ScanContext* sc, Ref_prom
void Ref_TraceRefCountHandles(HANDLESCANPROC callback, LPARAM lParam1, LPARAM lParam2)
{
int max_slots = getNumberOfSlots();
- UINT handleType = HNDTYPE_REFCOUNTED;
+ uint32_t handleType = HNDTYPE_REFCOUNTED;
HandleTableMap *walk = &g_HandleTableMap;
while (walk)
{
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i++)
{
if (walk->pBuckets[i] != NULL)
{
@@ -1211,14 +1211,14 @@ void Ref_TraceRefCountHandles(HANDLESCANPROC callback, LPARAM lParam1, LPARAM lP
-void Ref_CheckReachable(UINT condemned, UINT maxgen, LPARAM lp1)
+void Ref_CheckReachable(uint32_t condemned, uint32_t maxgen, LPARAM lp1)
{
WRAPPER_NO_CONTRACT;
LOG((LF_GC, LL_INFO10000, "Checking reachability of referents of long-weak handles in generation %u\n", condemned));
// these are the handle types that need to be checked
- UINT types[] =
+ uint32_t types[] =
{
HNDTYPE_WEAK_LONG,
#if defined(FEATURE_COMINTEROP) || defined(FEATURE_REDHAWK)
@@ -1227,12 +1227,12 @@ void Ref_CheckReachable(UINT condemned, UINT maxgen, LPARAM lp1)
};
// check objects pointed to by short weak handles
- UINT flags = (((ScanContext*) lp1)->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t flags = (((ScanContext*) lp1)->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
int uCPUindex = getSlotNumber((ScanContext*) lp1);
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
{
if (walk->pBuckets[i] != NULL)
{
@@ -1285,8 +1285,8 @@ DhContext *Ref_GetDependentHandleContext(ScanContext* sc)
bool Ref_ScanDependentHandlesForPromotion(DhContext *pDhContext)
{
LOG((LF_GC, LL_INFO10000, "Checking liveness of referents of dependent handles in generation %u\n", pDhContext->m_iCondemned));
- UINT type = HNDTYPE_DEPENDENT;
- UINT flags = (pDhContext->m_pScanContext->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t type = HNDTYPE_DEPENDENT;
+ uint32_t flags = (pDhContext->m_pScanContext->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
flags |= HNDGCF_EXTRAINFO;
// Keep a note of whether we promoted anything over the entire scan (not just the last iteration). We need
@@ -1312,7 +1312,7 @@ bool Ref_ScanDependentHandlesForPromotion(DhContext *pDhContext)
HandleTableMap *walk = &g_HandleTableMap;
while (walk)
{
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
{
if (walk->pBuckets[i] != NULL)
{
@@ -1343,17 +1343,17 @@ bool Ref_ScanDependentHandlesForPromotion(DhContext *pDhContext)
// Perform a scan of dependent handles for the purpose of clearing any that haven't had their primary
// promoted.
-void Ref_ScanDependentHandlesForClearing(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promote_func* fn)
+void Ref_ScanDependentHandlesForClearing(uint32_t condemned, uint32_t maxgen, ScanContext* sc, Ref_promote_func* fn)
{
LOG((LF_GC, LL_INFO10000, "Clearing dead dependent handles in generation %u\n", condemned));
- UINT type = HNDTYPE_DEPENDENT;
- UINT flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t type = HNDTYPE_DEPENDENT;
+ uint32_t flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
flags |= HNDGCF_EXTRAINFO;
HandleTableMap *walk = &g_HandleTableMap;
while (walk)
{
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
{
if (walk->pBuckets[i] != NULL)
{
@@ -1369,17 +1369,17 @@ void Ref_ScanDependentHandlesForClearing(UINT condemned, UINT maxgen, ScanContex
}
// Perform a scan of dependent handles for the purpose of updating handles to track relocated objects.
-void Ref_ScanDependentHandlesForRelocation(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promote_func* fn)
+void Ref_ScanDependentHandlesForRelocation(uint32_t condemned, uint32_t maxgen, ScanContext* sc, Ref_promote_func* fn)
{
LOG((LF_GC, LL_INFO10000, "Relocating moved dependent handles in generation %u\n", condemned));
- UINT type = HNDTYPE_DEPENDENT;
- UINT flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t type = HNDTYPE_DEPENDENT;
+ uint32_t flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
flags |= HNDGCF_EXTRAINFO;
HandleTableMap *walk = &g_HandleTableMap;
while (walk)
{
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
{
if (walk->pBuckets[i] != NULL)
{
@@ -1398,16 +1398,16 @@ void Ref_ScanDependentHandlesForRelocation(UINT condemned, UINT maxgen, ScanCont
loop scan version of TraceVariableHandles for single-thread-managed Ref_* functions
should be kept in sync with the code above
*/
-void TraceDependentHandlesBySingleThread(HANDLESCANPROC pfnTrace, LPARAM lp1, UINT condemned, UINT maxgen, UINT flags)
+void TraceDependentHandlesBySingleThread(HANDLESCANPROC pfnTrace, LPARAM lp1, uint32_t condemned, uint32_t maxgen, uint32_t flags)
{
WRAPPER_NO_CONTRACT;
// set up to scan variable handles with the specified mask and trace function
- UINT type = HNDTYPE_DEPENDENT;
+ uint32_t type = HNDTYPE_DEPENDENT;
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
// this is the one of Ref_* function performed by single thread in MULTI_HEAPS case, so we need to loop through all HT of the bucket
@@ -1429,21 +1429,21 @@ void TraceDependentHandlesBySingleThread(HANDLESCANPROC pfnTrace, LPARAM lp1, UI
// indices haven't been reused yet) and we could be scanning them in an unbalanced fashion.
// Consider using an array to represent the compacted form of all AD indices exist for the
// sized ref handles.
-void ScanSizedRefByAD(UINT maxgen, HANDLESCANPROC scanProc, ScanContext* sc, Ref_promote_func* fn, UINT flags)
+void ScanSizedRefByAD(uint32_t maxgen, HANDLESCANPROC scanProc, ScanContext* sc, Ref_promote_func* fn, uint32_t flags)
{
HandleTableMap *walk = &g_HandleTableMap;
- UINT type = HNDTYPE_SIZEDREF;
+ uint32_t type = HNDTYPE_SIZEDREF;
int uCPUindex = getSlotNumber(sc);
int n_slots = GCHeap::GetGCHeap()->GetNumberOfHeaps();
while (walk)
{
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
{
if (walk->pBuckets[i] != NULL)
{
ADIndex adIndex = HndGetHandleTableADIndex(walk->pBuckets[i]->pTable[0]);
- if ((adIndex.m_dwIndex % n_slots) == (DWORD)uCPUindex)
+ if ((adIndex.m_dwIndex % n_slots) == (uint32_t)uCPUindex)
{
for (int index = 0; index < n_slots; index++)
{
@@ -1466,15 +1466,15 @@ void ScanSizedRefByAD(UINT maxgen, HANDLESCANPROC scanProc, ScanContext* sc, Ref
}
}
-void ScanSizedRefByCPU(UINT maxgen, HANDLESCANPROC scanProc, ScanContext* sc, Ref_promote_func* fn, UINT flags)
+void ScanSizedRefByCPU(uint32_t maxgen, HANDLESCANPROC scanProc, ScanContext* sc, Ref_promote_func* fn, uint32_t flags)
{
HandleTableMap *walk = &g_HandleTableMap;
- UINT type = HNDTYPE_SIZEDREF;
+ uint32_t type = HNDTYPE_SIZEDREF;
int uCPUindex = getSlotNumber(sc);
while (walk)
{
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
{
if (walk->pBuckets[i] != NULL)
{
@@ -1496,36 +1496,36 @@ void ScanSizedRefByCPU(UINT maxgen, HANDLESCANPROC scanProc, ScanContext* sc, Re
}
}
-void Ref_ScanSizedRefHandles(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promote_func* fn)
+void Ref_ScanSizedRefHandles(uint32_t condemned, uint32_t maxgen, ScanContext* sc, Ref_promote_func* fn)
{
LOG((LF_GC, LL_INFO10000, "Scanning SizedRef handles to in generation %u\n", condemned));
_ASSERTE (condemned == maxgen);
- UINT flags = (sc->concurrent ? HNDGCF_ASYNC : HNDGCF_NORMAL) | HNDGCF_EXTRAINFO;
+ uint32_t flags = (sc->concurrent ? HNDGCF_ASYNC : HNDGCF_NORMAL) | HNDGCF_EXTRAINFO;
ScanSizedRefByCPU(maxgen, CalculateSizedRefSize, sc, fn, flags);
}
-void Ref_CheckAlive(UINT condemned, UINT maxgen, LPARAM lp1)
+void Ref_CheckAlive(uint32_t condemned, uint32_t maxgen, LPARAM lp1)
{
WRAPPER_NO_CONTRACT;
LOG((LF_GC, LL_INFO10000, "Checking liveness of referents of short-weak handles in generation %u\n", condemned));
// perform a multi-type scan that checks for unreachable objects
- UINT types[] =
+ uint32_t types[] =
{
HNDTYPE_WEAK_SHORT
#ifdef FEATURE_COMINTEROP
, HNDTYPE_WEAK_WINRT
#endif // FEATURE_COMINTEROP
};
- UINT flags = (((ScanContext*) lp1)->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t flags = (((ScanContext*) lp1)->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
int uCPUindex = getSlotNumber((ScanContext*) lp1);
HandleTableMap *walk = &g_HandleTableMap;
while (walk)
{
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
{
if (walk->pBuckets[i] != NULL)
{
@@ -1543,7 +1543,7 @@ void Ref_CheckAlive(UINT condemned, UINT maxgen, LPARAM lp1)
static VOLATILE(LONG) uCount = 0;
// NOTE: Please: if you update this function, update the very similar profiling function immediately below!!!
-void Ref_UpdatePointers(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promote_func* fn)
+void Ref_UpdatePointers(uint32_t condemned, uint32_t maxgen, ScanContext* sc, Ref_promote_func* fn)
{
WRAPPER_NO_CONTRACT;
@@ -1566,7 +1566,7 @@ void Ref_UpdatePointers(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promot
LOG((LF_GC, LL_INFO10000, "Updating pointers to referents of non-pinning handles in generation %u\n", condemned));
// these are the handle types that need their pointers updated
- UINT types[] =
+ uint32_t types[] =
{
HNDTYPE_WEAK_SHORT,
HNDTYPE_WEAK_LONG,
@@ -1581,11 +1581,11 @@ void Ref_UpdatePointers(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promot
};
// perform a multi-type scan that updates pointers
- UINT flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[getSlotNumber(sc)];
@@ -1602,7 +1602,7 @@ void Ref_UpdatePointers(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promot
#if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
// Please update this if you change the Ref_UpdatePointers function above.
-void Ref_ScanPointersForProfilerAndETW(UINT maxgen, LPARAM lp1)
+void Ref_ScanPointersForProfilerAndETW(uint32_t maxgen, LPARAM lp1)
{
WRAPPER_NO_CONTRACT;
@@ -1612,7 +1612,7 @@ void Ref_ScanPointersForProfilerAndETW(UINT maxgen, LPARAM lp1)
// <REVISIT_TODO>We should change the following to not report weak either
// these are the handle types that need their pointers updated</REVISIT_TODO>
- UINT types[] =
+ uint32_t types[] =
{
HNDTYPE_WEAK_SHORT,
HNDTYPE_WEAK_LONG,
@@ -1629,12 +1629,12 @@ void Ref_ScanPointersForProfilerAndETW(UINT maxgen, LPARAM lp1)
HNDTYPE_SIZEDREF,
};
- UINT flags = HNDGCF_NORMAL;
+ uint32_t flags = HNDGCF_NORMAL;
// perform a multi-type scan that updates pointers
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
// this is the one of Ref_* function performed by single thread in MULTI_HEAPS case, so we need to loop through all HT of the bucket
for (int uCPUindex=0; uCPUindex < getNumberOfSlots(); uCPUindex++)
@@ -1650,13 +1650,13 @@ void Ref_ScanPointersForProfilerAndETW(UINT maxgen, LPARAM lp1)
TraceVariableHandlesBySingleThread(&ScanPointerForProfilerAndETW, lp1, 0, VHT_WEAK_SHORT | VHT_WEAK_LONG | VHT_STRONG, maxgen, maxgen, flags);
}
-void Ref_ScanDependentHandlesForProfilerAndETW(UINT maxgen, ProfilingScanContext * SC)
+void Ref_ScanDependentHandlesForProfilerAndETW(uint32_t maxgen, ProfilingScanContext * SC)
{
WRAPPER_NO_CONTRACT;
LOG((LF_GC | LF_CORPROF, LL_INFO10000, "Scanning dependent handles for profiler.\n"));
- UINT flags = HNDGCF_NORMAL;
+ uint32_t flags = HNDGCF_NORMAL;
LPARAM lp1 = (LPARAM)SC;
// we'll re-use pHeapId (which was either unused (0) or freed by EndRootReferences2
@@ -1669,19 +1669,19 @@ void Ref_ScanDependentHandlesForProfilerAndETW(UINT maxgen, ProfilingScanContext
#endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
-void Ref_UpdatePinnedPointers(UINT condemned, UINT maxgen, ScanContext* sc, Ref_promote_func* fn)
+void Ref_UpdatePinnedPointers(uint32_t condemned, uint32_t maxgen, ScanContext* sc, Ref_promote_func* fn)
{
WRAPPER_NO_CONTRACT;
LOG((LF_GC, LL_INFO10000, "Updating pointers to referents of pinning handles in generation %u\n", condemned));
// these are the handle types that need their pointers updated
- UINT types[2] = {HNDTYPE_PINNED, HNDTYPE_ASYNCPINNED};
- UINT flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
+ uint32_t types[2] = {HNDTYPE_PINNED, HNDTYPE_ASYNCPINNED};
+ uint32_t flags = (sc->concurrent) ? HNDGCF_ASYNC : HNDGCF_NORMAL;
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[getSlotNumber(sc)];
@@ -1696,14 +1696,14 @@ void Ref_UpdatePinnedPointers(UINT condemned, UINT maxgen, ScanContext* sc, Ref_
}
-void Ref_AgeHandles(UINT condemned, UINT maxgen, LPARAM lp1)
+void Ref_AgeHandles(uint32_t condemned, uint32_t maxgen, LPARAM lp1)
{
WRAPPER_NO_CONTRACT;
LOG((LF_GC, LL_INFO10000, "Aging handles in generation %u\n", condemned));
// these are the handle types that need their ages updated
- UINT types[] =
+ uint32_t types[] =
{
HNDTYPE_WEAK_SHORT,
HNDTYPE_WEAK_LONG,
@@ -1726,7 +1726,7 @@ void Ref_AgeHandles(UINT condemned, UINT maxgen, LPARAM lp1)
// perform a multi-type scan that ages the handles
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[uCPUindex];
@@ -1738,14 +1738,14 @@ void Ref_AgeHandles(UINT condemned, UINT maxgen, LPARAM lp1)
}
-void Ref_RejuvenateHandles(UINT condemned, UINT maxgen, LPARAM lp1)
+void Ref_RejuvenateHandles(uint32_t condemned, uint32_t maxgen, LPARAM lp1)
{
WRAPPER_NO_CONTRACT;
LOG((LF_GC, LL_INFO10000, "Rejuvenating handles.\n"));
// these are the handle types that need their ages updated
- UINT types[] =
+ uint32_t types[] =
{
HNDTYPE_WEAK_SHORT,
HNDTYPE_WEAK_LONG,
@@ -1769,7 +1769,7 @@ void Ref_RejuvenateHandles(UINT condemned, UINT maxgen, LPARAM lp1)
// reset the ages of these handles
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
if (walk->pBuckets[i] != NULL)
{
HHANDLETABLE hTable = walk->pBuckets[i]->pTable[uCPUindex];
@@ -1780,14 +1780,14 @@ void Ref_RejuvenateHandles(UINT condemned, UINT maxgen, LPARAM lp1)
}
}
-void Ref_VerifyHandleTable(UINT condemned, UINT maxgen, ScanContext* sc)
+void Ref_VerifyHandleTable(uint32_t condemned, uint32_t maxgen, ScanContext* sc)
{
WRAPPER_NO_CONTRACT;
LOG((LF_GC, LL_INFO10000, "Verifying handles.\n"));
// these are the handle types that need to be verified
- UINT types[] =
+ uint32_t types[] =
{
HNDTYPE_WEAK_SHORT,
HNDTYPE_WEAK_LONG,
@@ -1812,7 +1812,7 @@ void Ref_VerifyHandleTable(UINT condemned, UINT maxgen, ScanContext* sc)
HandleTableMap *walk = &g_HandleTableMap;
while (walk)
{
- for (UINT i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
+ for (uint32_t i = 0; i < INITIAL_HANDLE_TABLE_ARRAY_SIZE; i ++)
{
if (walk->pBuckets[i] != NULL)
{