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