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_ShenandoahInitUpdateRefs: initiate update references
  36 //       - VM_ShenandoahFinalUpdateRefs: finish up update references
  37 //       - VM_ShenandoahFullGC: do full GC
  38 
  39 class VM_ShenandoahOperation : public VM_Operation {
  40 public:
  41   VM_ShenandoahOperation() {};
  42 };
  43 
  44 class VM_ShenandoahReferenceOperation : public VM_ShenandoahOperation {
  45 private:
  46   BasicLock _pending_list_basic_lock;
  47 public:
  48   VM_ShenandoahReferenceOperation() : VM_ShenandoahOperation() {};
  49   bool doit_prologue();
  50   void doit_epilogue();
  51 };
  52 
  53 class VM_ShenandoahInitMark: public VM_ShenandoahOperation {
  54 public:
  55   VM_ShenandoahInitMark() : VM_ShenandoahOperation() {};
  56   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitMark; }
  57   const char* name()             const { return "Shenandoah Init Marking"; }
  58   virtual void doit();
  59 };
  60 
  61 class VM_ShenandoahFinalMarkStartEvac: public VM_ShenandoahReferenceOperation {
  62 public:
  63   VM_ShenandoahFinalMarkStartEvac() : VM_ShenandoahReferenceOperation() {};
  64   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalMarkStartEvac; }
  65   const char* name()             const { return "Shenandoah Final Mark and Start Evacuation"; }
  66   virtual  void doit();
  67 };
  68 
  69 class VM_ShenandoahDegeneratedGC: public VM_ShenandoahReferenceOperation {
  70 private:
  71   // Really the ShenandoahHeap::ShenandoahDegenerationPoint, but casted to int here
  72   // in order to avoid dependency on ShenandoahHeap
  73   int _point;
  74 public:
  75   VM_ShenandoahDegeneratedGC(int point) : VM_ShenandoahReferenceOperation(), _point(point) {};
  76   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahDegeneratedGC; }
  77   const char* name()             const { return "Shenandoah Degenerated GC"; }
  78   virtual  void doit();
  79 };
  80 
  81 class VM_ShenandoahFullGC : public VM_ShenandoahReferenceOperation {
  82 private:
  83   GCCause::Cause _gc_cause;
  84 public:
  85   VM_ShenandoahFullGC(GCCause::Cause gc_cause) : VM_ShenandoahReferenceOperation(), _gc_cause(gc_cause) {};
  86   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFullGC; }
  87   const char* name()             const { return "Shenandoah Full GC"; }
  88   virtual void doit();
  89 };
  90 
  91 class VM_ShenandoahInitUpdateRefs: public VM_ShenandoahOperation {
  92 public:
  93   VM_ShenandoahInitUpdateRefs() : VM_ShenandoahOperation() {};
  94   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitUpdateRefs; }
  95   const char* name()             const { return "Shenandoah Init Update References"; }
  96   virtual void doit();
  97 };
  98 
  99 class VM_ShenandoahFinalUpdateRefs: public VM_ShenandoahOperation {
 100 public:
 101   VM_ShenandoahFinalUpdateRefs() : VM_ShenandoahOperation() {};
 102   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalUpdateRefs; }
 103   const char* name()             const { return "Shenandoah Final Update References"; }
 104   virtual void doit();
 105 };
 106 
 107 #endif //SHARE_VM_GC_SHENANDOAH_VM_OPERATIONS_SHENANDOAH_HPP