--- old/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp 2019-02-15 19:02:26.695208595 +0300 +++ new/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp 2019-02-15 19:02:26.579212653 +0300 @@ -187,6 +187,21 @@ } } +void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state, + oop const old, size_t word_sz, uint age, + HeapWord * const obj_ptr, + AllocationContext_t context) const { + ParGCAllocBuffer* alloc_buf = _g1_par_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); + } +} + InCSetState G1ParScanThreadState::next_state(InCSetState const state, markOop const m, uint& age) { if (state.is_young()) { age = !m->has_displaced_mark_helper() ? m->age() @@ -225,6 +240,10 @@ return _g1h->handle_evacuation_failure_par(this, old); } } + 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");