Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/coreclr/gc/env/gcenv.base.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ inline HRESULT HRESULT_FROM_WIN32(unsigned long x)
#define CLR_E_GC_BAD_AFFINITY_CONFIG_FORMAT 0x8013200B
#define CLR_E_GC_BAD_HARD_LIMIT 0x8013200D
#define CLR_E_GC_LARGE_PAGE_MISSING_HARD_LIMIT 0x8013200E
#define CLR_E_GC_BAD_REGION_SIZE 0x8013200F

#define NOERROR 0x0
#define ERROR_TIMEOUT 1460
Expand Down
14 changes: 10 additions & 4 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31666,8 +31666,8 @@ bool gc_heap::should_sweep_in_plan (heap_segment* region)
size_t basic_region_size = (size_t)1 << min_segment_size_shr;
assert (heap_segment_gen_num (region) == heap_segment_plan_gen_num (region));

int surv_ratio = (int)(((double)heap_segment_survived (region) * 100.0) / (double)basic_region_size);
dprintf (2222, ("SSIP: region %Ix surv %Id / %Id = %d%%(%d)",
uint8_t surv_ratio = (uint8_t)(((double)heap_segment_survived (region) * 100.0) / (double)basic_region_size);
dprintf (2222, ("SSIP: region %p surv %hu / %zd = %d%%(%d)",
heap_segment_mem (region),
heap_segment_survived (region),
basic_region_size,
Expand Down Expand Up @@ -45286,8 +45286,14 @@ HRESULT GCHeap::Initialize()
gc_heap::enable_special_regions_p = (bool)GCConfig::GetGCEnableSpecialRegions();
size_t gc_region_size = (size_t)GCConfig::GetGCRegionSize();

// Adjust GCRegionSize based on how large each heap would be, for smaller heaps we would
// like to keep Region sizes small. We choose between 4, 2 and 1mb based on the calculations
// Constraining the size of region size to be < 2 GB.
if (gc_region_size >= MAX_REGION_SIZE)
{
return CLR_E_GC_BAD_REGION_SIZE;
}

// Adjust GCRegionSize based on how large each heap would be, for smaller heaps we would
// like to keep Region sizes small. We choose between 4, 2 and 1mb based on the calculations
// below (unless its configured explictly) such that there are at least 2 regions available
// except for the smallest case. Now the lowest limit possible is 4mb.
if (gc_region_size == 0)
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ void GCLogConfig (const char *fmt, ... );

#define MAX_NUM_BUCKETS (MAX_INDEX_POWER2 - MIN_INDEX_POWER2 + 1)

#ifdef USE_REGIONS
#define MAX_REGION_SIZE 0x80000000
#endif // USE_REGIONS

#define MAX_NUM_FREE_SPACES 200
#define MIN_NUM_FREE_SPACES 5

Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/inc/corerror.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,12 @@
<Comment>During a GC initialization, GC large page support requires hard limit settings.</Comment>
</HRESULT>

<HRESULT NumericValue="0x8013200F">
<SymbolicName>CLR_E_GC_BAD_REGION_SIZE</SymbolicName>
<Message>"GC Region Size must be less than 2GB."</Message>
<Comment>During a GC initialization, GC Region Size must be less than 2GB.</Comment>
</HRESULT>

<HRESULT NumericValue="E_ACCESSDENIED">
<SymbolicName>COR_E_UNAUTHORIZEDACCESS</SymbolicName>
<Comment> 0x80070005 // Access is denied.</Comment>
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/pal/prebuilt/corerror/mscorurt.rc
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,6 @@ BEGIN
MSG_FOR_URT_HR(CLR_E_GC_BAD_AFFINITY_CONFIG_FORMAT) "GCHeapAffinitizeRanges configuration string has invalid format."
MSG_FOR_URT_HR(CLR_E_GC_BAD_HARD_LIMIT) "GC heap hard limit configuration is invalid."
MSG_FOR_URT_HR(CLR_E_GC_LARGE_PAGE_MISSING_HARD_LIMIT) "GC large page support requires hard limit settings."
MSG_FOR_URT_HR(CLR_E_GC_BAD_REGION_SIZE) "GC Region Size must be less than 2GB."
MSG_FOR_URT_HR(COR_E_BADIMAGEFORMAT) "The format of a DLL or executable being loaded is invalid."
END
1 change: 1 addition & 0 deletions src/coreclr/pal/prebuilt/inc/corerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@
#define CLR_E_GC_BAD_AFFINITY_CONFIG_FORMAT EMAKEHR(0x200b)
#define CLR_E_GC_BAD_HARD_LIMIT EMAKEHR(0x200d)
#define CLR_E_GC_LARGE_PAGE_MISSING_HARD_LIMIT EMAKEHR(0x200e)
#define CLR_E_GC_BAD_REGION_SIZE EMAKEHR(0x200f)
#define COR_E_UNAUTHORIZEDACCESS E_ACCESSDENIED
#define COR_E_ARGUMENT E_INVALIDARG
#define COR_E_INVALIDCAST E_NOINTERFACE
Expand Down