8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
Reviewed-by: tschatzl, mgerdin
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Mon Nov 09 09:19:39 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Mon Nov 09 11:26:15 2015 +0100
@@ -1780,7 +1780,6 @@
CollectedHeap(),
_g1_policy(policy_),
_dirty_card_queue_set(false),
- _into_cset_dirty_card_queue_set(false),
_is_alive_closure_cm(this),
_is_alive_closure_stw(this),
_ref_processor_cm(NULL),
@@ -2045,16 +2044,6 @@
Shared_DirtyCardQ_lock,
&JavaThread::dirty_card_queue_set());
- // Initialize the card queue set used to hold cards containing
- // references into the collection set.
- _into_cset_dirty_card_queue_set.initialize(NULL, // Should never be called by the Java code
- DirtyCardQ_CBL_mon,
- DirtyCardQ_FL_lock,
- -1, // never trigger processing
- -1, // no limit on length
- Shared_DirtyCardQ_lock,
- &JavaThread::dirty_card_queue_set());
-
// Here we allocate the dummy HeapRegion that is required by the
// G1AllocRegion class.
HeapRegion* dummy_region = _hrm.get_dummy_region();
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Mon Nov 09 09:19:39 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Mon Nov 09 11:26:15 2015 +0100
@@ -757,12 +757,6 @@
// The closure used to refine a single card.
RefineCardTableEntryClosure* _refine_cte_cl;
- // A DirtyCardQueueSet that is used to hold cards that contain
- // references into the current collection set. This is used to
- // update the remembered sets of the regions in the collection
- // set in the event of an evacuation failure.
- DirtyCardQueueSet _into_cset_dirty_card_queue_set;
-
// After a collection pause, make the regions in the CS into free
// regions.
void free_collection_set(HeapRegion* cs_head, EvacuationInfo& evacuation_info, const size_t* surviving_young_words);
@@ -952,13 +946,6 @@
// A set of cards where updates happened during the GC
DirtyCardQueueSet& dirty_card_queue_set() { return _dirty_card_queue_set; }
- // A DirtyCardQueueSet that is used to hold cards that contain
- // references into the current collection set. This is used to
- // update the remembered sets of the regions in the collection
- // set in the event of an evacuation failure.
- DirtyCardQueueSet& into_cset_dirty_card_queue_set()
- { return _into_cset_dirty_card_queue_set; }
-
// Create a G1CollectedHeap with the specified policy.
// Must call the initialize method afterwards.
// May not return if something goes wrong.
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp Mon Nov 09 09:19:39 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp Mon Nov 09 11:26:15 2015 +0100
@@ -45,7 +45,8 @@
_ct_bs(ct_bs), _g1p(_g1->g1_policy()),
_cg1r(g1->concurrent_g1_refine()),
_cset_rs_update_cl(NULL),
- _prev_period_summary()
+ _prev_period_summary(),
+ _into_cset_dirty_card_queue_set(false)
{
_cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
for (uint i = 0; i < n_workers(); i++) {
@@ -54,6 +55,15 @@
if (G1SummarizeRSetStats) {
_prev_period_summary.initialize(this);
}
+ // Initialize the card queue set used to hold cards containing
+ // references into the collection set.
+ _into_cset_dirty_card_queue_set.initialize(NULL, // Should never be called by the Java code
+ DirtyCardQ_CBL_mon,
+ DirtyCardQ_FL_lock,
+ -1, // never trigger processing
+ -1, // no limit on length
+ Shared_DirtyCardQ_lock,
+ &JavaThread::dirty_card_queue_set());
}
G1RemSet::~G1RemSet() {
@@ -242,7 +252,7 @@
if (_g1rs->refine_card(card_ptr, worker_i, true)) {
// 'card_ptr' contains references that point into the collection
// set. We need to record the card in the DCQS
- // (G1CollectedHeap::into_cset_dirty_card_queue_set())
+ // (_into_cset_dirty_card_queue_set)
// that's used for that purpose.
//
// Enqueue the card
@@ -286,7 +296,7 @@
// are wholly 'free' of live objects. In the event of an evacuation
// failure the cards/buffers in this queue set are passed to the
// DirtyCardQueueSet that is used to manage RSet updates
- DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set());
+ DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set);
updateRS(&into_cset_dcq, worker_i);
size_t cards_scanned = scanRS(oc, heap_region_codeblobs, worker_i);
@@ -309,7 +319,7 @@
// Set all cards back to clean.
_g1->cleanUpCardTable();
- DirtyCardQueueSet& into_cset_dcqs = _g1->into_cset_dirty_card_queue_set();
+ DirtyCardQueueSet& into_cset_dcqs = _into_cset_dirty_card_queue_set;
int into_cset_n_buffers = into_cset_dcqs.completed_buffers_num();
if (_g1->evacuation_failed()) {
@@ -325,10 +335,10 @@
// Free any completed buffers in the DirtyCardQueueSet used to hold cards
// which contain references that point into the collection.
- _g1->into_cset_dirty_card_queue_set().clear();
- assert(_g1->into_cset_dirty_card_queue_set().completed_buffers_num() == 0,
+ _into_cset_dirty_card_queue_set.clear();
+ assert(_into_cset_dirty_card_queue_set.completed_buffers_num() == 0,
"all buffers should be freed");
- _g1->into_cset_dirty_card_queue_set().clear_n_completed_buffers();
+ _into_cset_dirty_card_queue_set.clear_n_completed_buffers();
}
class ScrubRSClosure: public HeapRegionClosure {
@@ -586,9 +596,9 @@
bool use_hot_card_cache = hot_card_cache->use_cache();
hot_card_cache->set_use_cache(false);
- DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set());
+ DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set);
updateRS(&into_cset_dcq, 0);
- _g1->into_cset_dirty_card_queue_set().clear();
+ _into_cset_dirty_card_queue_set.clear();
hot_card_cache->set_use_cache(use_hot_card_cache);
assert(JavaThread::dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
--- a/hotspot/src/share/vm/gc/g1/g1RemSet.hpp Mon Nov 09 09:19:39 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1RemSet.hpp Mon Nov 09 11:26:15 2015 +0100
@@ -41,6 +41,13 @@
class G1RemSet: public CHeapObj<mtGC> {
private:
G1RemSetSummary _prev_period_summary;
+
+ // A DirtyCardQueueSet that is used to hold cards that contain
+ // references into the current collection set. This is used to
+ // update the remembered sets of the regions in the collection
+ // set in the event of an evacuation failure.
+ DirtyCardQueueSet _into_cset_dirty_card_queue_set;
+
protected:
G1CollectedHeap* _g1;
size_t _conc_refine_cards;