Skip to content

Commit e4e4cb6

Browse files
authored
Cleanup in NativeAOT from x86 attempt (#63182)
This is retrofitting parts of dotnet/runtimelab#1531
1 parent e731299 commit e4e4cb6

File tree

7 files changed

+13
-8
lines changed

7 files changed

+13
-8
lines changed

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/InternalCalls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ internal static extern unsafe bool RhpCallFilterFunclet(
298298
internal static extern void RhpReleaseCastCacheLock();
299299

300300
[DllImport(Redhawk.BaseName, CallingConvention = CallingConvention.Cdecl)]
301-
internal static extern ulong PalGetTickCount64();
301+
internal static extern ulong RhpGetTickCount64();
302302

303303
[DllImport(Redhawk.BaseName, CallingConvention = CallingConvention.Cdecl)]
304304
internal static extern void RhpAcquireThunkPoolLock();

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ private static class CastCache
997997
//
998998
private static Entry[] s_cache = new Entry[InitialCacheSize]; // Initialize the cache eagerly to avoid null checks.
999999
private static UnsafeGCHandle s_previousCache;
1000-
private static ulong s_tickCountOfLastOverflow = InternalCalls.PalGetTickCount64();
1000+
private static ulong s_tickCountOfLastOverflow = InternalCalls.RhpGetTickCount64();
10011001
private static int s_entries;
10021002
private static bool s_roundRobinFlushing;
10031003

@@ -1195,7 +1195,7 @@ private static Entry[] ResizeCacheForNewEntryAsNecessary()
11951195
s_entries = 0;
11961196

11971197
// See how long it has been since the last time the cache was overflowing
1198-
ulong tickCount = InternalCalls.PalGetTickCount64();
1198+
ulong tickCount = InternalCalls.RhpGetTickCount64();
11991199
int tickCountSinceLastOverflow = (int)(tickCount - s_tickCountOfLastOverflow);
12001200
s_tickCountOfLastOverflow = tickCount;
12011201

src/coreclr/nativeaot/Runtime/MiscHelpers.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ EXTERN_C REDHAWK_API void __cdecl RhpReleaseThunkPoolLock()
382382
g_ThunkPoolLock.Leave();
383383
}
384384

385+
EXTERN_C REDHAWK_API void __cdecl RhpGetTickCount64()
386+
{
387+
PalGetTickCount64();
388+
}
389+
385390
EXTERN_C int32_t __cdecl RhpCalculateStackTraceWorker(void* pOutputBuffer, uint32_t outputBufferLength, void* pAddressInCurrentFrame);
386391

387392
EXTERN_C REDHAWK_API int32_t __cdecl RhpGetCurrentThreadStackTrace(void* pOutputBuffer, uint32_t outputBufferLength, void* pAddressInCurrentFrame)

src/coreclr/nativeaot/Runtime/gcrhenv.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ bool GCToEEInterface::GetBooleanConfigValue(const char* privateKey, const char*
14781478
#ifdef UNICODE
14791479
size_t keyLength = strlen(privateKey) + 1;
14801480
TCHAR* pKey = (TCHAR*)_alloca(sizeof(TCHAR) * keyLength);
1481-
for (int i = 0; i < keyLength; i++)
1481+
for (size_t i = 0; i < keyLength; i++)
14821482
pKey[i] = privateKey[i];
14831483
#else
14841484
const TCHAR* pKey = privateKey;
@@ -1497,7 +1497,7 @@ bool GCToEEInterface::GetIntConfigValue(const char* privateKey, const char* publ
14971497
#ifdef UNICODE
14981498
size_t keyLength = strlen(privateKey) + 1;
14991499
TCHAR* pKey = (TCHAR*)_alloca(sizeof(TCHAR) * keyLength);
1500-
for (int i = 0; i < keyLength; i++)
1500+
for (size_t i = 0; i < keyLength; i++)
15011501
pKey[i] = privateKey[i];
15021502
#else
15031503
const TCHAR* pKey = privateKey;

src/coreclr/nativeaot/Runtime/windows/PalRedhawkCommon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ REDHAWK_PALEXPORT int32_t PalGetModuleFileName(_Out_ const TCHAR** pModuleNameOu
172172
return 0;
173173
}
174174

175-
REDHAWK_PALEXPORT uint64_t __cdecl PalGetTickCount64()
175+
REDHAWK_PALEXPORT uint64_t REDHAWK_PALAPI PalGetTickCount64()
176176
{
177177
return GetTickCount64();
178178
}

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Environment.CoreRT.Unix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,6 @@ static unsafe bool ParseEntry(IntPtr current, out string? key, out string? value
167167
[DoesNotReturn]
168168
private static void ExitRaw() => Interop.Sys.Exit(s_latchedExitCode);
169169

170-
public static long TickCount64 => (long)RuntimeImports.PalGetTickCount64();
170+
public static long TickCount64 => (long)RuntimeImports.RhpGetTickCount64();
171171
}
172172
}

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static class RuntimeImports
2828

2929
[DllImport(RuntimeLibrary, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
3030
[SuppressGCTransition]
31-
internal static extern ulong PalGetTickCount64();
31+
internal static extern ulong RhpGetTickCount64();
3232

3333
[DllImport(RuntimeLibrary, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
3434
internal static extern IntPtr RhpGetCurrentThread();

0 commit comments

Comments
 (0)