< prev index next >
src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Print this page
@@ -60,10 +60,11 @@
#include "gc/g1/heapRegion.inline.hpp"
#include "gc/g1/heapRegionRemSet.hpp"
#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"
#include "gc/shared/gcTimer.hpp"
#include "gc/shared/gcTrace.hpp"
@@ -226,14 +227,14 @@
// threads might try to scan the region. By zeroing the header we
// ensure that any thread that will try to scan the region will
// 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);
// Next, pad out the unused tail of the last region with filler
@@ -242,12 +243,12 @@
size_t word_fill_size = word_size_sum - word_size;
// 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;
word_fill_size = 0;
}
@@ -719,11 +720,11 @@
// Fill the memory below the allocated range with dummy object(s),
// if the region bottom does not match the range start, or if the previous
// 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);
}
}
}
@@ -1539,13 +1540,13 @@
_heap_sizing_policy = G1HeapSizingPolicy::create(this, _g1_policy->analytics());
_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);
_evacuation_failed_info_array = NEW_C_HEAP_ARRAY(EvacuationFailedInfo, n_queues, mtGC);
@@ -1981,26 +1982,28 @@
// Let's fill up most of the region
size_t word_size = HeapRegion::GrainWords - 1024;
// 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
void G1CollectedHeap::increment_old_marking_cycles_started() {
assert(_old_marking_cycles_started == _old_marking_cycles_completed ||
< prev index next >