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 ShenandoahEvacuateUpdateRootsClosure: public BasicOopIterateClosure { 70 private: 71 ShenandoahHeap* _heap; 72 Thread* _thread; 73 public: 74 inline ShenandoahEvacuateUpdateRootsClosure(); 75 inline void do_oop(oop* p); 76 inline void do_oop(narrowOop* p); 77 78 private: 79 template <class T> 80 inline void do_oop_work(T* p); 81 }; 82 83 class ShenandoahEvacUpdateOopStorageRootsClosure : public BasicOopIterateClosure { 84 private: 85 ShenandoahHeap* _heap; 86 Thread* _thread; 87 public: 88 inline ShenandoahEvacUpdateOopStorageRootsClosure(); 89 inline void do_oop(oop* p); 90 inline void do_oop(narrowOop* p); 91 }; 92 93 class ShenandoahCodeBlobAndDisarmClosure: public CodeBlobToOopClosure { 94 private: 95 BarrierSetNMethod* const _bs; 96 97 public: 98 inline ShenandoahCodeBlobAndDisarmClosure(OopClosure* cl); 99 inline void do_code_blob(CodeBlob* cb); 100 }; 101 102 #ifdef ASSERT 103 class ShenandoahAssertNotForwardedClosure : public OopClosure { 104 private: 105 template <class T> 106 inline void do_oop_work(T* p); 107 108 public: 109 inline void do_oop(narrowOop* p); 110 inline void do_oop(oop* p); 111 }; 112 #endif // ASSERT 113 114 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP 115