1 /*
2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. 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_Z_ZOOPCLOSURES_HPP
25 #define SHARE_GC_Z_ZOOPCLOSURES_HPP
26 
27 #include "memory/iterator.hpp"
28 
29 class ZLoadBarrierOopClosure : public BasicOopIterateClosure {
30 public:
31   virtual void do_oop(oop* p);
32   virtual void do_oop(narrowOop* p);
33 
34 #ifdef ASSERT
should_verify_oops()35   virtual bool should_verify_oops() {
36     return false;
37   }
38 #endif
39 };
40 
41 class ZMarkRootOopClosure : public OopClosure {
42 public:
43   virtual void do_oop(oop* p);
44   virtual void do_oop(narrowOop* p);
45 };
46 
47 class ZRelocateRootOopClosure : public OopClosure {
48 public:
49   virtual void do_oop(oop* p);
50   virtual void do_oop(narrowOop* p);
51 };
52 
53 template <bool finalizable>
54 class ZMarkBarrierOopClosure : public BasicOopIterateClosure {
55 public:
56   ZMarkBarrierOopClosure();
57 
58   virtual void do_oop(oop* p);
59   virtual void do_oop(narrowOop* p);
60 
61 #ifdef ASSERT
should_verify_oops()62   virtual bool should_verify_oops() {
63     return false;
64   }
65 #endif
66 };
67 
68 class ZPhantomIsAliveObjectClosure : public BoolObjectClosure {
69 public:
70   virtual bool do_object_b(oop o);
71 };
72 
73 class ZPhantomKeepAliveOopClosure : public OopClosure {
74 public:
75   virtual void do_oop(oop* p);
76   virtual void do_oop(narrowOop* p);
77 };
78 
79 class ZPhantomCleanOopClosure : public OopClosure {
80 public:
81   virtual void do_oop(oop* p);
82   virtual void do_oop(narrowOop* p);
83 };
84 
85 class ZVerifyHeapOopClosure : public BasicOopIterateClosure {
86 public:
87   virtual ReferenceIterationMode reference_iteration_mode();
88 
89   virtual void do_oop(oop* p);
90   virtual void do_oop(narrowOop* p);
91 
92 #ifdef ASSERT
93   // Verification handled by the closure itself.
should_verify_oops()94   virtual bool should_verify_oops() {
95     return false;
96   }
97 #endif
98 };
99 
100 class ZVerifyRootOopClosure : public OopClosure {
101 public:
102   ZVerifyRootOopClosure();
103 
104   virtual void do_oop(oop* p);
105   virtual void do_oop(narrowOop* p);
106 };
107 
108 class ZVerifyObjectClosure : public ObjectClosure {
109 public:
110   virtual void do_object(oop o);
111 };
112 
113 #endif // SHARE_GC_Z_ZOOPCLOSURES_HPP
114