< prev index next >

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

Print this page
@@ -1,7 +1,8 @@
  /*
   * Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved.
+  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -39,20 +40,37 @@
  #include "runtime/vmThread.hpp"
  #include "runtime/vmOperations.hpp"
  #include "services/memoryService.hpp"
  
  class GCTimer;
+ class ShenandoahGeneration;
+ 
+ #define SHENANDOAH_RETURN_EVENT_MESSAGE(generation_type, prefix, postfix) \
+   switch (generation_type) {                                              \
+     case NON_GEN:                                                         \
+       return prefix postfix;                                              \
+     case GLOBAL:                                                          \
+       return prefix " (Global)" postfix;                                  \
+     case YOUNG:                                                           \
+       return prefix " (Young)" postfix;                                   \
+     case OLD:                                                             \
+       return prefix " (Old)" postfix;                                     \
+     default:                                                              \
+       ShouldNotReachHere();                                               \
+       return prefix " (Unknown)" postfix;                                 \
+   }                                                                       \
  
  class ShenandoahGCSession : public StackObj {
  private:
    ShenandoahHeap* const _heap;
+   ShenandoahGeneration* const _generation;
    GCTimer*  const _timer;
    GCTracer* const _tracer;
  
    TraceMemoryManagerStats _trace_cycle;
  public:
-   ShenandoahGCSession(GCCause::Cause cause);
+   ShenandoahGCSession(GCCause::Cause cause, ShenandoahGeneration* generation);
    ~ShenandoahGCSession();
  };
  
  /*
   * ShenandoahGCPhaseTiming tracks Shenandoah specific timing information

@@ -62,15 +80,16 @@
  private:
    static ShenandoahPhaseTimings::Phase  _current_phase;
  
    ShenandoahPhaseTimings* const         _timings;
    const ShenandoahPhaseTimings::Phase   _phase;
+   const bool                            _should_aggregate;
    ShenandoahPhaseTimings::Phase         _parent_phase;
    double _start;
  
  public:
-   ShenandoahTimingsTracker(ShenandoahPhaseTimings::Phase phase);
+   ShenandoahTimingsTracker(ShenandoahPhaseTimings::Phase phase, bool should_aggregate = false);
    ~ShenandoahTimingsTracker();
  
    static ShenandoahPhaseTimings::Phase current_phase() { return _current_phase; }
  
    static bool is_current_phase_valid();

@@ -221,6 +240,21 @@
    ~ShenandoahSuspendibleThreadSetLeaver() {
      assert(!ShenandoahThreadLocalData::is_evac_allowed(Thread::current()), "STS should be joined before evac scope");
    }
  };
  
+ // Regions cannot be uncommitted when concurrent reset is zeroing out the bitmaps.
+ // This CADR class enforces this by forbidding region uncommits while it is in scope.
+ class ShenandoahNoUncommitMark : public StackObj {
+   ShenandoahHeap* const _heap;
+ public:
+   explicit ShenandoahNoUncommitMark(ShenandoahHeap* heap) : _heap(heap) {
+     _heap->forbid_uncommit();
+   }
+ 
+   ~ShenandoahNoUncommitMark() {
+     _heap->allow_uncommit();
+   }
+ };
+ 
+ 
  #endif // SHARE_GC_SHENANDOAH_SHENANDOAHUTILS_HPP
< prev index next >