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
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP
27
28 #include "gc_implementation/parNew/parNewGeneration.hpp"
29 #include "gc_implementation/parNew/parOopClosures.hpp"
30 #include "memory/cardTableRS.hpp"
31 #include "memory/genCollectedHeap.hpp"
32 #include "memory/genOopClosures.inline.hpp"
33
34 template <class T> inline void ParScanWeakRefClosure::do_oop_work(T* p) {
35 assert (!oopDesc::is_null(*p), "null weak reference?");
36 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
37 // weak references are sometimes scanned twice; must check
38 // that to-space doesn't already contain this object
39 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) {
40 // we need to ensure that it is copied (see comment in
41 // ParScanClosure::do_oop_work).
42 Klass* objK = obj->klass();
43 markOop m = obj->mark();
44 oop new_obj;
45 if (m->is_marked()) { // Contains forwarding pointer.
46 new_obj = ParNewGeneration::real_forwardee(obj);
47 } else {
48 size_t obj_sz = obj->size_given_klass(objK);
49 new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state,
50 obj, obj_sz, m);
51 }
52 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
126 // full:
127 (void)_par_scan_state->trim_queues(10 * ParallelGCThreads);
128 }
129 }
130 if (is_scanning_a_klass()) {
131 do_klass_barrier();
132 } else if (gc_barrier) {
133 // Now call parent closure
134 par_do_barrier(p);
135 }
136 }
137 }
138 }
139
140 inline void ParScanWithBarrierClosure::do_oop_nv(oop* p) { ParScanClosure::do_oop_work(p, true, false); }
141 inline void ParScanWithBarrierClosure::do_oop_nv(narrowOop* p) { ParScanClosure::do_oop_work(p, true, false); }
142
143 inline void ParScanWithoutBarrierClosure::do_oop_nv(oop* p) { ParScanClosure::do_oop_work(p, false, false); }
144 inline void ParScanWithoutBarrierClosure::do_oop_nv(narrowOop* p) { ParScanClosure::do_oop_work(p, false, false); }
145
146 #endif // SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_INLINE_HPP
|
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
25 #ifndef SHARE_VM_GC_CMS_PAROOPCLOSURES_INLINE_HPP
26 #define SHARE_VM_GC_CMS_PAROOPCLOSURES_INLINE_HPP
27
28 #include "gc/cms/parNewGeneration.hpp"
29 #include "gc/cms/parOopClosures.hpp"
30 #include "gc/shared/cardTableRS.hpp"
31 #include "gc/shared/genCollectedHeap.hpp"
32 #include "gc/shared/genOopClosures.inline.hpp"
33
34 template <class T> inline void ParScanWeakRefClosure::do_oop_work(T* p) {
35 assert (!oopDesc::is_null(*p), "null weak reference?");
36 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
37 // weak references are sometimes scanned twice; must check
38 // that to-space doesn't already contain this object
39 if ((HeapWord*)obj < _boundary && !_g->to()->is_in_reserved(obj)) {
40 // we need to ensure that it is copied (see comment in
41 // ParScanClosure::do_oop_work).
42 Klass* objK = obj->klass();
43 markOop m = obj->mark();
44 oop new_obj;
45 if (m->is_marked()) { // Contains forwarding pointer.
46 new_obj = ParNewGeneration::real_forwardee(obj);
47 } else {
48 size_t obj_sz = obj->size_given_klass(objK);
49 new_obj = ((ParNewGeneration*)_g)->copy_to_survivor_space(_par_scan_state,
50 obj, obj_sz, m);
51 }
52 oopDesc::encode_store_heap_oop_not_null(p, new_obj);
126 // full:
127 (void)_par_scan_state->trim_queues(10 * ParallelGCThreads);
128 }
129 }
130 if (is_scanning_a_klass()) {
131 do_klass_barrier();
132 } else if (gc_barrier) {
133 // Now call parent closure
134 par_do_barrier(p);
135 }
136 }
137 }
138 }
139
140 inline void ParScanWithBarrierClosure::do_oop_nv(oop* p) { ParScanClosure::do_oop_work(p, true, false); }
141 inline void ParScanWithBarrierClosure::do_oop_nv(narrowOop* p) { ParScanClosure::do_oop_work(p, true, false); }
142
143 inline void ParScanWithoutBarrierClosure::do_oop_nv(oop* p) { ParScanClosure::do_oop_work(p, false, false); }
144 inline void ParScanWithoutBarrierClosure::do_oop_nv(narrowOop* p) { ParScanClosure::do_oop_work(p, false, false); }
145
146 #endif // SHARE_VM_GC_CMS_PAROOPCLOSURES_INLINE_HPP
|