8067499: G1SATBCardTableModRefBS should not inherit from CardTableModRefBSForCTRS

G1SATBCardTableModRefBS inherits from CardTableModRefBS

Reviewed-by: mgerdin, brutisso, tschatzl
This commit is contained in:
Kim Barrett 2014-12-18 13:26:37 -05:00
parent 12797a11c0
commit 57198d2b63
10 changed files with 24 additions and 41 deletions

View file

@ -1886,13 +1886,12 @@ jint G1CollectedHeap::initialize() {
initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size())); initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
// Create the gen rem set (and barrier set) for the entire reserved region. // Create the barrier set for the entire reserved region.
_rem_set = collector_policy()->create_rem_set(reserved_region()); G1SATBCardTableLoggingModRefBS* bs
set_barrier_set(rem_set()->bs()); = new G1SATBCardTableLoggingModRefBS(reserved_region());
if (!barrier_set()->is_a(BarrierSet::G1SATBCTLogging)) { bs->initialize();
vm_exit_during_initialization("G1 requires a G1SATBLoggingCardTableModRefBS"); assert(bs->is_a(BarrierSet::G1SATBCTLogging), "sanity");
return JNI_ENOMEM; set_barrier_set(bs);
}
// Also create a G1 rem set. // Also create a G1 rem set.
_g1_rem_set = new G1RemSet(this, g1_barrier_set()); _g1_rem_set = new G1RemSet(this, g1_barrier_set());
@ -3153,8 +3152,6 @@ void G1CollectedHeap::verify(bool silent, VerifyOption vo) {
failures = true; failures = true;
} }
} }
if (!silent) gclog_or_tty->print("RemSet ");
rem_set()->verify();
if (G1StringDedup::is_enabled()) { if (G1StringDedup::is_enabled()) {
if (!silent) gclog_or_tty->print("StrDedup "); if (!silent) gclog_or_tty->print("StrDedup ");
@ -5588,8 +5585,6 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
init_for_evac_failure(NULL); init_for_evac_failure(NULL);
rem_set()->prepare_for_younger_refs_iterate(true);
assert(dirty_card_queue_set().completed_buffers_num() == 0, "Should be empty"); assert(dirty_card_queue_set().completed_buffers_num() == 0, "Should be empty");
double start_par_time_sec = os::elapsedTime(); double start_par_time_sec = os::elapsedTime();
double end_par_time_sec; double end_par_time_sec;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@
#include "runtime/thread.inline.hpp" #include "runtime/thread.inline.hpp"
G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap) : G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap) :
CardTableModRefBSForCTRS(whole_heap) CardTableModRefBS(whole_heap)
{ {
_kind = G1SATBCT; _kind = G1SATBCT;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,7 +37,7 @@ class G1SATBCardTableLoggingModRefBS;
// This barrier is specialized to use a logging barrier to support // This barrier is specialized to use a logging barrier to support
// snapshot-at-the-beginning marking. // snapshot-at-the-beginning marking.
class G1SATBCardTableModRefBS: public CardTableModRefBSForCTRS { class G1SATBCardTableModRefBS: public CardTableModRefBS {
protected: protected:
enum G1CardValues { enum G1CardValues {
g1_young_gen = CT_MR_BS_last_reserved << 1 g1_young_gen = CT_MR_BS_last_reserved << 1

View file

@ -33,24 +33,13 @@
#include "runtime/java.hpp" #include "runtime/java.hpp"
#include "runtime/os.hpp" #include "runtime/os.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/concurrentMark.hpp"
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#endif // INCLUDE_ALL_GCS
CardTableRS::CardTableRS(MemRegion whole_heap) : CardTableRS::CardTableRS(MemRegion whole_heap) :
GenRemSet(), GenRemSet(),
_cur_youngergen_card_val(youngergenP1_card) _cur_youngergen_card_val(youngergenP1_card)
{ {
#if INCLUDE_ALL_GCS guarantee(Universe::heap()->kind() == CollectedHeap::GenCollectedHeap, "sanity");
if (UseG1GC) {
_ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap);
} else {
_ct_bs = new CardTableModRefBSForCTRS(whole_heap);
}
#else
_ct_bs = new CardTableModRefBSForCTRS(whole_heap); _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
#endif
_ct_bs->initialize(); _ct_bs->initialize();
set_bs(_ct_bs); set_bs(_ct_bs);
_last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, GenCollectedHeap::max_gens + 1, _last_cur_val_in_gen = NEW_C_HEAP_ARRAY3(jbyte, GenCollectedHeap::max_gens + 1,

View file

@ -70,6 +70,7 @@ enum GCH_strong_roots_tasks {
GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) : GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) :
SharedHeap(policy), SharedHeap(policy),
_rem_set(NULL),
_gen_policy(policy), _gen_policy(policy),
_gen_process_roots_tasks(new SubTasksDone(GCH_PS_NumElements)), _gen_process_roots_tasks(new SubTasksDone(GCH_PS_NumElements)),
_full_collections_completed(0) _full_collections_completed(0)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -66,6 +66,9 @@ public:
Generation* _gens[max_gens]; Generation* _gens[max_gens];
GenerationSpec** _gen_specs; GenerationSpec** _gen_specs;
// The singleton Gen Remembered Set.
GenRemSet* _rem_set;
// The generational collector policy. // The generational collector policy.
GenCollectorPolicy* _gen_policy; GenCollectorPolicy* _gen_policy;
@ -383,6 +386,10 @@ public:
return _n_gens; return _n_gens;
} }
// This function returns the "GenRemSet" object that allows us to scan
// generations in a fully generational heap.
GenRemSet* rem_set() { return _rem_set; }
// Convenience function to be used in situations where the heap type can be // Convenience function to be used in situations where the heap type can be
// asserted to be this type. // asserted to be this type.
static GenCollectedHeap* heap(); static GenCollectedHeap* heap();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -44,7 +44,7 @@ inline void OopsInGenClosure::set_generation(Generation* gen) {
_gen_boundary = _gen->reserved().start(); _gen_boundary = _gen->reserved().start();
// Barrier set for the heap, must be set after heap is initialized // Barrier set for the heap, must be set after heap is initialized
if (_rs == NULL) { if (_rs == NULL) {
GenRemSet* rs = SharedHeap::heap()->rem_set(); GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
_rs = (CardTableRS*)rs; _rs = (CardTableRS*)rs;
} }
} }

View file

@ -297,7 +297,7 @@ void Generation::oop_iterate(ExtendedOopClosure* cl) {
void Generation::younger_refs_in_space_iterate(Space* sp, void Generation::younger_refs_in_space_iterate(Space* sp,
OopsInGenClosure* cl) { OopsInGenClosure* cl) {
GenRemSet* rs = SharedHeap::heap()->rem_set(); GenRemSet* rs = GenCollectedHeap::heap()->rem_set();
rs->younger_refs_in_space_iterate(sp, cl); rs->younger_refs_in_space_iterate(sp, cl);
} }

View file

@ -58,7 +58,6 @@ enum SH_process_roots_tasks {
SharedHeap::SharedHeap(CollectorPolicy* policy_) : SharedHeap::SharedHeap(CollectorPolicy* policy_) :
CollectedHeap(), CollectedHeap(),
_collector_policy(policy_), _collector_policy(policy_),
_rem_set(NULL),
_strong_roots_scope(NULL), _strong_roots_scope(NULL),
_strong_roots_parity(0), _strong_roots_parity(0),
_process_strong_tasks(new SubTasksDone(SH_PS_NumElements)), _process_strong_tasks(new SubTasksDone(SH_PS_NumElements)),

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -114,10 +114,6 @@ protected:
// set the static pointer "_sh" to that instance. // set the static pointer "_sh" to that instance.
static SharedHeap* _sh; static SharedHeap* _sh;
// and the Gen Remembered Set, at least one good enough to scan the perm
// gen.
GenRemSet* _rem_set;
// A gc policy, controls global gc resource issues // A gc policy, controls global gc resource issues
CollectorPolicy *_collector_policy; CollectorPolicy *_collector_policy;
@ -152,10 +148,6 @@ public:
// Initialization of ("weak") reference processing support // Initialization of ("weak") reference processing support
virtual void ref_processing_init(); virtual void ref_processing_init();
// This function returns the "GenRemSet" object that allows us to scan
// generations in a fully generational heap.
GenRemSet* rem_set() { return _rem_set; }
// Iteration functions. // Iteration functions.
void oop_iterate(ExtendedOopClosure* cl) = 0; void oop_iterate(ExtendedOopClosure* cl) = 0;