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 Thread; |
31 | |
32 | class ShenandoahForwardedIsAliveClosure: public BoolObjectClosure { |
33 | private: |
34 | ShenandoahMarkingContext* const _mark_context; |
35 | public: |
36 | inline ShenandoahForwardedIsAliveClosure(); |
37 | inline bool do_object_b(oop obj); |
38 | }; |
39 | |
40 | class ShenandoahIsAliveClosure: public BoolObjectClosure { |
41 | private: |
42 | ShenandoahMarkingContext* const _mark_context; |
43 | public: |
44 | inline ShenandoahIsAliveClosure(); |
45 | inline bool do_object_b(oop obj); |
46 | }; |
47 | |
48 | class ShenandoahIsAliveSelector : public StackObj { |
49 | private: |
50 | ShenandoahIsAliveClosure _alive_cl; |
51 | ShenandoahForwardedIsAliveClosure _fwd_alive_cl; |
52 | public: |
53 | inline BoolObjectClosure* is_alive_closure(); |
54 | }; |
55 | |
56 | class ShenandoahUpdateRefsClosure: public OopClosure { |
57 | private: |
58 | ShenandoahHeap* _heap; |
59 | public: |
60 | inline ShenandoahUpdateRefsClosure(); |
61 | inline void do_oop(oop* p); |
62 | inline void do_oop(narrowOop* p); |
63 | private: |
64 | template <class T> |
65 | inline void do_oop_work(T* p); |
66 | }; |
67 | |
68 | class ShenandoahEvacuateUpdateRootsClosure: public BasicOopIterateClosure { |
69 | private: |
70 | ShenandoahHeap* _heap; |
71 | Thread* _thread; |
72 | public: |
73 | inline ShenandoahEvacuateUpdateRootsClosure(); |
74 | inline void do_oop(oop* p); |
75 | inline void do_oop(narrowOop* p); |
76 | |
77 | private: |
78 | template <class T> |
79 | inline void do_oop_work(T* p); |
80 | }; |
81 | |
82 | #ifdef ASSERT |
83 | class ShenandoahAssertNotForwardedClosure : public OopClosure { |
84 | private: |
85 | template <class T> |
86 | inline void do_oop_work(T* p); |
87 | |
88 | public: |
89 | inline void do_oop(narrowOop* p); |
90 | inline void do_oop(oop* p); |
91 | }; |
92 | #endif // ASSERT |
93 | |
94 | #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP |
95 | |