--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Tue Sep 08 16:00:34 2015 -0400
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Wed Sep 09 10:34:22 2015 +0200
@@ -71,11 +71,16 @@
_dest[InCSetState::Old] = InCSetState::Old;
}
-G1ParScanThreadState::~G1ParScanThreadState() {
+// Pass locally gathered statistics to global state.
+void G1ParScanThreadState::flush() {
+ _dcq.flush();
// Update allocation statistics.
_plab_allocator->flush_and_retire_stats();
+ _g1h->g1_policy()->record_age_table(&_age_table);
+}
+
+G1ParScanThreadState::~G1ParScanThreadState() {
delete _plab_allocator;
- _g1h->g1_policy()->record_thread_age_table(&_age_table);
// Update heap statistics.
_g1h->update_surviving_young_words(_surviving_young_words);
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
@@ -314,6 +319,25 @@
}
}
+G1ParScanThreadState* G1ParScanThreadStateSet::state_for_worker(uint worker_id) {
+ assert(worker_id < _n_workers, "out of bounds access");
+ return _states[worker_id];
+}
+
+void G1ParScanThreadStateSet::flush() {
+ assert(!_flushed, "thread local state from the per thread states should be flushed once");
+
+ for (uint worker_index = 0; worker_index < _n_workers; ++worker_index) {
+ G1ParScanThreadState* pss = _states[worker_index];
+
+ pss->flush();
+
+ delete pss;
+ _states[worker_index] = NULL;
+ }
+ _flushed = true;
+}
+
oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) {
assert(_g1h->obj_in_cs(old),
err_msg("Object " PTR_FORMAT " should be in the CSet", p2i(old)));