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_Z_ZOOPCLOSURES_INLINE_HPP
24 #define SHARE_GC_Z_ZOOPCLOSURES_INLINE_HPP
25
26 #include "gc/z/zBarrier.inline.hpp"
27 #include "gc/z/zHeap.inline.hpp"
28 #include "gc/z/zOop.inline.hpp"
29 #include "gc/z/zOopClosures.hpp"
30 #include "oops/oop.inline.hpp"
31 #include "runtime/atomic.hpp"
32 #include "utilities/debug.hpp"
33
34 inline void ZLoadBarrierOopClosure::do_oop(oop* p) {
35 ZBarrier::load_barrier_on_oop_field(p);
36 }
37
38 inline void ZLoadBarrierOopClosure::do_oop(narrowOop* p) {
39 ShouldNotReachHere();
40 }
41
42 inline void ZMarkRootOopClosure::do_oop(oop* p) {
43 ZBarrier::mark_barrier_on_root_oop_field(p);
44 }
45
46 inline void ZMarkRootOopClosure::do_oop(narrowOop* p) {
47 ShouldNotReachHere();
48 }
49
50 inline void ZRelocateRootOopClosure::do_oop(oop* p) {
51 ZBarrier::relocate_barrier_on_root_oop_field(p);
52 }
53
54 inline void ZRelocateRootOopClosure::do_oop(narrowOop* p) {
55 ShouldNotReachHere();
56 }
57
58 template <bool finalizable>
59 inline ZMarkBarrierOopClosure<finalizable>::ZMarkBarrierOopClosure() :
60 BasicOopIterateClosure(finalizable ? NULL : ZHeap::heap()->reference_discoverer()) {}
61
62 template <bool finalizable>
63 inline void ZMarkBarrierOopClosure<finalizable>::do_oop(oop* p) {
64 ZBarrier::mark_barrier_on_oop_field(p, finalizable);
65 }
66
67 template <bool finalizable>
68 inline void ZMarkBarrierOopClosure<finalizable>::do_oop(narrowOop* p) {
69 ShouldNotReachHere();
70 }
71
72 inline bool ZPhantomIsAliveObjectClosure::do_object_b(oop o) {
73 return ZBarrier::is_alive_barrier_on_phantom_oop(o);
74 }
75
76 inline void ZPhantomKeepAliveOopClosure::do_oop(oop* p) {
77 ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
78 }
79
80 inline void ZPhantomKeepAliveOopClosure::do_oop(narrowOop* p) {
81 ShouldNotReachHere();
82 }
83
84 inline void ZPhantomCleanOopClosure::do_oop(oop* p) {
85 // Read the oop once, to make sure the liveness check
86 // and the later clearing uses the same value.
87 const oop obj = *(volatile oop*)p;
88 if (ZBarrier::is_alive_barrier_on_phantom_oop(obj)) {
|
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_Z_ZOOPCLOSURES_INLINE_HPP
24 #define SHARE_GC_Z_ZOOPCLOSURES_INLINE_HPP
25
26 #include "classfile/classLoaderData.inline.hpp"
27 #include "gc/z/zAddress.inline.hpp"
28 #include "gc/z/zBarrier.inline.hpp"
29 #include "gc/z/zHeap.inline.hpp"
30 #include "gc/z/zOop.inline.hpp"
31 #include "gc/z/zOopClosures.hpp"
32 #include "oops/oop.inline.hpp"
33 #include "runtime/atomic.hpp"
34 #include "utilities/debug.hpp"
35
36 inline void ZLoadBarrierOopClosure::do_oop(oop* p) {
37 ZBarrier::load_barrier_on_oop_field(p);
38 }
39
40 inline void ZLoadBarrierOopClosure::do_oop(narrowOop* p) {
41 ShouldNotReachHere();
42 }
43
44 inline void ZMarkRootOopClosure::do_oop(oop* p) {
45 ZBarrier::mark_barrier_on_root_oop_field(p);
46 }
47
48 inline void ZMarkRootOopClosure::do_oop(narrowOop* p) {
49 ShouldNotReachHere();
50 }
51
52 inline void ZRelocateRootOopClosure::do_oop(oop* p) {
53 ZBarrier::relocate_barrier_on_root_oop_field(p);
54 }
55
56 inline void ZRelocateRootOopClosure::do_oop(narrowOop* p) {
57 ShouldNotReachHere();
58 }
59
60 template <bool finalizable>
61 inline ZMarkBarrierOopClosure<finalizable>::ZMarkBarrierOopClosure() :
62 OopIterateClosure(finalizable ? NULL : ZHeap::heap()->reference_discoverer()) {}
63
64 template <bool finalizable>
65 inline void ZMarkBarrierOopClosure<finalizable>::do_oop(oop* p) {
66 ZBarrier::mark_barrier_on_oop_field(p, finalizable);
67 }
68
69 template <bool finalizable>
70 inline void ZMarkBarrierOopClosure<finalizable>::do_oop(narrowOop* p) {
71 ShouldNotReachHere();
72 }
73
74 template <bool finalizable>
75 inline bool ZMarkBarrierOopClosure<finalizable>::do_metadata() {
76 return ClassUnloading;
77 }
78
79 template <bool finalizable>
80 inline void ZMarkBarrierOopClosure<finalizable>::do_klass(Klass* k) {
81 ClassLoaderData* cld = k->class_loader_data();
82 if (!cld->claim(finalizable)) {
83 return;
84 }
85 oop holder = cld->holder_no_keepalive();
86 if (holder == NULL) {
87 return;
88 }
89 if (finalizable) {
90 ZHeap::heap()->mark_object<true, false>(ZOop::to_address(holder));
91 } else {
92 ZHeap::heap()->mark_object<false, false>(ZOop::to_address(holder));
93 }
94 }
95
96 template <bool finalizable>
97 inline void ZMarkBarrierOopClosure<finalizable>::do_cld(ClassLoaderData* cld) {
98 ZMarkBarrierOopClosure<finalizable> cl;
99 cld->oops_do(&cl, false /* must_claim */);
100 }
101
102 inline bool ZPhantomIsAliveObjectClosure::do_object_b(oop o) {
103 return ZBarrier::is_alive_barrier_on_phantom_oop(o);
104 }
105
106 inline void ZPhantomKeepAliveOopClosure::do_oop(oop* p) {
107 ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
108 }
109
110 inline void ZPhantomKeepAliveOopClosure::do_oop(narrowOop* p) {
111 ShouldNotReachHere();
112 }
113
114 inline void ZPhantomCleanOopClosure::do_oop(oop* p) {
115 // Read the oop once, to make sure the liveness check
116 // and the later clearing uses the same value.
117 const oop obj = *(volatile oop*)p;
118 if (ZBarrier::is_alive_barrier_on_phantom_oop(obj)) {
|