summaryrefslogtreecommitdiff
path: root/src/vm/comutilnative.cpp
diff options
context:
space:
mode:
authorFilip Navara <filip.navara@gmail.com>2019-01-22 13:16:45 +0100
committerJan Kotas <jkotas@microsoft.com>2019-01-22 04:16:45 -0800
commit635a609eba8db8082a4e1245ce1291f9bbe9835c (patch)
treebdd9ab76b9528377ee506e22e2684306f84c63d1 /src/vm/comutilnative.cpp
parent61ff7397e849273bafc8b1e46ec88ddd905ce187 (diff)
downloadcoreclr-635a609eba8db8082a4e1245ce1291f9bbe9835c.tar.gz
coreclr-635a609eba8db8082a4e1245ce1291f9bbe9835c.tar.bz2
coreclr-635a609eba8db8082a4e1245ce1291f9bbe9835c.zip
Move MemoryFailPoint to shared CoreLib partition (#22104)
* Move MemoryFailPoint to shared CoreLib partition. * Split MemoryFailPoint into Unix and Windows versions. * Replace MemoryFailPoint.GetMemorySettings FCall with GC.GetSegmentSize to make sharing with CoreRT easier.
Diffstat (limited to 'src/vm/comutilnative.cpp')
-rw-r--r--src/vm/comutilnative.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp
index 7ca48ffc59..56408c5f70 100644
--- a/src/vm/comutilnative.cpp
+++ b/src/vm/comutilnative.cpp
@@ -1034,6 +1034,26 @@ FCIMPL1(int, GCInterface::GetGeneration, Object* objUNSAFE)
}
FCIMPLEND
+/*================================GetSegmentSize========-=======================
+**Action: Returns the maximum GC heap segment size
+**Returns: The maximum segment size of either the normal heap or the large object heap, whichever is bigger
+==============================================================================*/
+FCIMPL0(UINT64, GCInterface::GetSegmentSize)
+{
+ FCALL_CONTRACT;
+
+ IGCHeap * pGC = GCHeapUtilities::GetGCHeap();
+ size_t segment_size = pGC->GetValidSegmentSize(false);
+ size_t large_segment_size = pGC->GetValidSegmentSize(true);
+ _ASSERTE(segment_size < SIZE_T_MAX && large_segment_size < SIZE_T_MAX);
+ if (segment_size < large_segment_size)
+ segment_size = large_segment_size;
+
+ FC_GC_POLL_RET();
+ return (UINT64) segment_size;
+}
+FCIMPLEND
+
/*================================CollectionCount=================================
**Action: Returns the number of collections for this generation since the begining of the life of the process
**Returns: The collection count.