1 /* 2 * Copyright (c) 2019, 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 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP 24 #define SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP 25 26 #include "memory/iterator.hpp" 27 28 class ShenandoahHeap; 29 class ShenandoahMarkingContext; 30 class ShenandoahHeapRegionSet; 31 class Thread; 32 33 class ShenandoahForwardedIsAliveClosure: public BoolObjectClosure { 34 private: 35 ShenandoahMarkingContext* const _mark_context; 36 public: 37 inline ShenandoahForwardedIsAliveClosure(); 38 inline bool do_object_b(oop obj); 39 }; 40 41 class ShenandoahIsAliveClosure: public BoolObjectClosure { 42 private: 43 ShenandoahMarkingContext* const _mark_context; 44 public: 45 inline ShenandoahIsAliveClosure(); 46 inline bool do_object_b(oop obj); 47 }; 48 49 class ShenandoahIsAliveSelector : public StackObj { 50 private: 51 ShenandoahIsAliveClosure _alive_cl; 52 ShenandoahForwardedIsAliveClosure _fwd_alive_cl; 53 public: 54 inline BoolObjectClosure* is_alive_closure(); 55 }; 56 57 class ShenandoahUpdateRefsClosure: public OopClosure { 58 private: 59 ShenandoahHeap* _heap; 60 public: 61 inline ShenandoahUpdateRefsClosure(); 62 inline void do_oop(oop* p); 63 inline void do_oop(narrowOop* p); 64 private: 65 template <class T> 66 inline void do_oop_work(T* p); 67 }; 68 69 class ShenandoahTraversalUpdateRefsClosure: public OopClosure { 70 private: 71 ShenandoahHeap* const _heap; 72 ShenandoahHeapRegionSet* const _traversal_set; 73 74 public: 75 inline ShenandoahTraversalUpdateRefsClosure(); 76 inline void do_oop(oop* p); 77 inline void do_oop(narrowOop* p); 78 private: 79 template <class T> 80 inline void do_oop_work(T* p); 81 }; 82 83 class ShenandoahEvacuateUpdateRootsClosure: public BasicOopIterateClosure { 84 private: 85 ShenandoahHeap* _heap; 86 Thread* _thread; 87 public: 88 inline ShenandoahEvacuateUpdateRootsClosure(); 89 inline void do_oop(oop* p); 90 inline void do_oop(narrowOop* p); 91 92 private: 93 template <class T> 94 inline void do_oop_work(T* p); 95 }; 96 97 class ShenandoahEvacUpdateOopStorageRootsClosure : public BasicOopIterateClosure { 98 private: 99 ShenandoahHeap* _heap; 100 Thread* _thread; 101 public: 102 inline ShenandoahEvacUpdateOopStorageRootsClosure(); 103 inline void do_oop(oop* p); 104 inline void do_oop(narrowOop* p); 105 }; 106 107 class ShenandoahCodeBlobAndDisarmClosure: public CodeBlobToOopClosure { 108 private: 109 BarrierSetNMethod* const _bs; 110 111 public: 112 inline ShenandoahCodeBlobAndDisarmClosure(OopClosure* cl); 113 inline void do_code_blob(CodeBlob* cb); 114 }; 115 116 #ifdef ASSERT 117 class ShenandoahAssertNotForwardedClosure : public OopClosure { 118 private: 119 template <class T> 120 inline void do_oop_work(T* p); 121 122 public: 123 inline void do_oop(narrowOop* p); 124 inline void do_oop(oop* p); 125 }; 126 #endif // ASSERT 127 128 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP