1 /*
   2  * Copyright (c) 2013, 2015, Red Hat, Inc. and/or its affiliates.
   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/shenandoah/shenandoahConcurrentMark.hpp"
  28 #include "gc/shared/vmGCOperations.hpp"
  29 
  30 // VM_operations for the Shenandoah Collector.
  31 //
  32 // VM_ShenandoahOperation
  33 //   - VM_ShenandoahInitMark: initiate concurrent marking
  34 //   - VM_ShenandoahReferenceOperation:
  35 //       - VM_ShenandoahFinalMarkStartEvac: finish up concurrent marking, and start evacuation
  36 //       - VM_ShenandoahInitUpdateRefs: initiate update references
  37 //       - VM_ShenandoahFinalUpdateRefs: finish up update references
  38 //       - VM_ShenandoahFullGC: do full GC
  39 //       - VM_ShenandoahPartialGC: do partial GC
  40 
  41 class VM_ShenandoahOperation : public VM_Operation {
  42 protected:
  43   uint         _gc_id;
  44 public:
  45   VM_ShenandoahOperation() : _gc_id(GCId::current()) {};
  46 };
  47 
  48 class VM_ShenandoahReferenceOperation : public VM_ShenandoahOperation {
  49 public:
  50   VM_ShenandoahReferenceOperation() : VM_ShenandoahOperation() {};
  51   bool doit_prologue();
  52   void doit_epilogue();
  53 };
  54 
  55 class VM_ShenandoahInitMark: public VM_ShenandoahOperation {
  56 public:
  57   VM_ShenandoahInitMark() : VM_ShenandoahOperation() {};
  58   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitMark; }
  59   const char* name()             const { return "Shenandoah Init Marking"; }
  60   virtual void doit();
  61 };
  62 
  63 class VM_ShenandoahFinalMarkStartEvac: public VM_ShenandoahReferenceOperation {
  64 public:
  65   VM_ShenandoahFinalMarkStartEvac() : VM_ShenandoahReferenceOperation() {};
  66   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalMarkStartEvac; }
  67   const char* name()             const { return "Shenandoah Final Mark and Start Evacuation"; }
  68   virtual  void doit();
  69 };
  70 
  71 class VM_ShenandoahFullGC : public VM_ShenandoahReferenceOperation {
  72 private:
  73   GCCause::Cause _gc_cause;
  74 public:
  75   VM_ShenandoahFullGC(GCCause::Cause gc_cause) : VM_ShenandoahReferenceOperation(), _gc_cause(gc_cause) {};
  76   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFullGC; }
  77   const char* name()             const { return "Shenandoah Full GC"; }
  78   virtual void doit();
  79 };
  80 
  81 class VM_ShenandoahPartialGC: public VM_ShenandoahOperation {
  82 public:
  83   VM_ShenandoahPartialGC() : VM_ShenandoahOperation() {};
  84   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahPartialGC; }
  85   const char* name()             const { return "Shenandoah Partial Collection"; }
  86   virtual void doit();
  87 };
  88 
  89 class VM_ShenandoahInitUpdateRefs: public VM_ShenandoahOperation {
  90 public:
  91   VM_ShenandoahInitUpdateRefs() : VM_ShenandoahOperation() {};
  92   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitUpdateRefs; }
  93   const char* name()             const { return "Shenandoah Init Update References"; }
  94   virtual void doit();
  95 };
  96 
  97 class VM_ShenandoahFinalUpdateRefs: public VM_ShenandoahOperation {
  98 public:
  99   VM_ShenandoahFinalUpdateRefs() : VM_ShenandoahOperation() {};
 100   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalUpdateRefs; }
 101   const char* name()             const { return "Shenandoah Final Update References"; }
 102   virtual void doit();
 103 };
 104 
 105 class VM_ShenandoahVerifyHeapAfterEvacuation: public VM_ShenandoahOperation {
 106 public:
 107   VM_ShenandoahVerifyHeapAfterEvacuation() : VM_ShenandoahOperation() {};
 108   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahVerifyHeapAfterEvacuation; }
 109   const char* name()             const { return "Shenandoah verify heap after evacuation"; }
 110   virtual void doit();
 111 };
 112 
 113 #endif //SHARE_VM_GC_SHENANDOAH_VM_OPERATIONS_SHENANDOAH_HPP