Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 2d944f9

Browse files
authored
GC update from CoreRT (#6487)
https://github.com/dotnet/corert/tree/master/src/Native/gc 35d3eefeb4d14193433a103411526fa869321a82
1 parent 50d9704 commit 2d944f9

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

src/gc/env/gcenv.os.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ class GCToOSInterface
240240
// specified, it returns amount of actual physical memory.
241241
static uint64_t GetPhysicalMemoryLimit();
242242

243-
// Get global memory status
243+
// Get memory status
244244
// Parameters:
245-
// memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory
245+
// memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory
246246
// that is in use (0 indicates no memory use and 100 indicates full memory use).
247247
// available_physical - The amount of physical memory currently available, in bytes.
248248
// available_page_file - The maximum amount of memory the current process can commit, in bytes.

src/gc/sample/gcenv.windows.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include "gcenv.h"
1414
#include "gc.h"
1515

16-
static LARGE_INTEGER performanceFrequency;
17-
1816
MethodTable * g_pFreeObjectMethodTable;
1917

2018
int32_t g_TrapReturningThreads;
@@ -23,12 +21,14 @@ bool g_fFinalizerRunOnShutDown;
2321

2422
GCSystemInfo g_SystemInfo;
2523

24+
static LARGE_INTEGER g_performanceFrequency;
25+
2626
// Initialize the interface implementation
2727
// Return:
2828
// true if it has succeeded, false if it has failed
2929
bool GCToOSInterface::Initialize()
3030
{
31-
if (!::QueryPerformanceFrequency(&performanceFrequency))
31+
if (!::QueryPerformanceFrequency(&g_performanceFrequency))
3232
{
3333
return false;
3434
}
@@ -310,9 +310,12 @@ uint64_t GCToOSInterface::GetPhysicalMemoryLimit()
310310
return memStatus.ullTotalPhys;
311311
}
312312

313-
// Get global memory status
313+
// Get memory status
314314
// Parameters:
315-
// ms - pointer to the structure that will be filled in with the memory status
315+
// memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory
316+
// that is in use (0 indicates no memory use and 100 indicates full memory use).
317+
// available_physical - The amount of physical memory currently available, in bytes.
318+
// available_page_file - The maximum amount of memory the current process can commit, in bytes.
316319
void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available_physical, uint64_t* available_page_file)
317320
{
318321
MEMORYSTATUSEX memStatus;
@@ -356,14 +359,7 @@ int64_t GCToOSInterface::QueryPerformanceCounter()
356359
// The counter frequency
357360
int64_t GCToOSInterface::QueryPerformanceFrequency()
358361
{
359-
LARGE_INTEGER frequency;
360-
if (!::QueryPerformanceFrequency(&frequency))
361-
{
362-
_ASSERTE(!"Fatal Error - cannot query performance counter.");
363-
abort();
364-
}
365-
366-
return frequency.QuadPart;
362+
return g_performanceFrequency.QuadPart;
367363
}
368364

369365
// Get a time stamp with a low precision

src/vm/gcenv.os.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,14 @@ uint64_t GCToOSInterface::GetPhysicalMemoryLimit()
534534
return memStatus.ullTotalPhys;
535535
}
536536

537-
// Get global memory status
537+
// Get memory status
538538
// Parameters:
539-
// ms - pointer to the structure that will be filled in with the memory status
539+
// memory_load - A number between 0 and 100 that specifies the approximate percentage of physical memory
540+
// that is in use (0 indicates no memory use and 100 indicates full memory use).
541+
// available_physical - The amount of physical memory currently available, in bytes.
542+
// available_page_file - The maximum amount of memory the current process can commit, in bytes.
543+
// Remarks:
544+
// Any parameter can be null.
540545
void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available_physical, uint64_t* available_page_file)
541546
{
542547
LIMITED_METHOD_CONTRACT;

0 commit comments

Comments
 (0)