< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.hpp

Print this page

  1 /*
  2  * Copyright (c) 2021, 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_SHENANDOAHCONCURRENTGC_HPP
 26 #define SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTGC_HPP
 27 
 28 #include "gc/shared/gcCause.hpp"
 29 #include "gc/shenandoah/shenandoahConcurrentMark.hpp"
 30 #include "gc/shenandoah/shenandoahGC.hpp"
 31 #include "gc/shenandoah/shenandoahHeap.hpp"
 32 


 33 class VM_ShenandoahInitMark;
 34 class VM_ShenandoahFinalMarkStartEvac;
 35 class VM_ShenandoahInitUpdateRefs;
 36 class VM_ShenandoahFinalUpdateRefs;
 37 
 38 class ShenandoahConcurrentGC : public ShenandoahGC {
 39   friend class VM_ShenandoahInitMark;
 40   friend class VM_ShenandoahFinalMarkStartEvac;
 41   friend class VM_ShenandoahInitUpdateRefs;
 42   friend class VM_ShenandoahFinalUpdateRefs;
 43   friend class VM_ShenandoahFinalRoots;
 44 



 45 private:
 46   ShenandoahConcurrentMark  _mark;
 47   ShenandoahDegenPoint      _degen_point;
 48   bool                      _abbreviated;



 49 
 50 public:
 51   ShenandoahConcurrentGC();
 52   bool collect(GCCause::Cause cause);
 53   ShenandoahDegenPoint degen_point() const;
 54 
 55   // Return true if this cycle found enough immediate garbage to skip evacuation
 56   bool abbreviated() const { return _abbreviated; }
 57 
 58   // Cancel ongoing concurrent GC
 59   static void cancel();
 60 private:
 61   // Entry points to STW GC operations, these cause a related safepoint, that then
 62   // call the entry method below
 63   void vmop_entry_init_mark();


 64   void vmop_entry_final_mark();



 65   void vmop_entry_init_updaterefs();
 66   void vmop_entry_final_updaterefs();
 67   void vmop_entry_final_roots();
 68 
 69   // Entry methods to normally STW GC operations. These set up logging, monitoring
 70   // and workers for net VM operation
 71   void entry_init_mark();
 72   void entry_final_mark();
 73   void entry_init_updaterefs();
 74   void entry_final_updaterefs();
 75   void entry_final_roots();
 76 
 77   // Entry methods to normally concurrent GC operations. These set up logging, monitoring
 78   // for concurrent operation.
 79   void entry_reset();
 80   void entry_mark_roots();



 81   void entry_mark();
 82   void entry_thread_roots();
 83   void entry_weak_refs();
 84   void entry_weak_roots();
 85   void entry_class_unloading();
 86   void entry_strong_roots();
 87   void entry_cleanup_early();


 88   void entry_evacuate();
 89   void entry_update_thread_roots();
 90   void entry_updaterefs();
 91   void entry_cleanup_complete();
 92 
 93   // Actual work for the phases
 94   void op_reset();
 95   void op_init_mark();
 96   void op_mark_roots();
 97   void op_mark();
 98   void op_final_mark();
 99   void op_thread_roots();
100   void op_weak_refs();
101   void op_weak_roots();
102   void op_class_unloading();
103   void op_strong_roots();
104   void op_cleanup_early();
105   void op_evacuate();
106   void op_init_updaterefs();
107   void op_updaterefs();
108   void op_update_thread_roots();
109   void op_final_updaterefs();
110   void op_final_roots();
111   void op_cleanup_complete();
112 




113   void start_mark();
114 
115   // Messages for GC trace events, they have to be immortal for
116   // passing around the logging/tracing systems
117   const char* init_mark_event_message() const;
118   const char* final_mark_event_message() const;
119   const char* conc_mark_event_message() const;
120 

121   // Check GC cancellation and abort concurrent GC
122   bool check_cancellation_and_abort(ShenandoahDegenPoint point);
123 };
124 
125 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTGC_HPP

  1 /*
  2  * Copyright (c) 2021, Red Hat, Inc. All rights reserved.
  3  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTGC_HPP
 27 #define SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTGC_HPP
 28 
 29 #include "gc/shared/gcCause.hpp"
 30 #include "gc/shenandoah/shenandoahConcurrentMark.hpp"
 31 #include "gc/shenandoah/shenandoahGC.hpp"
 32 #include "gc/shenandoah/shenandoahHeap.hpp"
 33 
 34 class ShenandoahGeneration;
 35 
 36 class VM_ShenandoahInitMark;
 37 class VM_ShenandoahFinalMarkStartEvac;
 38 class VM_ShenandoahInitUpdateRefs;
 39 class VM_ShenandoahFinalUpdateRefs;
 40 
 41 class ShenandoahConcurrentGC : public ShenandoahGC {
 42   friend class VM_ShenandoahInitMark;
 43   friend class VM_ShenandoahFinalMarkStartEvac;
 44   friend class VM_ShenandoahInitUpdateRefs;
 45   friend class VM_ShenandoahFinalUpdateRefs;
 46   friend class VM_ShenandoahFinalRoots;
 47 
 48 protected:
 49   ShenandoahConcurrentMark    _mark;
 50 
 51 private:
 52   ShenandoahDegenPoint        _degen_point;
 53   bool                        _abbreviated;
 54   const bool                  _do_old_gc_bootstrap;
 55 
 56 protected:
 57   ShenandoahGeneration* const _generation;
 58 
 59 public:
 60   ShenandoahConcurrentGC(ShenandoahGeneration* generation, bool do_old_gc_bootstrap);
 61   bool collect(GCCause::Cause cause);
 62   ShenandoahDegenPoint degen_point() const;
 63 
 64   // Return true if this cycle found enough immediate garbage to skip evacuation
 65   bool abbreviated() const { return _abbreviated; }
 66 


 67 private:
 68   // Entry points to STW GC operations, these cause a related safepoint, that then
 69   // call the entry method below
 70   void vmop_entry_init_mark();
 71 
 72 protected:
 73   void vmop_entry_final_mark();
 74   void vmop_entry_final_roots();
 75 
 76 private:
 77   void vmop_entry_init_updaterefs();
 78   void vmop_entry_final_updaterefs();

 79 
 80   // Entry methods to normally STW GC operations. These set up logging, monitoring
 81   // and workers for net VM operation
 82   void entry_init_mark();
 83   void entry_final_mark();
 84   void entry_init_updaterefs();
 85   void entry_final_updaterefs();
 86   void entry_final_roots();
 87 
 88   // Entry methods to normally concurrent GC operations. These set up logging, monitoring
 89   // for concurrent operation.
 90   void entry_reset();
 91   void entry_mark_roots();
 92   void entry_scan_remembered_set();
 93 
 94 protected:
 95   void entry_mark();
 96   void entry_thread_roots();
 97   void entry_weak_refs();
 98   void entry_weak_roots();
 99   void entry_class_unloading();
100   void entry_strong_roots();
101   void entry_cleanup_early();
102 
103 private:
104   void entry_evacuate();
105   void entry_update_thread_roots();
106   void entry_updaterefs();
107   void entry_cleanup_complete();
108 
109   // Actual work for the phases
110   void op_reset();
111   void op_init_mark();
112   void op_mark_roots();
113   void op_mark();

114   void op_thread_roots();
115   void op_weak_refs();
116   void op_weak_roots();
117   void op_class_unloading();
118   void op_strong_roots();
119   void op_cleanup_early();
120   void op_evacuate();
121   void op_init_updaterefs();
122   void op_updaterefs();
123   void op_update_thread_roots();
124   void op_final_updaterefs();
125   void op_final_roots();
126   void op_cleanup_complete();
127 
128 protected:
129   virtual void op_final_mark();
130 
131 private:
132   void start_mark();
133 
134   // Messages for GC trace events, they have to be immortal for
135   // passing around the logging/tracing systems
136   const char* init_mark_event_message() const;
137   const char* final_mark_event_message() const;
138   const char* conc_mark_event_message() const;
139 
140 protected:
141   // Check GC cancellation and abort concurrent GC
142   bool check_cancellation_and_abort(ShenandoahDegenPoint point);
143 };
144 
145 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTGC_HPP
< prev index next >