1 /*
2  * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved.
3  *
4  * This code is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 only, as
6  * published by the Free Software Foundation.
7  *
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_GC_SHENANDOAH_SHENANDOAHVMOPERATIONS_HPP
25 #define SHARE_GC_SHENANDOAH_SHENANDOAHVMOPERATIONS_HPP
26 
27 #include "gc/shared/gcVMOperations.hpp"
28 
29 // VM_operations for the Shenandoah Collector.
30 //
31 // VM_ShenandoahOperation
32 //   - VM_ShenandoahInitMark: initiate concurrent marking
33 //   - VM_ShenandoahReferenceOperation:
34 //       - VM_ShenandoahFinalMarkStartEvac: finish up concurrent marking, and start evacuation
35 //       - VM_ShenandoahFinalEvac: finish concurrent evacuation
36 //       - VM_ShenandoahInitUpdateRefs: initiate update references
37 //       - VM_ShenandoahFinalUpdateRefs: finish up update references
38 //       - VM_ShenandoahFullGC: do full GC
39 //       - VM_ShenandoahInitTraversalGC: init traversal GC
40 //       - VM_ShenandoahFinalTraversalGC: finish traversal GC
41 
42 class VM_ShenandoahOperation : public VM_Operation {
43 protected:
44   uint         _gc_id;
45 public:
VM_ShenandoahOperation()46   VM_ShenandoahOperation() : _gc_id(GCId::current()) {};
47 };
48 
49 class VM_ShenandoahReferenceOperation : public VM_ShenandoahOperation {
50 public:
VM_ShenandoahReferenceOperation()51   VM_ShenandoahReferenceOperation() : VM_ShenandoahOperation() {};
52   bool doit_prologue();
53   void doit_epilogue();
54 };
55 
56 class VM_ShenandoahInitMark: public VM_ShenandoahOperation {
57 public:
VM_ShenandoahInitMark()58   VM_ShenandoahInitMark() : VM_ShenandoahOperation() {};
type() const59   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitMark; }
name() const60   const char* name()             const { return "Shenandoah Init Marking"; }
61   virtual void doit();
62 };
63 
64 class VM_ShenandoahFinalMarkStartEvac: public VM_ShenandoahReferenceOperation {
65 public:
VM_ShenandoahFinalMarkStartEvac()66   VM_ShenandoahFinalMarkStartEvac() : VM_ShenandoahReferenceOperation() {};
type() const67   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalMarkStartEvac; }
name() const68   const char* name()             const { return "Shenandoah Final Mark and Start Evacuation"; }
69   virtual  void doit();
70 };
71 
72 class VM_ShenandoahFinalEvac: public VM_ShenandoahOperation {
73 public:
VM_ShenandoahFinalEvac()74   VM_ShenandoahFinalEvac() : VM_ShenandoahOperation() {};
type() const75   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalEvac; }
name() const76   const char* name()             const { return "Shenandoah Final Evacuation"; }
77   virtual  void doit();
78 };
79 
80 class VM_ShenandoahDegeneratedGC: public VM_ShenandoahReferenceOperation {
81 private:
82   // Really the ShenandoahHeap::ShenandoahDegenerationPoint, but casted to int here
83   // in order to avoid dependency on ShenandoahHeap
84   int _point;
85 public:
VM_ShenandoahDegeneratedGC(int point)86   VM_ShenandoahDegeneratedGC(int point) : VM_ShenandoahReferenceOperation(), _point(point) {};
type() const87   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahDegeneratedGC; }
name() const88   const char* name()             const { return "Shenandoah Degenerated GC"; }
89   virtual  void doit();
90 };
91 
92 class VM_ShenandoahFullGC : public VM_ShenandoahReferenceOperation {
93 private:
94   GCCause::Cause _gc_cause;
95 public:
VM_ShenandoahFullGC(GCCause::Cause gc_cause)96   VM_ShenandoahFullGC(GCCause::Cause gc_cause) : VM_ShenandoahReferenceOperation(), _gc_cause(gc_cause) {};
type() const97   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFullGC; }
name() const98   const char* name()             const { return "Shenandoah Full GC"; }
99   virtual void doit();
100 };
101 
102 class VM_ShenandoahInitTraversalGC: public VM_ShenandoahOperation {
103 public:
VM_ShenandoahInitTraversalGC()104   VM_ShenandoahInitTraversalGC() : VM_ShenandoahOperation() {};
type() const105   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitTraversalGC; }
name() const106   const char* name()             const { return "Shenandoah Init Traversal Collection"; }
107   virtual void doit();
108 };
109 
110 class VM_ShenandoahFinalTraversalGC: public VM_ShenandoahReferenceOperation {
111 public:
VM_ShenandoahFinalTraversalGC()112   VM_ShenandoahFinalTraversalGC() : VM_ShenandoahReferenceOperation() {};
type() const113   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalTraversalGC; }
name() const114   const char* name()             const { return "Shenandoah Final Traversal Collection"; }
115   virtual void doit();
116 };
117 
118 class VM_ShenandoahInitUpdateRefs: public VM_ShenandoahOperation {
119 public:
VM_ShenandoahInitUpdateRefs()120   VM_ShenandoahInitUpdateRefs() : VM_ShenandoahOperation() {};
type() const121   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitUpdateRefs; }
name() const122   const char* name()             const { return "Shenandoah Init Update References"; }
123   virtual void doit();
124 };
125 
126 class VM_ShenandoahFinalUpdateRefs: public VM_ShenandoahOperation {
127 public:
VM_ShenandoahFinalUpdateRefs()128   VM_ShenandoahFinalUpdateRefs() : VM_ShenandoahOperation() {};
type() const129   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalUpdateRefs; }
name() const130   const char* name()             const { return "Shenandoah Final Update References"; }
131   virtual void doit();
132 };
133 
134 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHVMOPERATIONS_HPP
135