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_implementation/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 public:
  44   VM_ShenandoahOperation() {};
  45 };
  46 
  47 class VM_ShenandoahReferenceOperation : public VM_ShenandoahOperation {
  48 private:
  49   BasicLock _pending_list_basic_lock;
  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   bool deflates_idle_monitors() { return false; }
  79   bool marks_nmethods() { return false; }
  80 };
  81 
  82 class VM_ShenandoahDegeneratedGC: public VM_ShenandoahReferenceOperation {
  83 private:
  84   // Really the ShenandoahHeap::ShenandoahDegenerationPoint, but casted to int here
  85   // in order to avoid dependency on ShenandoahHeap
  86   int _point;
  87 public:
  88   VM_ShenandoahDegeneratedGC(int point) : VM_ShenandoahReferenceOperation(), _point(point) {};
  89   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahDegeneratedGC; }
  90   const char* name()             const { return "Shenandoah Degenerated GC"; }
  91   virtual  void doit();
  92 };
  93 
  94 class VM_ShenandoahFullGC : public VM_ShenandoahReferenceOperation {
  95 private:
  96   GCCause::Cause _gc_cause;
  97 public:
  98   VM_ShenandoahFullGC(GCCause::Cause gc_cause) : VM_ShenandoahReferenceOperation(), _gc_cause(gc_cause) {};
  99   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFullGC; }
 100   const char* name()             const { return "Shenandoah Full GC"; }
 101   virtual void doit();
 102 };
 103 
 104 class VM_ShenandoahInitTraversalGC: public VM_ShenandoahOperation {
 105 public:
 106   VM_ShenandoahInitTraversalGC() : VM_ShenandoahOperation() {};
 107   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitTraversalGC; }
 108   const char* name()             const { return "Shenandoah Init Traversal Collection"; }
 109   virtual void doit();
 110 };
 111 
 112 class VM_ShenandoahFinalTraversalGC: public VM_ShenandoahReferenceOperation {
 113 public:
 114   VM_ShenandoahFinalTraversalGC() : VM_ShenandoahReferenceOperation() {};
 115   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalTraversalGC; }
 116   const char* name()             const { return "Shenandoah Final Traversal Collection"; }
 117   virtual void doit();
 118 };
 119 
 120 class VM_ShenandoahInitUpdateRefs: public VM_ShenandoahOperation {
 121 public:
 122   VM_ShenandoahInitUpdateRefs() : VM_ShenandoahOperation() {};
 123   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitUpdateRefs; }
 124   const char* name()             const { return "Shenandoah Init Update References"; }
 125   virtual void doit();
 126 };
 127 
 128 class VM_ShenandoahFinalUpdateRefs: public VM_ShenandoahOperation {
 129 public:
 130   VM_ShenandoahFinalUpdateRefs() : VM_ShenandoahOperation() {};
 131   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalUpdateRefs; }
 132   const char* name()             const { return "Shenandoah Final Update References"; }
 133   virtual void doit();
 134 };
 135 
 136 #endif //SHARE_VM_GC_SHENANDOAH_VM_OPERATIONS_SHENANDOAH_HPP