src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp

changeset 9858
b985cbb00e68
parent 7031
ee019285a52c
child 9931
fd44df5e3bc3
     1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Thu Aug 01 03:44:03 2019 +0100
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Mon Aug 12 18:30:40 2019 +0300
     1.3 @@ -64,6 +64,33 @@
     1.4    claim_or_forward_internal_depth(p);
     1.5  }
     1.6  
     1.7 +inline void PSPromotionManager::promotion_trace_event(oop new_obj, oop old_obj,
     1.8 +                                                      size_t obj_size,
     1.9 +                                                      uint age, bool tenured,
    1.10 +                                                      const PSPromotionLAB* lab) {
    1.11 +  // Skip if memory allocation failed
    1.12 +  if (new_obj != NULL) {
    1.13 +    const ParallelScavengeTracer* gc_tracer = PSScavenge::gc_tracer();
    1.14 +
    1.15 +    if (lab != NULL) {
    1.16 +      // Promotion of object through newly allocated PLAB
    1.17 +      if (gc_tracer->should_report_promotion_in_new_plab_event()) {
    1.18 +        size_t obj_bytes = obj_size * HeapWordSize;
    1.19 +        size_t lab_size = lab->capacity();
    1.20 +        gc_tracer->report_promotion_in_new_plab_event(old_obj->klass(), obj_bytes,
    1.21 +                                                      age, tenured, lab_size);
    1.22 +      }
    1.23 +    } else {
    1.24 +      // Promotion of object directly to heap
    1.25 +      if (gc_tracer->should_report_promotion_outside_plab_event()) {
    1.26 +        size_t obj_bytes = obj_size * HeapWordSize;
    1.27 +        gc_tracer->report_promotion_outside_plab_event(old_obj->klass(), obj_bytes,
    1.28 +                                                       age, tenured);
    1.29 +      }
    1.30 +    }
    1.31 +  }
    1.32 +}
    1.33 +
    1.34  //
    1.35  // This method is pretty bulky. It would be nice to split it up
    1.36  // into smaller submethods, but we need to be careful not to hurt
    1.37 @@ -85,11 +112,11 @@
    1.38      bool new_obj_is_tenured = false;
    1.39      size_t new_obj_size = o->size();
    1.40  
    1.41 +    // Find the objects age, MT safe.
    1.42 +    uint age = (test_mark->has_displaced_mark_helper() /* o->has_displaced_mark() */) ?
    1.43 +      test_mark->displaced_mark_helper()->age() : test_mark->age();
    1.44 +
    1.45      if (!promote_immediately) {
    1.46 -      // Find the objects age, MT safe.
    1.47 -      uint age = (test_mark->has_displaced_mark_helper() /* o->has_displaced_mark() */) ?
    1.48 -        test_mark->displaced_mark_helper()->age() : test_mark->age();
    1.49 -
    1.50        // Try allocating obj in to-space (unless too old)
    1.51        if (age < PSScavenge::tenuring_threshold()) {
    1.52          new_obj = (oop) _young_lab.allocate(new_obj_size);
    1.53 @@ -98,6 +125,7 @@
    1.54            if (new_obj_size > (YoungPLABSize / 2)) {
    1.55              // Allocate this object directly
    1.56              new_obj = (oop)young_space()->cas_allocate(new_obj_size);
    1.57 +            promotion_trace_event(new_obj, o, new_obj_size, age, false, NULL);
    1.58            } else {
    1.59              // Flush and fill
    1.60              _young_lab.flush();
    1.61 @@ -107,6 +135,7 @@
    1.62                _young_lab.initialize(MemRegion(lab_base, YoungPLABSize));
    1.63                // Try the young lab allocation again.
    1.64                new_obj = (oop) _young_lab.allocate(new_obj_size);
    1.65 +              promotion_trace_event(new_obj, o, new_obj_size, age, false, &_young_lab);
    1.66              } else {
    1.67                _young_gen_is_full = true;
    1.68              }
    1.69 @@ -132,6 +161,7 @@
    1.70            if (new_obj_size > (OldPLABSize / 2)) {
    1.71              // Allocate this object directly
    1.72              new_obj = (oop)old_gen()->cas_allocate(new_obj_size);
    1.73 +            promotion_trace_event(new_obj, o, new_obj_size, age, true, NULL);
    1.74            } else {
    1.75              // Flush and fill
    1.76              _old_lab.flush();
    1.77 @@ -148,6 +178,7 @@
    1.78                _old_lab.initialize(MemRegion(lab_base, OldPLABSize));
    1.79                // Try the old lab allocation again.
    1.80                new_obj = (oop) _old_lab.allocate(new_obj_size);
    1.81 +              promotion_trace_event(new_obj, o, new_obj_size, age, true, &_old_lab);
    1.82              }
    1.83            }
    1.84          }

mercurial