1 /*
   2  * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHVMOPERATIONS_HPP
  26 #define SHARE_GC_SHENANDOAH_SHENANDOAHVMOPERATIONS_HPP
  27 
  28 #include "gc/shared/gcVMOperations.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 
  40 class VM_ShenandoahOperation : public VM_Operation {
  41 protected:
  42   uint         _gc_id;
  43 public:
  44   VM_ShenandoahOperation() : _gc_id(GCId::current()) {};
  45 };
  46 
  47 class VM_ShenandoahReferenceOperation : public VM_ShenandoahOperation {
  48 public:
  49   VM_ShenandoahReferenceOperation() : VM_ShenandoahOperation() {};
  50   bool doit_prologue();
  51   void doit_epilogue();
  52 };
  53 
  54 class VM_ShenandoahInitMark: public VM_ShenandoahOperation {
  55 public:
  56   VM_ShenandoahInitMark() : VM_ShenandoahOperation() {};
  57   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitMark; }
  58   const char* name()             const { return "Shenandoah Init Marking"; }
  59   virtual void doit();
  60 };
  61 
  62 class VM_ShenandoahFinalMarkStartEvac: public VM_ShenandoahReferenceOperation {
  63 public:
  64   VM_ShenandoahFinalMarkStartEvac() : VM_ShenandoahReferenceOperation() {};
  65   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalMarkStartEvac; }
  66   const char* name()             const { return "Shenandoah Final Mark and Start Evacuation"; }
  67   virtual  void doit();
  68 };
  69 
  70 class VM_ShenandoahDegeneratedGC: public VM_ShenandoahReferenceOperation {
  71 private:
  72   // Really the ShenandoahHeap::ShenandoahDegenerationPoint, but casted to int here
  73   // in order to avoid dependency on ShenandoahHeap
  74   int _point;
  75 public:
  76   VM_ShenandoahDegeneratedGC(int point) : VM_ShenandoahReferenceOperation(), _point(point) {};
  77   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahDegeneratedGC; }
  78   const char* name()             const { return "Shenandoah Degenerated GC"; }
  79   virtual  void doit();
  80 };
  81 
  82 class VM_ShenandoahFullGC : public VM_ShenandoahReferenceOperation {
  83 private:
  84   GCCause::Cause _gc_cause;
  85 public:
  86   VM_ShenandoahFullGC(GCCause::Cause gc_cause) : VM_ShenandoahReferenceOperation(), _gc_cause(gc_cause) {};
  87   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFullGC; }
  88   const char* name()             const { return "Shenandoah Full GC"; }
  89   virtual void doit();
  90 };
  91 
  92 class VM_ShenandoahInitUpdateRefs: public VM_ShenandoahOperation {
  93 public:
  94   VM_ShenandoahInitUpdateRefs() : VM_ShenandoahOperation() {};
  95   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitUpdateRefs; }
  96   const char* name()             const { return "Shenandoah Init Update References"; }
  97   virtual void doit();
  98 };
  99 
 100 class VM_ShenandoahFinalUpdateRefs: public VM_ShenandoahOperation {
 101 public:
 102   VM_ShenandoahFinalUpdateRefs() : VM_ShenandoahOperation() {};
 103   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFinalUpdateRefs; }
 104   const char* name()             const { return "Shenandoah Final Update References"; }
 105   virtual void doit();
 106 };
 107 
 108 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHVMOPERATIONS_HPP