--- old/src/share/vm/gc/g1/g1CollectedHeap.cpp 2015-12-21 12:23:22.616133401 +0100 +++ new/src/share/vm/gc/g1/g1CollectedHeap.cpp 2015-12-21 12:23:22.522130613 +0100 @@ -1936,7 +1936,7 @@ const uint max_region_idx = (1U << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1; guarantee((max_regions() - 1) <= max_region_idx, "too many regions"); - G1RemSet::init_heap(max_regions()); + G1RemSet::initialize(max_regions()); size_t max_cards_per_region = ((size_t)1 << (sizeof(CardIdx_t)*BitsPerByte-1)) - 1; guarantee(HeapRegion::CardsPerRegion > 0, "make sure it's initialized"); --- old/src/share/vm/gc/g1/g1FromCardCache.cpp 2015-12-21 12:23:23.183150219 +0100 +++ new/src/share/vm/gc/g1/g1FromCardCache.cpp 2015-12-21 12:23:23.093147549 +0100 @@ -48,9 +48,10 @@ guarantee((size_t)start_idx + new_num_regions <= max_uintx, "Trying to invalidate beyond maximum region, from %u size " SIZE_FORMAT, start_idx, new_num_regions); + uint end_idx = (start_idx + (uint)new_num_regions); + assert(end_idx <= _max_regions, "Must be within max."); + for (uint i = 0; i < G1RemSet::num_par_rem_sets(); i++) { - uint end_idx = (start_idx + (uint)new_num_regions); - assert(end_idx <= _max_regions, "Must be within max."); for (uint j = start_idx; j < end_idx; j++) { set(i, j, InvalidCard); } --- old/src/share/vm/gc/g1/g1RemSet.cpp 2015-12-21 12:23:23.696165434 +0100 +++ new/src/share/vm/gc/g1/g1RemSet.cpp 2015-12-21 12:23:23.603162676 +0100 @@ -82,7 +82,7 @@ return MAX2(DirtyCardQueueSet::num_par_ids() + ConcurrentG1Refine::thread_num(), ParallelGCThreads); } -void G1RemSet::init_heap(uint max_regions) { +void G1RemSet::initialize(uint max_regions) { G1FromCardCache::initialize(num_par_rem_sets(), max_regions); } --- old/src/share/vm/gc/g1/g1RemSet.hpp 2015-12-21 12:23:24.232181332 +0100 +++ new/src/share/vm/gc/g1/g1RemSet.hpp 2015-12-21 12:23:24.140178604 +0100 @@ -75,14 +75,15 @@ G1ParPushHeapRSClosure** _cset_rs_update_cl; public: - // Gives an approximation on how many threads add records to a remembered set - // in parallel for sizing buffers to decrease performance losses due to sharing. - // Examples are mutator threads together with the concurrent refinement threads - // or GC threads. + // Gives an approximation on how many threads can be expected to add records to + // a remembered set in parallel. This can be used for sizing data structures to + // decrease performance losses due to data structure sharing. + // Examples for quantities that influence this value are the maximum number of + // mutator threads, maximum number of concurrent refinement or GC threads. static uint num_par_rem_sets(); - // Initialize data that depends on a known heap size. - static void init_heap(uint max_regions); + // Initialize data that depends on that the heap size is known. + static void initialize(uint max_regions); // This is called to reset dual hash tables after the gc pause // is finished and the initial hash table is no longer being