src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp

changeset 9858
b985cbb00e68
parent 8611
a753c8401458
     1.1 --- a/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp	Thu Aug 01 03:44:03 2019 +0100
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp	Mon Aug 12 18:30:40 2019 +0300
     1.3 @@ -187,6 +187,21 @@
     1.4    }
     1.5  }
     1.6  
     1.7 +void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state,
     1.8 +                                                  oop const old, size_t word_sz, uint age,
     1.9 +                                                  HeapWord * const obj_ptr,
    1.10 +                                                  AllocationContext_t context) const {
    1.11 +  ParGCAllocBuffer* alloc_buf = _g1_par_allocator->alloc_buffer(dest_state, context);
    1.12 +  if (alloc_buf->contains(obj_ptr)) {
    1.13 +    _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
    1.14 +                                                             dest_state.value() == InCSetState::Old,
    1.15 +                                                             alloc_buf->word_sz());
    1.16 +  } else {
    1.17 +    _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz, age,
    1.18 +                                                              dest_state.value() == InCSetState::Old);
    1.19 +  }
    1.20 +}
    1.21 +
    1.22  InCSetState G1ParScanThreadState::next_state(InCSetState const state, markOop const m, uint& age) {
    1.23    if (state.is_young()) {
    1.24      age = !m->has_displaced_mark_helper() ? m->age()
    1.25 @@ -225,6 +240,10 @@
    1.26          return _g1h->handle_evacuation_failure_par(this, old);
    1.27        }
    1.28      }
    1.29 +    if (_g1h->_gc_tracer_stw->should_report_promotion_events()) {
    1.30 +      // The events are checked individually as part of the actual commit
    1.31 +      report_promotion_event(dest_state, old, word_sz, age, obj_ptr, context);
    1.32 +    }
    1.33    }
    1.34  
    1.35    assert(obj_ptr != NULL, "when we get here, allocation should have succeeded");

mercurial