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 markOop m = obj->mark();
44 if (m->is_marked()) {
45 obj = (oop) m->decode_pointer();
46 } else {
47 obj = copy_to_survivor_space(in_cset_state, obj, m);
48 }
49 oopDesc::encode_store_heap_oop(p, obj);
50 } else if (in_cset_state.is_humongous()) {
51 _g1h->set_humongous_is_live(obj);
52 } else {
53 assert(in_cset_state.is_default() || in_cset_state.is_ext(),
54 "In_cset_state must be NotInCSet or Ext here, but is " CSETSTATE_FORMAT, in_cset_state.value());
55 }
56
57 assert(obj != NULL, "Must be");
58 update_rs(from, p, obj);
59 }
60
61 template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {
62 assert(verify_ref(ref), "sanity");
63 _refs->push(ref);
64 }
65
66 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) {
67 assert(has_partial_array_mask(p), "invariant");
68 oop from_obj = clear_partial_array_mask(p);
69
70 assert(_g1h->is_in_reserved(from_obj), "must be in heap.");
71 assert(from_obj->is_objArray(), "must be obj array");
72 objArrayOop from_obj_array = objArrayOop(from_obj);
73 // The from-space object contains the real length.
74 int length = from_obj_array->length();
75
76 assert(from_obj->is_forwarded(), "must be forwarded");
77 oop to_obj = from_obj->forwardee();
78 assert(from_obj != to_obj, "should not be chunking self-forwarded objects");
|
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 markOop m = obj->mark();
44 if (m->is_marked()) {
45 obj = (oop) m->decode_pointer();
46 } else {
47 obj = copy_to_survivor_space(in_cset_state, obj, m);
48 }
49 oopDesc::encode_store_heap_oop(p, obj);
50 } else {
51 if (in_cset_state.is_humongous()) {
52 _g1h->set_humongous_is_live(obj);
53 } else {
54 assert(in_cset_state.is_default() || in_cset_state.is_ext(),
55 "In_cset_state must be NotInCSet or Ext here, but is " CSETSTATE_FORMAT, in_cset_state.value());
56 }
57 }
58
59 assert(obj != NULL, "Must be");
60 if (!HeapRegion::is_in_same_region(p, obj)) {
61 update_rs(from, p, obj);
62 }
63 }
64
65 template <class T> inline void G1ParScanThreadState::push_on_queue(T* ref) {
66 assert(verify_ref(ref), "sanity");
67 _refs->push(ref);
68 }
69
70 inline void G1ParScanThreadState::do_oop_partial_array(oop* p) {
71 assert(has_partial_array_mask(p), "invariant");
72 oop from_obj = clear_partial_array_mask(p);
73
74 assert(_g1h->is_in_reserved(from_obj), "must be in heap.");
75 assert(from_obj->is_objArray(), "must be obj array");
76 objArrayOop from_obj_array = objArrayOop(from_obj);
77 // The from-space object contains the real length.
78 int length = from_obj_array->length();
79
80 assert(from_obj->is_forwarded(), "must be forwarded");
81 oop to_obj = from_obj->forwardee();
82 assert(from_obj != to_obj, "should not be chunking self-forwarded objects");
|