@@ -23106,15 +23106,15 @@ void gc_heap::sync_promoted_bytes()
23106
23106
total_old_card_surv += g_heaps[hp_idx]->old_card_survived_per_region[region_index];
23107
23107
}
23108
23108
23109
- heap_segment_survived (current_region) = (int) total_surv;
23109
+ heap_segment_survived (current_region) = total_surv;
23110
23110
heap_segment_old_card_survived (current_region) = (int)total_old_card_surv;
23111
23111
#else
23112
- heap_segment_survived (current_region) = (int)( survived_per_region[region_index]) ;
23112
+ heap_segment_survived (current_region) = survived_per_region[region_index];
23113
23113
heap_segment_old_card_survived (current_region) =
23114
23114
(int)(old_card_survived_per_region[region_index]);
23115
23115
#endif //MULTIPLE_HEAPS
23116
23116
23117
- dprintf (REGIONS_LOG, ("region #%zd %p surv %d , old card surv %d",
23117
+ dprintf (REGIONS_LOG, ("region #%zd %p surv %zd , old card surv %d",
23118
23118
region_index,
23119
23119
heap_segment_mem (current_region),
23120
23120
heap_segment_survived (current_region),
@@ -23308,8 +23308,8 @@ void gc_heap::equalize_promoted_bytes()
23308
23308
{
23309
23309
break;
23310
23310
}
23311
- assert (surv_per_heap[i] >= (size_t) heap_segment_survived (region));
23312
- dprintf (REGIONS_LOG, ("heap: %d surv: %zd - %d = %zd",
23311
+ assert (surv_per_heap[i] >= heap_segment_survived (region));
23312
+ dprintf (REGIONS_LOG, ("heap: %d surv: %zd - %zd = %zd",
23313
23313
i,
23314
23314
surv_per_heap[i],
23315
23315
heap_segment_survived (region),
@@ -23320,7 +23320,7 @@ void gc_heap::equalize_promoted_bytes()
23320
23320
heap_segment_next (region) = surplus_regions;
23321
23321
surplus_regions = region;
23322
23322
23323
- max_survived = max (max_survived, (size_t) heap_segment_survived (region));
23323
+ max_survived = max (max_survived, heap_segment_survived (region));
23324
23324
}
23325
23325
if (surv_per_heap[i] < avg_surv_per_heap)
23326
23326
{
@@ -23338,7 +23338,7 @@ void gc_heap::equalize_promoted_bytes()
23338
23338
heap_segment* next_region;
23339
23339
for (heap_segment* region = surplus_regions; region != nullptr; region = next_region)
23340
23340
{
23341
- int size_class = (int )(heap_segment_survived (region)*survived_scale_factor);
23341
+ size_t size_class = (size_t )(heap_segment_survived (region)*survived_scale_factor);
23342
23342
assert ((0 <= size_class) && (size_class < NUM_SIZE_CLASSES));
23343
23343
next_region = heap_segment_next (region);
23344
23344
heap_segment_next (region) = surplus_regions_by_size_class[size_class];
@@ -23400,7 +23400,7 @@ void gc_heap::equalize_promoted_bytes()
23400
23400
g_heaps[heap_num]->thread_rw_region_front (gen_idx, region);
23401
23401
23402
23402
// adjust survival for this heap
23403
- dprintf (REGIONS_LOG, ("heap: %d surv: %zd + %d = %zd",
23403
+ dprintf (REGIONS_LOG, ("heap: %d surv: %zd + %zd = %zd",
23404
23404
heap_num,
23405
23405
surv_per_heap[heap_num],
23406
23406
heap_segment_survived (region),
@@ -31434,7 +31434,7 @@ heap_segment* gc_heap::find_first_valid_region (heap_segment* region, bool compa
31434
31434
if (heap_segment_swept_in_plan (current_region))
31435
31435
{
31436
31436
int gen_num = heap_segment_gen_num (current_region);
31437
- dprintf (REGIONS_LOG, ("threading SIP region %p surv %d onto gen%d",
31437
+ dprintf (REGIONS_LOG, ("threading SIP region %p surv %zd onto gen%d",
31438
31438
heap_segment_mem (current_region), heap_segment_survived (current_region), gen_num));
31439
31439
31440
31440
generation* gen = generation_of (gen_num);
@@ -31760,8 +31760,8 @@ bool gc_heap::should_sweep_in_plan (heap_segment* region)
31760
31760
size_t basic_region_size = (size_t)1 << min_segment_size_shr;
31761
31761
assert (heap_segment_gen_num (region) == heap_segment_plan_gen_num (region));
31762
31762
31763
- int surv_ratio = (int )(((double)heap_segment_survived (region) * 100.0) / (double)basic_region_size);
31764
- dprintf (2222, ("SSIP: region %p surv %d / %zd = %d%%(%d)",
31763
+ uint8_t surv_ratio = (uint8_t )(((double)heap_segment_survived (region) * 100.0) / (double)basic_region_size);
31764
+ dprintf (2222, ("SSIP: region %p surv %hu / %zd = %d%%(%d)",
31765
31765
heap_segment_mem (region),
31766
31766
heap_segment_survived (region),
31767
31767
basic_region_size,
@@ -31971,12 +31971,12 @@ void gc_heap::sweep_region_in_plan (heap_segment* region,
31971
31971
size_t region_index = get_basic_region_index_for_address (heap_segment_mem (region));
31972
31972
dprintf (REGIONS_LOG, ("region #%zd %p survived %zd, %s recorded %d",
31973
31973
region_index, heap_segment_mem (region), survived,
31974
- ((survived == (size_t) heap_segment_survived (region)) ? "same as" : "diff from"),
31974
+ ((survived == heap_segment_survived (region)) ? "same as" : "diff from"),
31975
31975
heap_segment_survived (region)));
31976
31976
#ifdef MULTIPLE_HEAPS
31977
- assert (survived <= (size_t) heap_segment_survived (region));
31977
+ assert (survived <= heap_segment_survived (region));
31978
31978
#else
31979
- assert (survived == (size_t) heap_segment_survived (region));
31979
+ assert (survived == heap_segment_survived (region));
31980
31980
#endif //MULTIPLE_HEAPS
31981
31981
#endif //_DEBUG
31982
31982
@@ -45422,6 +45422,12 @@ HRESULT GCHeap::Initialize()
45422
45422
gc_heap::enable_special_regions_p = (bool)GCConfig::GetGCEnableSpecialRegions();
45423
45423
size_t gc_region_size = (size_t)GCConfig::GetGCRegionSize();
45424
45424
45425
+ // Constraining the size of region size to be < 2 GB.
45426
+ if (gc_region_size >= MAX_REGION_SIZE)
45427
+ {
45428
+ return CLR_E_GC_BAD_REGION_SIZE;
45429
+ }
45430
+
45425
45431
// Adjust GCRegionSize based on how large each heap would be, for smaller heaps we would
45426
45432
// like to keep Region sizes small. We choose between 4, 2 and 1mb based on the calculations
45427
45433
// below (unless its configured explictly) such that there are at least 2 regions available
0 commit comments