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_VM_GC_SHENANDOAH_VM_OPERATIONS_SHENANDOAH_HPP
  25 #define SHARE_VM_GC_SHENANDOAH_VM_OPERATIONS_SHENANDOAH_HPP
  26 
  27 #include "gc/shared/vmGCOperations.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:
  46   VM_ShenandoahOperation() : _gc_id(GCId::current()) {};
  47 };
  48 
  49 class VM_ShenandoahReferenceOperation : public VM_ShenandoahOperation {
  50 public:
  51   VM_ShenandoahReferenceOperation() : VM_ShenandoahOperation() {};
  52   bool doit_prologue();
  53   void doit_epilogue();
  54 };
  55 
  56 class VM_ShenandoahInitMark: public VM_ShenandoahOperation {
  57 public:
  58   VM_ShenandoahInitMark() : VM_ShenandoahOperation() {};
  59   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitMark; }
  60   const char* name()             const { return "Shenandoah Init Marking"; }
  61   virtual void doit();
  62 };
  63 
  64 class VM_ShenandoahFinalMarkStartEvac: public VM_ShenandoahReferenceOperation {
  65 public:
  66   VM_ShenandoahFinalMarkStartEvac() : VM_ShenandoahReferenceOperation() {};
  67   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalMarkStartEvac; }
  68   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:
  74   VM_ShenandoahFinalEvac() : VM_ShenandoahOperation() {};
  75   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalEvac; }
  76   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:
  86   VM_ShenandoahDegeneratedGC(int point) : VM_ShenandoahReferenceOperation(), _point(point) {};
  87   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahDegeneratedGC; }
  88   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:
  96   VM_ShenandoahFullGC(GCCause::Cause gc_cause) : VM_ShenandoahReferenceOperation(), _gc_cause(gc_cause) {};
  97   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFullGC; }
  98   const char* name()             const { return "Shenandoah Full GC"; }
  99   virtual void doit();
 100 };
 101 
 102 class VM_ShenandoahInitTraversalGC: public VM_ShenandoahOperation {
 103 public:
 104   VM_ShenandoahInitTraversalGC() : VM_ShenandoahOperation() {};
 105   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitTraversalGC; }
 106   const char* name()             const { return "Shenandoah Init Traversal Collection"; }
 107   virtual void doit();
 108 };
 109 
 110 class VM_ShenandoahFinalTraversalGC: public VM_ShenandoahReferenceOperation {
 111 public:
 112   VM_ShenandoahFinalTraversalGC() : VM_ShenandoahReferenceOperation() {};
 113   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalTraversalGC; }
 114   const char* name()             const { return "Shenandoah Final Traversal Collection"; }
 115   virtual void doit();
 116 };
 117 
 118 class VM_ShenandoahInitUpdateRefs: public VM_ShenandoahOperation {
 119 public:
 120   VM_ShenandoahInitUpdateRefs() : VM_ShenandoahOperation() {};
 121   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitUpdateRefs; }
 122   const char* name()             const { return "Shenandoah Init Update References"; }
 123   virtual void doit();
 124 };
 125 
 126 class VM_ShenandoahFinalUpdateRefs: public VM_ShenandoahOperation {
 127 public:
 128   VM_ShenandoahFinalUpdateRefs() : VM_ShenandoahOperation() {};
 129   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalUpdateRefs; }
 130   const char* name()             const { return "Shenandoah Final Update References"; }
 131   virtual void doit();
 132 };
 133 
 134 #endif //SHARE_VM_GC_SHENANDOAH_VM_OPERATIONS_SHENANDOAH_HPP