Skip to content

Commit 00da830

Browse files
FB
1 parent 5fc2ae7 commit 00da830

17 files changed

+438
-449
lines changed

src/coreclr/inc/daccess.h

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,27 +2368,17 @@ inline type* DacUnsafeMarshalSingleElement( ArrayDPTR(type) arrayPtr )
23682368
//
23692369
//----------------------------------------------------------------------------
23702370

2371-
typedef DPTR(size_t) PTR_size_t;
2372-
#ifdef NATIVEAOT
2373-
typedef DPTR(int8_t) PTR_Int8;
2374-
typedef DPTR(int16_t) PTR_Int16;
2375-
typedef DPTR(int32_t) PTR_Int32;
2376-
typedef DPTR(int64_t) PTR_Int64;
2377-
typedef ArrayDPTR(uint8_t) PTR_UInt8;
2378-
typedef DPTR(PTR_UInt8) PTR_PTR_UInt8;
2379-
typedef DPTR(PTR_PTR_UInt8) PTR_PTR_PTR_UInt8;
2380-
typedef DPTR(uint16_t) PTR_UInt16;
2381-
typedef DPTR(uint32_t) PTR_UInt32;
2382-
typedef DPTR(uint64_t) PTR_UInt64;
2383-
typedef DPTR(uintptr_t) PTR_UIntNative;
2384-
typedef uint8_t Code;
2385-
typedef DPTR(Code) PTR_Code;
2386-
typedef DPTR(PTR_Code) PTR_PTR_Code;
2387-
#else
2388-
typedef ArrayDPTR(BYTE) PTR_BYTE;
2371+
typedef DPTR(size_t) PTR_size_t;
23892372
typedef ArrayDPTR(uint8_t) PTR_uint8_t;
2373+
typedef DPTR(PTR_uint8_t) PTR_PTR_uint8_t;
2374+
typedef DPTR(int32_t) PTR_int32_t;
2375+
typedef DPTR(uint32_t) PTR_uint32_t;
2376+
typedef DPTR(uint64_t) PTR_uint64_t;
2377+
typedef DPTR(uintptr_t) PTR_uintptr_t;
2378+
2379+
#ifndef NATIVEAOT
2380+
typedef ArrayDPTR(BYTE) PTR_BYTE;
23902381
typedef DPTR(PTR_BYTE) PTR_PTR_BYTE;
2391-
typedef DPTR(PTR_uint8_t) PTR_PTR_uint8_t;
23922382
typedef DPTR(PTR_PTR_BYTE) PTR_PTR_PTR_BYTE;
23932383
typedef ArrayDPTR(signed char) PTR_SBYTE;
23942384
typedef ArrayDPTR(const BYTE) PTR_CBYTE;
@@ -2398,7 +2388,6 @@ typedef DPTR(UINT16) PTR_UINT16;
23982388
typedef DPTR(WORD) PTR_WORD;
23992389
typedef DPTR(USHORT) PTR_USHORT;
24002390
typedef DPTR(DWORD) PTR_DWORD;
2401-
typedef DPTR(uint32_t) PTR_uint32_t;
24022391
typedef DPTR(LONG) PTR_LONG;
24032392
typedef DPTR(ULONG) PTR_ULONG;
24042393
typedef DPTR(INT32) PTR_INT32;

src/coreclr/nativeaot/Runtime/CachedInterfaceDispatch.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ bool InitializeInterfaceDispatch()
445445
return true;
446446
}
447447

448-
COOP_PINVOKE_HELPER(PTR_Code, RhpUpdateDispatchCellCache, (InterfaceDispatchCell * pCell, PTR_Code pTargetCode, MethodTable* pInstanceType, DispatchCellInfo *pNewCellInfo))
448+
COOP_PINVOKE_HELPER(PCODE, RhpUpdateDispatchCellCache, (InterfaceDispatchCell * pCell, PCODE pTargetCode, MethodTable* pInstanceType, DispatchCellInfo *pNewCellInfo))
449449
{
450450
// Attempt to update the cache with this new mapping (if we have any cache at all, the initial state
451451
// is none).
@@ -458,8 +458,8 @@ COOP_PINVOKE_HELPER(PTR_Code, RhpUpdateDispatchCellCache, (InterfaceDispatchCell
458458
{
459459
if (pCacheEntry->m_pInstanceType == NULL)
460460
{
461-
if (UpdateCacheEntryAtomically(pCacheEntry, pInstanceType, pTargetCode))
462-
return (PTR_Code)pTargetCode;
461+
if (UpdateCacheEntryAtomically(pCacheEntry, pInstanceType, dac_cast<PTR_VOID>(pTargetCode)))
462+
return (PCODE)pTargetCode;
463463
}
464464
}
465465

@@ -479,7 +479,7 @@ COOP_PINVOKE_HELPER(PTR_Code, RhpUpdateDispatchCellCache, (InterfaceDispatchCell
479479
// but it's not clear whether we should do this or re-tune the cache max size, we need to measure
480480
// this.
481481
CID_COUNTER_INC(CacheSizeOverflows);
482-
return (PTR_Code)pTargetCode;
482+
return (PCODE)pTargetCode;
483483
}
484484

485485
uint32_t cNewCacheEntries = cOldCacheEntries ? cOldCacheEntries * 2 : 1;
@@ -488,7 +488,7 @@ COOP_PINVOKE_HELPER(PTR_Code, RhpUpdateDispatchCellCache, (InterfaceDispatchCell
488488
if (newCacheValue == 0)
489489
{
490490
CID_COUNTER_INC(CacheOutOfMemory);
491-
return (PTR_Code)pTargetCode;
491+
return (PCODE)pTargetCode;
492492
}
493493

494494
if (InterfaceDispatchCell::IsCache(newCacheValue))
@@ -513,10 +513,10 @@ COOP_PINVOKE_HELPER(PTR_Code, RhpUpdateDispatchCellCache, (InterfaceDispatchCell
513513
if (pDiscardedCache)
514514
DiscardCache(pDiscardedCache);
515515

516-
return (PTR_Code)pTargetCode;
516+
return (PCODE)pTargetCode;
517517
}
518518

519-
COOP_PINVOKE_HELPER(PTR_Code, RhpSearchDispatchCellCache, (InterfaceDispatchCell * pCell, MethodTable* pInstanceType))
519+
COOP_PINVOKE_HELPER(PCODE, RhpSearchDispatchCellCache, (InterfaceDispatchCell * pCell, MethodTable* pInstanceType))
520520
{
521521
// This function must be implemented in native code so that we do not take a GC while walking the cache
522522
InterfaceDispatchCache * pCache = (InterfaceDispatchCache*)pCell->GetCache();
@@ -525,10 +525,10 @@ COOP_PINVOKE_HELPER(PTR_Code, RhpSearchDispatchCellCache, (InterfaceDispatchCell
525525
InterfaceDispatchCacheEntry * pCacheEntry = pCache->m_rgEntries;
526526
for (uint32_t i = 0; i < pCache->m_cEntries; i++, pCacheEntry++)
527527
if (pCacheEntry->m_pInstanceType == pInstanceType)
528-
return (PTR_Code)pCacheEntry->m_pTargetCode;
528+
return pCacheEntry->m_pTargetCode;
529529
}
530530

531-
return nullptr;
531+
return (PCODE)nullptr;
532532
}
533533

534534
// Given a dispatch cell, get the type and slot associated with it. This function MUST be implemented

src/coreclr/nativeaot/Runtime/CachedInterfaceDispatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ void ReclaimUnusedInterfaceDispatchCaches();
1818
struct InterfaceDispatchCacheEntry
1919
{
2020
MethodTable * m_pInstanceType; // Potential type of the object instance being dispatched on
21-
void * m_pTargetCode; // Method to dispatch to if the actual instance type matches the above
21+
PCODE m_pTargetCode; // Method to dispatch to if the actual instance type matches the above
2222
};
2323

2424
// The interface dispatch cache itself. As well as the entries we include the cache size (since logic such as

src/coreclr/nativeaot/Runtime/GcEnum.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static void GcEnumObjectsConservatively(PTR_PTR_Object ppLowerBound, PTR_PTR_Obj
5151
// Only report values that lie in the GC heap range. This doesn't conclusively guarantee that the
5252
// value is a GC heap reference but it's a cheap check that weeds out a lot of spurious values.
5353
PTR_Object pObj = *ppObj;
54-
if (((PTR_UInt8)pObj >= g_lowest_address) && ((PTR_UInt8)pObj <= g_highest_address))
54+
if (((PTR_uint8_t)pObj >= g_lowest_address) && ((PTR_uint8_t)pObj <= g_highest_address))
5555
PromoteCarefully(ppObj, GC_CALL_INTERIOR | GC_CALL_PINNED, fnGcEnumRef, pSc);
5656
}
5757
}
@@ -104,7 +104,7 @@ void EnumGcRefConservatively(PTR_OBJECTREF pRef, ScanFunc* fnGcEnumRef, ScanCont
104104
// Only report values that lie in the GC heap range. This doesn't conclusively guarantee that the
105105
// value is a GC heap reference but it's a cheap check that weeds out a lot of spurious values.
106106
PTR_Object pObj = *pRef;
107-
if (((PTR_UInt8)pObj >= g_lowest_address) && ((PTR_UInt8)pObj <= g_highest_address))
107+
if (((PTR_uint8_t)pObj >= g_lowest_address) && ((PTR_uint8_t)pObj <= g_highest_address))
108108
PromoteCarefully(pRef, GC_CALL_INTERIOR | GC_CALL_PINNED, fnGcEnumRef, pSc);
109109
}
110110
}

src/coreclr/nativeaot/Runtime/RuntimeInstance.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ COOP_PINVOKE_HELPER(uint8_t *, RhFindMethodStartAddress, (void * codeAddr))
7373
#endif
7474
}
7575

76-
PTR_UInt8 RuntimeInstance::FindMethodStartAddress(PTR_VOID ControlPC)
76+
PTR_uint8_t RuntimeInstance::FindMethodStartAddress(PTR_VOID ControlPC)
7777
{
7878
ICodeManager * pCodeManager = GetCodeManagerForAddress(ControlPC);
7979
MethodInfo methodInfo;
8080
if (pCodeManager != NULL && pCodeManager->FindMethodInfo(ControlPC, &methodInfo))
8181
{
82-
return (PTR_UInt8)pCodeManager->GetMethodStartAddress(&methodInfo);
82+
return (PTR_uint8_t)pCodeManager->GetMethodStartAddress(&methodInfo);
8383
}
8484

8585
return NULL;
@@ -139,18 +139,18 @@ void * RuntimeInstance::GetClasslibFunctionFromCodeAddress(PTR_VOID address, Cla
139139

140140
#endif // DACCESS_COMPILE
141141

142-
PTR_UInt8 RuntimeInstance::GetTargetOfUnboxingAndInstantiatingStub(PTR_VOID ControlPC)
142+
PTR_uint8_t RuntimeInstance::GetTargetOfUnboxingAndInstantiatingStub(PTR_VOID ControlPC)
143143
{
144144
ICodeManager * pCodeManager = GetCodeManagerForAddress(ControlPC);
145145
if (pCodeManager != NULL)
146146
{
147-
PTR_UInt8 pData = (PTR_UInt8)pCodeManager->GetAssociatedData(ControlPC);
147+
PTR_uint8_t pData = (PTR_uint8_t)pCodeManager->GetAssociatedData(ControlPC);
148148
if (pData != NULL)
149149
{
150150
uint8_t flags = *pData++;
151151

152152
if ((flags & (uint8_t)AssociatedDataFlags::HasUnboxingStubTarget) != 0)
153-
return pData + *dac_cast<PTR_Int32>(pData);
153+
return pData + *dac_cast<PTR_int32_t>(pData);
154154
}
155155
}
156156

src/coreclr/nativeaot/Runtime/RuntimeInstance.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ class RuntimeInstance
8787
ThreadStore * GetThreadStore();
8888
HANDLE GetPalInstance();
8989

90-
PTR_UInt8 FindMethodStartAddress(PTR_VOID ControlPC);
91-
PTR_UInt8 GetTargetOfUnboxingAndInstantiatingStub(PTR_VOID ControlPC);
90+
PTR_uint8_t FindMethodStartAddress(PTR_VOID ControlPC);
91+
PTR_uint8_t GetTargetOfUnboxingAndInstantiatingStub(PTR_VOID ControlPC);
9292
void EnableConservativeStackReporting();
9393
bool IsConservativeStackReportingEnabled() { return m_conservativeStackReportingEnabled; }
9494

0 commit comments

Comments
 (0)