--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Wed Sep 02 09:14:04 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Wed Sep 02 09:51:05 2015 +0200
@@ -186,6 +186,21 @@
return dest(state);
}
+void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state,
+ oop const old, size_t word_sz, uint age,
+ HeapWord * const obj_ptr,
+ const AllocationContext_t context) const {
+ G1PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state, context);
+ if (alloc_buf->contains(obj_ptr)) {
+ _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
+ dest_state.value() == InCSetState::Old,
+ alloc_buf->word_sz());
+ } else {
+ _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz, age,
+ dest_state.value() == InCSetState::Old);
+ }
+}
+
oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
oop const old,
markOop const old_mark) {
@@ -219,6 +234,10 @@
return handle_evacuation_failure_par(old, old_mark);
}
}
+ if (_g1h->_gc_tracer_stw->should_report_promotion_events()) {
+ // The events are checked individually as part of the actual commit
+ report_promotion_event(dest_state, old, word_sz, age, obj_ptr, context);
+ }
}
assert(obj_ptr != NULL, "when we get here, allocation should have succeeded");