8134797: Remove explicit casts in CollectorPolicy hierarchy
Removed the explicit casts. Reviewed-by: jwilhelm, tschatzl, pliden
This commit is contained in:
parent
30b987f6b7
commit
802664728f
@ -304,8 +304,7 @@ AdaptiveSizePolicy* CMSCollector::size_policy() {
|
||||
void ConcurrentMarkSweepGeneration::initialize_performance_counters() {
|
||||
|
||||
const char* gen_name = "old";
|
||||
GenCollectorPolicy* gcp = (GenCollectorPolicy*) GenCollectedHeap::heap()->collector_policy();
|
||||
|
||||
GenCollectorPolicy* gcp = GenCollectedHeap::heap()->gen_policy();
|
||||
// Generation Counters - generation 1, 1 subspace
|
||||
_gen_counters = new GenerationCounters(gen_name, 1, 1,
|
||||
gcp->min_old_size(), gcp->max_old_size(), &_virtual_space);
|
||||
|
@ -2397,6 +2397,10 @@ void G1CollectedHeap::ref_processing_init() {
|
||||
// (for efficiency/performance)
|
||||
}
|
||||
|
||||
CollectorPolicy* G1CollectedHeap::collector_policy() const {
|
||||
return g1_policy();
|
||||
}
|
||||
|
||||
size_t G1CollectedHeap::capacity() const {
|
||||
return _hrm.length() * HeapRegion::GrainBytes;
|
||||
}
|
||||
|
@ -1057,7 +1057,7 @@ public:
|
||||
// The current policy object for the collector.
|
||||
G1CollectorPolicy* g1_policy() const { return _g1_policy; }
|
||||
|
||||
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) g1_policy(); }
|
||||
virtual CollectorPolicy* collector_policy() const;
|
||||
|
||||
// Adaptive size policy. No such thing for g1.
|
||||
virtual AdaptiveSizePolicy* size_policy() { return NULL; }
|
||||
|
@ -87,7 +87,7 @@ class ParallelScavengeHeap : public CollectedHeap {
|
||||
return CollectedHeap::ParallelScavengeHeap;
|
||||
}
|
||||
|
||||
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; }
|
||||
virtual CollectorPolicy* collector_policy() const { return _collector_policy; }
|
||||
|
||||
static PSYoungGen* young_gen() { return _young_gen; }
|
||||
static PSOldGen* old_gen() { return _old_gen; }
|
||||
|
@ -213,7 +213,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
|
||||
_max_eden_size = size - (2*_max_survivor_size);
|
||||
|
||||
// allocate the performance counters
|
||||
GenCollectorPolicy* gcp = (GenCollectorPolicy*)gch->collector_policy();
|
||||
GenCollectorPolicy* gcp = gch->gen_policy();
|
||||
|
||||
// Generation counters -- generation 0, 3 subspaces
|
||||
_gen_counters = new GenerationCounters("new", 0, 3,
|
||||
|
@ -57,8 +57,7 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs,
|
||||
// initialize performance counters
|
||||
|
||||
const char* gen_name = "old";
|
||||
GenCollectorPolicy* gcp = (GenCollectorPolicy*) GenCollectedHeap::heap()->collector_policy();
|
||||
|
||||
GenCollectorPolicy* gcp = GenCollectedHeap::heap()->gen_policy();
|
||||
// Generation Counters -- generation 1, 1 subspace
|
||||
_gen_counters = new GenerationCounters(gen_name, 1, 1,
|
||||
gcp->min_old_size(), gcp->max_old_size(), &_virtual_space);
|
||||
|
@ -172,8 +172,6 @@ char* GenCollectedHeap::allocate(size_t alignment,
|
||||
void GenCollectedHeap::post_initialize() {
|
||||
CollectedHeap::post_initialize();
|
||||
ref_processing_init();
|
||||
GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
|
||||
guarantee(policy->is_generation_policy(), "Illegal policy type");
|
||||
assert((_young_gen->kind() == Generation::DefNew) ||
|
||||
(_young_gen->kind() == Generation::ParNew),
|
||||
"Wrong youngest generation type");
|
||||
@ -183,10 +181,10 @@ void GenCollectedHeap::post_initialize() {
|
||||
_old_gen->kind() == Generation::MarkSweepCompact,
|
||||
"Wrong generation kind");
|
||||
|
||||
policy->initialize_size_policy(def_new_gen->eden()->capacity(),
|
||||
_old_gen->capacity(),
|
||||
def_new_gen->from()->capacity());
|
||||
policy->initialize_gc_policy_counters();
|
||||
_gen_policy->initialize_size_policy(def_new_gen->eden()->capacity(),
|
||||
_old_gen->capacity(),
|
||||
def_new_gen->from()->capacity());
|
||||
_gen_policy->initialize_gc_policy_counters();
|
||||
}
|
||||
|
||||
void GenCollectedHeap::ref_processing_init() {
|
||||
@ -822,10 +820,11 @@ bool GenCollectedHeap::create_cms_collector() {
|
||||
"Unexpected generation kinds");
|
||||
// Skip two header words in the block content verification
|
||||
NOT_PRODUCT(_skip_header_HeapWords = CMSCollector::skip_header_HeapWords();)
|
||||
CMSCollector* collector = new CMSCollector(
|
||||
(ConcurrentMarkSweepGeneration*)_old_gen,
|
||||
_rem_set->as_CardTableRS(),
|
||||
(ConcurrentMarkSweepPolicy*) collector_policy());
|
||||
assert(_gen_policy->is_concurrent_mark_sweep_policy(), "Unexpected policy type");
|
||||
CMSCollector* collector =
|
||||
new CMSCollector((ConcurrentMarkSweepGeneration*)_old_gen,
|
||||
_rem_set->as_CardTableRS(),
|
||||
_gen_policy->as_concurrent_mark_sweep_policy());
|
||||
|
||||
if (collector == NULL || !collector->completed_initialization()) {
|
||||
if (collector) {
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
// The generational collector policy.
|
||||
GenCollectorPolicy* gen_policy() const { return _gen_policy; }
|
||||
|
||||
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) gen_policy(); }
|
||||
virtual CollectorPolicy* collector_policy() const { return gen_policy(); }
|
||||
|
||||
// Adaptive size policy
|
||||
virtual AdaptiveSizePolicy* size_policy() {
|
||||
|
Loading…
Reference in New Issue
Block a user