8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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 #ifndef SHARE_VM_GC_SHENANDOAHUTILS_HPP
25 #define SHARE_VM_GC_SHENANDOAHUTILS_HPP
26
27 #include "runtime/vmThread.hpp"
28 #include "gc_implementation/shared/isGCActiveMark.hpp"
29 #include "gc_implementation/shared/vmGCOperations.hpp"
30 #include "memory/allocation.hpp"
31 #include "gc_implementation/shenandoah/shenandoahPhaseTimings.hpp"
32
33 class GCTimer;
34
35 class ShenandoahGCSession : public StackObj {
36 private:
37 GCTimer* _timer;
38 TraceMemoryManagerStats _trace_cycle;
39 public:
40 ShenandoahGCSession();
41 ~ShenandoahGCSession();
42 };
43
44 class ShenandoahGCPhase : public StackObj {
45 private:
46 const ShenandoahPhaseTimings::Phase _phase;
47 public:
48 ShenandoahGCPhase(ShenandoahPhaseTimings::Phase phase);
49 ~ShenandoahGCPhase();
50 };
51
52 // Aggregates all the things that should happen before/after the pause.
53 class ShenandoahGCPauseMark : public StackObj {
54 private:
55 const SvcGCMarker _svc_gc_mark;
56 const IsGCActiveMark _is_gc_active_mark;
57 TraceMemoryManagerStats _trace_pause;
58 public:
59 ShenandoahGCPauseMark(SvcGCMarker::reason_type type);
60 ~ShenandoahGCPauseMark();
70 ~ShenandoahAllocTrace();
71 };
72
73 class ShenandoahSafepoint : public AllStatic {
74 public:
75 // check if Shenandoah GC safepoint is in progress
76 static inline bool is_at_shenandoah_safepoint() {
77 if (!SafepointSynchronize::is_at_safepoint()) return false;
78
79 VM_Operation* vm_op = VMThread::vm_operation();
80 if (vm_op == NULL) return false;
81
82 VM_Operation::VMOp_Type type = vm_op->type();
83 return type == VM_Operation::VMOp_ShenandoahInitMark ||
84 type == VM_Operation::VMOp_ShenandoahFinalMarkStartEvac ||
85 type == VM_Operation::VMOp_ShenandoahFinalEvac ||
86 type == VM_Operation::VMOp_ShenandoahInitUpdateRefs ||
87 type == VM_Operation::VMOp_ShenandoahFinalUpdateRefs ||
88 type == VM_Operation::VMOp_ShenandoahFullGC ||
89 type == VM_Operation::VMOp_ShenandoahDegeneratedGC;
90 }
91 };
92
93 #endif // SHARE_VM_GC_SHENANDOAHUTILS_HPP
|
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
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 #ifndef SHARE_VM_GC_SHENANDOAHUTILS_HPP
25 #define SHARE_VM_GC_SHENANDOAHUTILS_HPP
26
27 #include "runtime/vmThread.hpp"
28 #include "gc_interface/gcCause.hpp"
29 #include "gc_implementation/shared/isGCActiveMark.hpp"
30 #include "gc_implementation/shared/vmGCOperations.hpp"
31 #include "memory/allocation.hpp"
32 #include "gc_implementation/shenandoah/shenandoahPhaseTimings.hpp"
33
34 class GCTimer;
35 class GCTracer;
36
37 class ShenandoahGCSession : public StackObj {
38 private:
39 GCTimer* const _timer;
40 GCTracer* const _tracer;
41
42 TraceMemoryManagerStats _trace_cycle;
43 public:
44 ShenandoahGCSession(GCCause::Cause cause);
45 ~ShenandoahGCSession();
46 };
47
48 class ShenandoahGCPhase : public StackObj {
49 private:
50 const ShenandoahPhaseTimings::Phase _phase;
51 public:
52 ShenandoahGCPhase(ShenandoahPhaseTimings::Phase phase);
53 ~ShenandoahGCPhase();
54 };
55
56 // Aggregates all the things that should happen before/after the pause.
57 class ShenandoahGCPauseMark : public StackObj {
58 private:
59 const SvcGCMarker _svc_gc_mark;
60 const IsGCActiveMark _is_gc_active_mark;
61 TraceMemoryManagerStats _trace_pause;
62 public:
63 ShenandoahGCPauseMark(SvcGCMarker::reason_type type);
64 ~ShenandoahGCPauseMark();
74 ~ShenandoahAllocTrace();
75 };
76
77 class ShenandoahSafepoint : public AllStatic {
78 public:
79 // check if Shenandoah GC safepoint is in progress
80 static inline bool is_at_shenandoah_safepoint() {
81 if (!SafepointSynchronize::is_at_safepoint()) return false;
82
83 VM_Operation* vm_op = VMThread::vm_operation();
84 if (vm_op == NULL) return false;
85
86 VM_Operation::VMOp_Type type = vm_op->type();
87 return type == VM_Operation::VMOp_ShenandoahInitMark ||
88 type == VM_Operation::VMOp_ShenandoahFinalMarkStartEvac ||
89 type == VM_Operation::VMOp_ShenandoahFinalEvac ||
90 type == VM_Operation::VMOp_ShenandoahInitUpdateRefs ||
91 type == VM_Operation::VMOp_ShenandoahFinalUpdateRefs ||
92 type == VM_Operation::VMOp_ShenandoahFullGC ||
93 type == VM_Operation::VMOp_ShenandoahDegeneratedGC;
94 }
95 };
96
97 class ShenandoahWorkerSession : public StackObj {
98 static const uint INVALID_WORKER_ID = uint(-1);
99 public:
100 ShenandoahWorkerSession(uint worker_id);
101 ~ShenandoahWorkerSession();
102
103 static inline uint worker_id() {
104 Thread* thr = Thread::current();
105 uint id = thr->worker_id();
106 assert(id != INVALID_WORKER_ID, "Worker session has not been created");
107 return id;
108 }
109 };
110
111 #endif // SHARE_VM_GC_SHENANDOAHUTILS_HPP
|