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 G1CollectedHeap::in_cset_state_t in_cset_state = _g1h->in_cset_state(obj);
42 if (in_cset_state == G1CollectedHeap::InCSet) {
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(obj, m);
49 }
50 oopDesc::encode_store_heap_oop(p, forwardee);
51 } else if (in_cset_state == G1CollectedHeap::IsHumongous) {
52 _g1h->set_humongous_is_live(obj);
53 } else {
54 assert(in_cset_state == G1CollectedHeap::InNeither,
55 err_msg("In_cset_state must be InNeither here, but is %d", in_cset_state));
56 }
57
58 assert(obj != NULL, "Must be");
59 update_rs(from, p, queue_num());
60 }
61
62 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) {
63 assert(has_partial_array_mask(p), "invariant");
64 oop from_obj = clear_partial_array_mask(p);
65
66 assert(Universe::heap()->is_in_reserved(from_obj), "must be in heap.");
67 assert(from_obj->is_objArray(), "must be obj array");
68 objArrayOop from_obj_array = objArrayOop(from_obj);
69 // The from-space object contains the real length.
70 int length = from_obj_array->length();
71
72 assert(from_obj->is_forwarded(), "must be forwarded");
73 oop to_obj = from_obj->forwardee();
74 assert(from_obj != to_obj, "should not be chunking self-forwarded objects");
75 objArrayOop to_obj_array = objArrayOop(to_obj);
|
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 in_cset_state_t in_cset_state = _g1h->in_cset_state(obj);
42 if (InCSetState::is_in_cset(in_cset_state)) {
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 }
50 oopDesc::encode_store_heap_oop(p, forwardee);
51 } else if (InCSetState::is_humongous(in_cset_state)) {
52 _g1h->set_humongous_is_live(obj);
53 } else {
54 assert(InCSetState::is_not_in_cset(in_cset_state),
55 err_msg("In_cset_state must be NotInCSet here, but is %d", in_cset_state));
56 }
57
58 assert(obj != NULL, "Must be");
59 update_rs(from, p, queue_num());
60 }
61
62 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) {
63 assert(has_partial_array_mask(p), "invariant");
64 oop from_obj = clear_partial_array_mask(p);
65
66 assert(Universe::heap()->is_in_reserved(from_obj), "must be in heap.");
67 assert(from_obj->is_objArray(), "must be obj array");
68 objArrayOop from_obj_array = objArrayOop(from_obj);
69 // The from-space object contains the real length.
70 int length = from_obj_array->length();
71
72 assert(from_obj->is_forwarded(), "must be forwarded");
73 oop to_obj = from_obj->forwardee();
74 assert(from_obj != to_obj, "should not be chunking self-forwarded objects");
75 objArrayOop to_obj_array = objArrayOop(to_obj);
|