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_G1_G1PARSCANTHREADSTATE_INLINE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1PARSCANTHREADSTATE_INLINE_HPP
27
28 #include "gc_implementation/g1/g1ParScanThreadState.hpp"
29 #include "gc_implementation/g1/g1RemSet.inline.hpp"
30 #include "oops/oop.inline.hpp"
31
32 template <class T> void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from) {
33 assert(!oopDesc::is_null(oopDesc::load_decode_heap_oop(p)),
34 "Reference should not be NULL here as such are never pushed to the task queue.");
35 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
36
37 // Although we never intentionally push references outside of the collection
38 // set, due to (benign) races in the claim mechanism during RSet scanning more
39 // than one thread might claim the same card. So the same card may be
40 // processed multiple times. So redo this check.
41 const InCSetState in_cset_state = _g1h->in_cset_state(obj);
42 if (in_cset_state.is_in_cset()) {
43 oop forwardee;
44 markOop m = obj->mark();
45 if (m->is_marked()) {
46 forwardee = (oop) m->decode_pointer();
47 } else {
48 forwardee = copy_to_survivor_space(in_cset_state, obj, m);
49 }
130 if (ref.is_narrow()) {
131 deal_with_reference((narrowOop*)ref);
132 } else {
133 deal_with_reference((oop*)ref);
134 }
135 }
136
137 void G1ParScanThreadState::steal_and_trim_queue(RefToScanQueueSet *task_queues) {
138 StarTask stolen_task;
139 while (task_queues->steal(queue_num(), hash_seed(), stolen_task)) {
140 assert(verify_task(stolen_task), "sanity");
141 dispatch_reference(stolen_task);
142
143 // We've just processed a reference and we might have made
144 // available new entries on the queues. So we have to make sure
145 // we drain the queues as necessary.
146 trim_queue();
147 }
148 }
149
150 #endif /* SHARE_VM_GC_IMPLEMENTATION_G1_G1PARSCANTHREADSTATE_INLINE_HPP */
151
|
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_G1_G1PARSCANTHREADSTATE_INLINE_HPP
26 #define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
27
28 #include "gc/g1/g1ParScanThreadState.hpp"
29 #include "gc/g1/g1RemSet.inline.hpp"
30 #include "oops/oop.inline.hpp"
31
32 template <class T> void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from) {
33 assert(!oopDesc::is_null(oopDesc::load_decode_heap_oop(p)),
34 "Reference should not be NULL here as such are never pushed to the task queue.");
35 oop obj = oopDesc::load_decode_heap_oop_not_null(p);
36
37 // Although we never intentionally push references outside of the collection
38 // set, due to (benign) races in the claim mechanism during RSet scanning more
39 // than one thread might claim the same card. So the same card may be
40 // processed multiple times. So redo this check.
41 const InCSetState in_cset_state = _g1h->in_cset_state(obj);
42 if (in_cset_state.is_in_cset()) {
43 oop forwardee;
44 markOop m = obj->mark();
45 if (m->is_marked()) {
46 forwardee = (oop) m->decode_pointer();
47 } else {
48 forwardee = copy_to_survivor_space(in_cset_state, obj, m);
49 }
130 if (ref.is_narrow()) {
131 deal_with_reference((narrowOop*)ref);
132 } else {
133 deal_with_reference((oop*)ref);
134 }
135 }
136
137 void G1ParScanThreadState::steal_and_trim_queue(RefToScanQueueSet *task_queues) {
138 StarTask stolen_task;
139 while (task_queues->steal(queue_num(), hash_seed(), stolen_task)) {
140 assert(verify_task(stolen_task), "sanity");
141 dispatch_reference(stolen_task);
142
143 // We've just processed a reference and we might have made
144 // available new entries on the queues. So we have to make sure
145 // we drain the queues as necessary.
146 trim_queue();
147 }
148 }
149
150 #endif /* SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP */
151
|