--- old/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2014-02-24 12:41:55.419334546 +0100 +++ new/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp 2014-02-24 12:41:55.343334548 +0100 @@ -362,17 +362,18 @@ size_t OtherRegionsTable::_from_card_cache_mem_size = 0; void OtherRegionsTable::init_from_card_cache(size_t max_regions) { - _from_card_cache_max_regions = max_regions; + // pad rows to cache line sizes. + _from_card_cache_max_regions = align_size_up(max_regions, DEFAULT_CACHE_LINE_SIZE / sizeof(int)); int n_par_rs = HeapRegionRemSet::num_par_rem_sets(); _from_card_cache = NEW_C_HEAP_ARRAY(int*, n_par_rs, mtGC); for (int i = 0; i < n_par_rs; i++) { - _from_card_cache[i] = NEW_C_HEAP_ARRAY(int, max_regions, mtGC); - for (size_t j = 0; j < max_regions; j++) { + _from_card_cache[i] = NEW_C_HEAP_ARRAY(int, _from_card_cache_max_regions, mtGC); + for (size_t j = 0; j < _from_card_cache_max_regions; j++) { _from_card_cache[i][j] = -1; // An invalid value. } } - _from_card_cache_mem_size = n_par_rs * max_regions * sizeof(int); + _from_card_cache_mem_size = n_par_rs * _from_card_cache_max_regions * sizeof(int); } void OtherRegionsTable::shrink_from_card_cache(size_t new_n_regs) { @@ -728,7 +729,8 @@ void OtherRegionsTable::clear_fcc() { size_t hrs_idx = hr()->hrs_index(); - for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) { + uint num_par_remsets = HeapRegionRemSet::num_par_rem_sets(); + for (uint i = 0; i < num_par_remsets; i++) { _from_card_cache[i][hrs_idx] = -1; } }