1 /*
2 * Copyright (c) 2015, 2017, 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 */
83 do_oop_nv(p);
84 }
85
86 template <bool finalizable>
87 inline void ZMarkBarrierOopClosure<finalizable>::do_oop(narrowOop* p) {
88 do_oop_nv(p);
89 }
90
91 inline bool ZPhantomIsAliveObjectClosure::do_object_b(oop o) {
92 return ZBarrier::is_alive_barrier_on_phantom_oop(o);
93 }
94
95 inline void ZPhantomKeepAliveOopClosure::do_oop(oop* p) {
96 ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
97 }
98
99 inline void ZPhantomKeepAliveOopClosure::do_oop(narrowOop* p) {
100 ShouldNotReachHere();
101 }
102
103 inline void ZPhantomCleanOopClosure::clean(volatile oop* p) {
104 oop obj = *p;
105 if (ZBarrier::is_alive_barrier_on_phantom_oop(obj)) {
106 ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
107 } else {
108 Atomic::cmpxchg(oop(NULL), p, obj);
109 }
110 }
111
112 inline void ZPhantomCleanOopClosure::do_oop(oop* p) {
113 clean(p);
114 }
115
116 inline void ZPhantomCleanOopClosure::do_oop(narrowOop* p) {
117 ShouldNotReachHere();
118 }
119
120 #endif // SHARE_GC_Z_ZOOPCLOSURES_INLINE_HPP
|
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 */
83 do_oop_nv(p);
84 }
85
86 template <bool finalizable>
87 inline void ZMarkBarrierOopClosure<finalizable>::do_oop(narrowOop* p) {
88 do_oop_nv(p);
89 }
90
91 inline bool ZPhantomIsAliveObjectClosure::do_object_b(oop o) {
92 return ZBarrier::is_alive_barrier_on_phantom_oop(o);
93 }
94
95 inline void ZPhantomKeepAliveOopClosure::do_oop(oop* p) {
96 ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
97 }
98
99 inline void ZPhantomKeepAliveOopClosure::do_oop(narrowOop* p) {
100 ShouldNotReachHere();
101 }
102
103 inline void ZPhantomCleanOopClosure::do_oop(oop* p) {
104 // Read the oop once, to make sure the liveness check
105 // and the later clearing uses the same value.
106 const oop obj = *(volatile oop*)p;
107 if (ZBarrier::is_alive_barrier_on_phantom_oop(obj)) {
108 ZBarrier::keep_alive_barrier_on_phantom_oop_field(p);
109 } else {
110 // The destination could have been modified/reused, in which case
111 // we don't want to clear it. However, no one could write the same
112 // oop here again (the object would be strongly live and we would
113 // not consider clearing such oops), so therefore we don't have an
114 // ABA problem here.
115 Atomic::cmpxchg(oop(NULL), p, obj);
116 }
117 }
118
119 inline void ZPhantomCleanOopClosure::do_oop(narrowOop* p) {
120 ShouldNotReachHere();
121 }
122
123 #endif // SHARE_GC_Z_ZOOPCLOSURES_INLINE_HPP
|