--- old/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2015-03-06 20:51:40.836346648 +0100 +++ new/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2015-03-06 20:51:40.766344607 +0100 @@ -668,7 +668,7 @@ check_bitmaps("Humongous Region Allocation", first_hr); assert(first_hr->used() == word_size * HeapWordSize, "invariant"); - _allocator->increase_used(first_hr->used()); + increase_used(first_hr->used()); _humongous_set.add(first_hr); return new_obj; @@ -1783,6 +1783,7 @@ _free_regions_coming(false), _young_list(new YoungList(this)), _gc_time_stamp(0), + _summary_bytes_used(0), _survivor_plab_stats(YoungPLABSize, PLABWeight), _old_plab_stats(OldPLABSize, PLABWeight), _expand_heap_after_alloc_failure(true), @@ -2218,11 +2219,11 @@ // Computes the sum of the storage used by the various regions. size_t G1CollectedHeap::used() const { - return _allocator->used(); + return _summary_bytes_used + _allocator->used_in_alloc_regions(); } size_t G1CollectedHeap::used_unlocked() const { - return _allocator->used_unlocked(); + return _summary_bytes_used; } class SumUsedClosure: public HeapRegionClosure { @@ -3938,7 +3939,7 @@ _young_list->reset_auxilary_lists(); if (evacuation_failed()) { - _allocator->set_used(recalculate_used()); + set_used(recalculate_used()); uint n_queues = MAX2((int)ParallelGCThreads, 1); for (uint i = 0; i < n_queues; i++) { if (_evacuation_failed_info_array[i].has_failed()) { @@ -3948,7 +3949,7 @@ } else { // The "used" of the the collection set have already been subtracted // when they were freed. Add in the bytes evacuated. - _allocator->increase_used(g1_policy()->bytes_copied_during_gc()); + increase_used(g1_policy()->bytes_copied_during_gc()); } if (g1_policy()->during_initial_mark_pause()) { @@ -5781,7 +5782,7 @@ } void G1CollectedHeap::decrement_summary_bytes(size_t bytes) { - _allocator->decrease_used(bytes); + decrease_used(bytes); } class G1ParCleanupCTTask : public AbstractGangTask { @@ -6497,12 +6498,12 @@ heap_region_iterate(&cl); if (!free_list_only) { - _allocator->set_used(cl.total_used()); + set_used(cl.total_used()); } - assert(_allocator->used_unlocked() == recalculate_used(), + assert(used_unlocked() == recalculate_used(), err_msg("inconsistent _allocator->used_unlocked(), " "value: "SIZE_FORMAT" recalculated: "SIZE_FORMAT, - _allocator->used_unlocked(), recalculate_used())); + used_unlocked(), recalculate_used())); } void G1CollectedHeap::set_refine_cte_cl_concurrency(bool concurrent) { @@ -6542,7 +6543,7 @@ assert(alloc_region->is_eden(), "all mutator alloc regions should be eden"); g1_policy()->add_region_to_incremental_cset_lhs(alloc_region); - _allocator->increase_used(allocated_bytes); + increase_used(allocated_bytes); _hr_printer.retire(alloc_region); // We update the eden sizes here, when the region is retired, // instead of when it's allocated, since this is the point that its