< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp

Print this page




  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 
  26 #include "jfr/jfrEvents.hpp"
  27 #include "gc/shared/gcCause.hpp"
  28 #include "gc/shared/gcTimer.hpp"
  29 #include "gc/shared/gcTrace.hpp"
  30 #include "gc/shared/gcWhen.hpp"
  31 #include "gc/shenandoah/shenandoahAllocTracker.hpp"
  32 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  33 #include "gc/shenandoah/shenandoahMarkCompact.hpp"
  34 #include "gc/shenandoah/shenandoahHeap.hpp"
  35 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  36 #include "gc/shenandoah/shenandoahUtils.hpp"

  37 
  38 ShenandoahPhaseTimings::Phase ShenandoahGCPhase::_current_phase = ShenandoahGCPhase::_invalid_phase;
  39 
  40 ShenandoahGCSession::ShenandoahGCSession(GCCause::Cause cause) :
  41   _heap(ShenandoahHeap::heap()),
  42   _timer(_heap->gc_timer()),
  43   _tracer(_heap->tracer()) {
  44   assert(!ShenandoahGCPhase::is_valid_phase(ShenandoahGCPhase::current_phase()),
  45     "No current GC phase");
  46 
  47   _heap->set_gc_cause(cause);
  48   _timer->register_gc_start();
  49   _tracer->report_gc_start(cause, _timer->gc_start());
  50   _heap->trace_heap(GCWhen::BeforeGC, _tracer);
  51 
  52   _heap->shenandoah_policy()->record_cycle_start();
  53   _heap->heuristics()->record_cycle_start();
  54   _trace_cycle.initialize(_heap->cycle_memory_manager(), cause,
  55           /* allMemoryPoolsAffected */    true,
  56           /* recordGCBeginTime = */       true,


 182   assert(ShenandoahThreadLocalData::worker_id(thr) != ShenandoahThreadLocalData::INVALID_WORKER_ID, "Must be set");
 183   ShenandoahThreadLocalData::set_worker_id(thr, ShenandoahThreadLocalData::INVALID_WORKER_ID);
 184 #endif
 185 }
 186 
 187 struct PhaseMap {
 188    WeakProcessorPhases::Phase            _weak_processor_phase;
 189    ShenandoahPhaseTimings::GCParPhases   _shenandoah_phase;
 190 };
 191 
 192 static const struct PhaseMap phase_mapping[] = {
 193 #if INCLUDE_JVMTI
 194   {WeakProcessorPhases::jvmti,                 ShenandoahPhaseTimings::JVMTIWeakRoots},
 195 #endif
 196 #if INCLUDE_JFR
 197   {WeakProcessorPhases::jfr,                   ShenandoahPhaseTimings::JFRWeakRoots},
 198 #endif
 199   {WeakProcessorPhases::jni,                   ShenandoahPhaseTimings::JNIWeakRoots},
 200   {WeakProcessorPhases::stringtable,           ShenandoahPhaseTimings::StringTableRoots},
 201   {WeakProcessorPhases::resolved_method_table, ShenandoahPhaseTimings::ResolvedMethodTableRoots},
 202   {WeakProcessorPhases::vm,                    ShenandoahPhaseTimings::VMWeakRoots}

 203 };
 204 
 205 STATIC_ASSERT(sizeof(phase_mapping) / sizeof(PhaseMap) == WeakProcessorPhases::phase_count);
 206 
 207 void ShenandoahTimingConverter::weak_processing_timing_to_shenandoah_timing(WeakProcessorPhaseTimes* weak_processing_timings,
 208                                                                             ShenandoahWorkerTimings* sh_worker_times) {
 209   assert(weak_processing_timings->max_threads() == weak_processing_timings->max_threads(), "Must match");
 210   for (uint index = 0; index < WeakProcessorPhases::phase_count; index ++) {
 211     weak_processing_phase_to_shenandoah_phase(phase_mapping[index]._weak_processor_phase,
 212                                               weak_processing_timings,
 213                                               phase_mapping[index]._shenandoah_phase,
 214                                               sh_worker_times);
 215   }
 216 }
 217 
 218 void ShenandoahTimingConverter::weak_processing_phase_to_shenandoah_phase(WeakProcessorPhases::Phase wpp,
 219                                                                           WeakProcessorPhaseTimes* weak_processing_timings,
 220                                                                           ShenandoahPhaseTimings::GCParPhases spp,
 221                                                                           ShenandoahWorkerTimings* sh_worker_times) {
 222   if (WeakProcessorPhases::is_serial(wpp)) {


  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 
  26 #include "jfr/jfrEvents.hpp"
  27 #include "gc/shared/gcCause.hpp"
  28 #include "gc/shared/gcTimer.hpp"
  29 #include "gc/shared/gcTrace.hpp"
  30 #include "gc/shared/gcWhen.hpp"
  31 #include "gc/shenandoah/shenandoahAllocTracker.hpp"
  32 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  33 #include "gc/shenandoah/shenandoahMarkCompact.hpp"
  34 #include "gc/shenandoah/shenandoahHeap.hpp"
  35 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  36 #include "gc/shenandoah/shenandoahUtils.hpp"
  37 #include "utilities/debug.hpp"
  38 
  39 ShenandoahPhaseTimings::Phase ShenandoahGCPhase::_current_phase = ShenandoahGCPhase::_invalid_phase;
  40 
  41 ShenandoahGCSession::ShenandoahGCSession(GCCause::Cause cause) :
  42   _heap(ShenandoahHeap::heap()),
  43   _timer(_heap->gc_timer()),
  44   _tracer(_heap->tracer()) {
  45   assert(!ShenandoahGCPhase::is_valid_phase(ShenandoahGCPhase::current_phase()),
  46     "No current GC phase");
  47 
  48   _heap->set_gc_cause(cause);
  49   _timer->register_gc_start();
  50   _tracer->report_gc_start(cause, _timer->gc_start());
  51   _heap->trace_heap(GCWhen::BeforeGC, _tracer);
  52 
  53   _heap->shenandoah_policy()->record_cycle_start();
  54   _heap->heuristics()->record_cycle_start();
  55   _trace_cycle.initialize(_heap->cycle_memory_manager(), cause,
  56           /* allMemoryPoolsAffected */    true,
  57           /* recordGCBeginTime = */       true,


 183   assert(ShenandoahThreadLocalData::worker_id(thr) != ShenandoahThreadLocalData::INVALID_WORKER_ID, "Must be set");
 184   ShenandoahThreadLocalData::set_worker_id(thr, ShenandoahThreadLocalData::INVALID_WORKER_ID);
 185 #endif
 186 }
 187 
 188 struct PhaseMap {
 189    WeakProcessorPhases::Phase            _weak_processor_phase;
 190    ShenandoahPhaseTimings::GCParPhases   _shenandoah_phase;
 191 };
 192 
 193 static const struct PhaseMap phase_mapping[] = {
 194 #if INCLUDE_JVMTI
 195   {WeakProcessorPhases::jvmti,                 ShenandoahPhaseTimings::JVMTIWeakRoots},
 196 #endif
 197 #if INCLUDE_JFR
 198   {WeakProcessorPhases::jfr,                   ShenandoahPhaseTimings::JFRWeakRoots},
 199 #endif
 200   {WeakProcessorPhases::jni,                   ShenandoahPhaseTimings::JNIWeakRoots},
 201   {WeakProcessorPhases::stringtable,           ShenandoahPhaseTimings::StringTableRoots},
 202   {WeakProcessorPhases::resolved_method_table, ShenandoahPhaseTimings::ResolvedMethodTableRoots},
 203   {WeakProcessorPhases::vm,                    ShenandoahPhaseTimings::VMWeakRoots},
 204   {WeakProcessorPhases::nmethod_keepalive,     ShenandoahPhaseTimings::NMethodKeepAliveRoots}
 205 };
 206 
 207 STATIC_ASSERT(sizeof(phase_mapping) / sizeof(PhaseMap) == WeakProcessorPhases::phase_count);
 208 
 209 void ShenandoahTimingConverter::weak_processing_timing_to_shenandoah_timing(WeakProcessorPhaseTimes* weak_processing_timings,
 210                                                                             ShenandoahWorkerTimings* sh_worker_times) {
 211   assert(weak_processing_timings->max_threads() == weak_processing_timings->max_threads(), "Must match");
 212   for (uint index = 0; index < WeakProcessorPhases::phase_count; index ++) {
 213     weak_processing_phase_to_shenandoah_phase(phase_mapping[index]._weak_processor_phase,
 214                                               weak_processing_timings,
 215                                               phase_mapping[index]._shenandoah_phase,
 216                                               sh_worker_times);
 217   }
 218 }
 219 
 220 void ShenandoahTimingConverter::weak_processing_phase_to_shenandoah_phase(WeakProcessorPhases::Phase wpp,
 221                                                                           WeakProcessorPhaseTimes* weak_processing_timings,
 222                                                                           ShenandoahPhaseTimings::GCParPhases spp,
 223                                                                           ShenandoahWorkerTimings* sh_worker_times) {
 224   if (WeakProcessorPhases::is_serial(wpp)) {
< prev index next >