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