--- old/src/hotspot/share/gc/g1/g1CollectedHeap.cpp 2018-10-18 14:45:39.869969743 +0200 +++ new/src/hotspot/share/gc/g1/g1CollectedHeap.cpp 2018-10-18 14:45:39.546955874 +0200 @@ -62,6 +62,7 @@ #include "gc/g1/heapRegionSet.inline.hpp" #include "gc/g1/vm_operations_g1.hpp" #include "gc/shared/adaptiveSizePolicy.hpp" +#include "gc/shared/fill.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcId.hpp" #include "gc/shared/gcLocker.hpp" @@ -228,10 +229,10 @@ // come across the zero klass word and bail out. // // NOTE: It would not have been correct to have used - // CollectedHeap::fill_with_object() and make the space look like - // an int array. The thread that is doing the allocation will - // later update the object header to a potentially different array - // type and, for a very short period of time, the klass and length + // Fill::range() and make the space look like an int array. + // The thread that is doing the allocation will later update + // the object header to a potentially different array type + // and, for a very short period of time, the klass and length // fields will be inconsistent. This could cause a refinement // thread to calculate the object size incorrectly. Copy::fill_to_words(new_obj, oopDesc::header_size(), 0); @@ -244,8 +245,8 @@ // How many words memory we "waste" which cannot hold a filler object. size_t words_not_fillable = 0; - if (word_fill_size >= min_fill_size()) { - fill_with_objects(obj_top, word_fill_size); + if (word_fill_size >= Fill::min_size()) { + Fill::range(obj_top, word_fill_size); } else if (word_fill_size > 0) { // We have space to fill, but we cannot fit an object there. words_not_fillable = word_fill_size; @@ -721,7 +722,7 @@ // range ended within the same G1 region, and there is a gap. if (start_address != bottom_address) { size_t fill_size = pointer_delta(start_address, bottom_address); - G1CollectedHeap::fill_with_objects(bottom_address, fill_size); + Fill::range(bottom_address, fill_size); increase_used(fill_size * HeapWordSize); } } @@ -1541,9 +1542,9 @@ _humongous_object_threshold_in_words = humongous_threshold_for(HeapRegion::GrainWords); - // Override the default _filler_array_max_size so that no humongous filler + // Override the default Fill::max_size() so that no humongous filler // objects are created. - _filler_array_max_size = _humongous_object_threshold_in_words; + Fill::set_max_size(_humongous_object_threshold_in_words); uint n_queues = ParallelGCThreads; _task_queues = new RefToScanQueueSet(n_queues); @@ -1983,22 +1984,24 @@ // And as a result the region we'll allocate will be humongous. guarantee(is_humongous(word_size), "sanity"); - // _filler_array_max_size is set to humongous object threshold - // but temporarily change it to use CollectedHeap::fill_with_object(). - SizeTFlagSetting fs(_filler_array_max_size, word_size); + // Fill::max_size() is set to humongous object threshold + // but temporarily change it to use Fill::range(). + const size_t prev_fill_max_size = Fill::max_size(); + Fill::set_max_size(word_size); for (uintx i = 0; i < G1DummyRegionsPerGC; ++i) { // Let's use the existing mechanism for the allocation HeapWord* dummy_obj = humongous_obj_allocate(word_size); if (dummy_obj != NULL) { - MemRegion mr(dummy_obj, word_size); - CollectedHeap::fill_with_object(mr); + Fill::range(dummy_obj, word_size); } else { // If we can't allocate once, we probably cannot allocate // again. Let's get out of the loop. break; } } + + Fill::set_max_size(prev_fill_max_size); } #endif // !PRODUCT