8154452: Deferred cleanups after split of G1CollectorPolicy code

Reviewed-by: ehelin, sjohanss
This commit is contained in:
Mikael Gerdin 2016-04-21 10:19:00 +02:00
parent 39b43a87e7
commit 7587fbdd30
8 changed files with 5 additions and 35 deletions

View File

@ -2058,7 +2058,6 @@ size_t G1CollectedHeap::conservative_max_heap_alignment() {
}
void G1CollectedHeap::post_initialize() {
CollectedHeap::post_initialize();
ref_processing_init();
}

View File

@ -92,14 +92,3 @@ void G1CollectorPolicy::initialize_alignments() {
size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
_heap_alignment = MAX3(card_table_alignment, _space_alignment, page_size);
}
void G1CollectorPolicy::initialize_flags() {
if (G1HeapRegionSize != HeapRegion::GrainBytes) {
FLAG_SET_ERGO(size_t, G1HeapRegionSize, HeapRegion::GrainBytes);
}
guarantee(SurvivorRatio >= 1, "Range checking for SurvivorRatio should guarantee that value is >= 1");
CollectorPolicy::initialize_flags();
}

View File

@ -35,15 +35,9 @@ class G1YoungGenSizer;
class G1CollectorPolicy: public CollectorPolicy {
protected:
void initialize_alignments();
void initialize_flags();
public:
G1CollectorPolicy();
G1CollectorPolicy* as_g1_policy() { return this; }
void post_heap_initialize() {} // Nothing needed.
};
#endif // SHARE_VM_GC_G1_G1COLLECTORPOLICY_HPP

View File

@ -153,6 +153,10 @@ void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_hea
guarantee(CardsPerRegion == 0, "we should only set it once");
CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
if (G1HeapRegionSize != GrainBytes) {
FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes);
}
}
void HeapRegion::reset_after_compaction() {

View File

@ -510,10 +510,6 @@ void CollectedHeap::fill_with_objects(HeapWord* start, size_t words, bool zap)
fill_with_object_impl(start, words, zap);
}
void CollectedHeap::post_initialize() {
collector_policy()->post_heap_initialize();
}
HeapWord* CollectedHeap::allocate_new_tlab(size_t size) {
guarantee(false, "thread-local allocation buffers not supported");
return NULL;

View File

@ -209,7 +209,7 @@ class CollectedHeap : public CHeapObj<mtInternal> {
// In many heaps, there will be a need to perform some initialization activities
// after the Universe is fully formed, but before general heap allocation is allowed.
// This is the correct place to place such initialization methods.
virtual void post_initialize();
virtual void post_initialize() = 0;
// Stop any onging concurrent work and prepare for exit.
virtual void stop() {}

View File

@ -127,17 +127,14 @@ class CollectorPolicy : public CHeapObj<mtGC> {
virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; }
#if INCLUDE_ALL_GCS
virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; }
virtual G1CollectorPolicy* as_g1_policy() { return NULL; }
#endif // INCLUDE_ALL_GCS
// Note that these are not virtual.
bool is_generation_policy() { return as_generation_policy() != NULL; }
bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; }
#if INCLUDE_ALL_GCS
bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
bool is_g1_policy() { return as_g1_policy() != NULL; }
#else // INCLUDE_ALL_GCS
bool is_concurrent_mark_sweep_policy() { return false; }
bool is_g1_policy() { return false; }
#endif // INCLUDE_ALL_GCS
@ -146,10 +143,6 @@ class CollectorPolicy : public CHeapObj<mtGC> {
MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
size_t size,
Metaspace::MetadataType mdtype);
// Do any updates required to global flags that are due to heap initialization
// changes
virtual void post_heap_initialize() = 0;
};
class ClearedAllSoftRefs : public StackObj {
@ -263,10 +256,6 @@ class GenCollectorPolicy : public CollectorPolicy {
virtual void initialize_size_policy(size_t init_eden_size,
size_t init_promo_size,
size_t init_survivor_size);
virtual void post_heap_initialize() {
assert(_max_young_size == MaxNewSize, "Should be taken care of by initialize_size_info");
}
};
class MarkSweepPolicy : public GenCollectorPolicy {

View File

@ -179,7 +179,6 @@ char* GenCollectedHeap::allocate(size_t alignment,
}
void GenCollectedHeap::post_initialize() {
CollectedHeap::post_initialize();
ref_processing_init();
assert((_young_gen->kind() == Generation::DefNew) ||
(_young_gen->kind() == Generation::ParNew),