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_ShenandoahStartEvacuation: finish up concurrent marking, and start evacuation
  36 //       - VM_ShenandoahFullGC: do full GC
  37 
  38 class VM_ShenandoahOperation : public VM_Operation {
  39 protected:
  40   uint         _gc_id;
  41 public:
  42   VM_ShenandoahOperation() : _gc_id(GCId::current()) {};
  43 };
  44 
  45 class VM_ShenandoahReferenceOperation : public VM_ShenandoahOperation {
  46 public:
  47   VM_ShenandoahReferenceOperation() : VM_ShenandoahOperation() {};
  48   bool doit_prologue();
  49   void doit_epilogue();
  50 };
  51 
  52 class VM_ShenandoahInitMark: public VM_ShenandoahOperation {
  53 public:
  54   VM_ShenandoahInitMark() : VM_ShenandoahOperation() {};
  55   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahInitMark; }
  56   const char* name()             const { return "Shenandoah Initial Marking"; }
  57   virtual void doit();
  58 };
  59 
  60 class VM_ShenandoahStartEvacuation: public VM_ShenandoahReferenceOperation {
  61 public:
  62   VM_ShenandoahStartEvacuation() : VM_ShenandoahReferenceOperation() {};
  63   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahStartEvacuation; }
  64   const char* name()             const { return "Start Shenandoah evacuation"; }
  65   virtual  void doit();
  66 };
  67 
  68 class VM_ShenandoahFullGC : public VM_ShenandoahReferenceOperation {
  69 private:
  70   GCCause::Cause _gc_cause;
  71 public:
  72   VM_ShenandoahFullGC(GCCause::Cause gc_cause) : VM_ShenandoahReferenceOperation(), _gc_cause(gc_cause) {};
  73   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahFullGC; }
  74   const char* name()             const { return "Shenandoah Full GC"; }
  75   virtual void doit();
  76 };
  77 
  78 class VM_ShenandoahVerifyHeapAfterEvacuation: public VM_ShenandoahOperation {
  79 public:
  80   VM_ShenandoahVerifyHeapAfterEvacuation() : VM_ShenandoahOperation() {};
  81   VM_Operation::VMOp_Type type() const { return VMOp_ShenandoahVerifyHeapAfterEvacuation; }
  82   const char* name()             const { return "Shenandoah verify heap after evacuation"; }
  83   virtual void doit();
  84 };
  85 
  86 #endif //SHARE_VM_GC_SHENANDOAH_VM_OPERATIONS_SHENANDOAH_HPP