61 inline void G1ScanClosureBase::handle_non_cset_obj_common(InCSetState const state, T* p, oop const obj) {
62 if (state.is_humongous()) {
63 _g1->set_humongous_is_live(obj);
64 } else if (state.is_ext()) {
65 _par_scan_state->do_oop_ext(p);
66 }
67 }
68
69 template <class T>
70 inline void G1ScanEvacuatedObjClosure::do_oop_nv(T* p) {
71 T heap_oop = oopDesc::load_heap_oop(p);
72
73 if (oopDesc::is_null(heap_oop)) {
74 return;
75 }
76 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
77 const InCSetState state = _g1->in_cset_state(obj);
78 if (state.is_in_cset()) {
79 prefetch_and_push(p, obj);
80 } else {
81 handle_non_cset_obj_common(state, p, obj);
82
83 _par_scan_state->update_rs(_from, p, obj);
84 }
85 }
86
87 template <class T>
88 inline void G1CMOopClosure::do_oop_nv(T* p) {
89 oop obj = oopDesc::load_decode_heap_oop(p);
90 _task->deal_with_reference(obj);
91 }
92
93 template <class T>
94 inline void G1RootRegionScanClosure::do_oop_nv(T* p) {
95 T heap_oop = oopDesc::load_heap_oop(p);
96 if (!oopDesc::is_null(heap_oop)) {
97 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
98 HeapRegion* hr = _g1h->heap_region_containing((HeapWord*) obj);
99 _cm->grayRoot(obj, hr);
100 }
101 }
102
154 if (oopDesc::is_null(o)) {
155 return;
156 }
157 oop obj = oopDesc::decode_heap_oop_not_null(o);
158
159 check_obj_during_refinement(p, obj);
160
161 assert(!_g1->is_in_cset((HeapWord*)p), "Oop originates from " PTR_FORMAT " (region: %u) which is in the collection set.", p2i(p), _g1->addr_to_region((HeapWord*)p));
162 const InCSetState state = _g1->in_cset_state(obj);
163 if (state.is_in_cset()) {
164 // Since the source is always from outside the collection set, here we implicitly know
165 // that this is a cross-region reference too.
166 prefetch_and_push(p, obj);
167
168 _has_refs_into_cset = true;
169 } else {
170 HeapRegion* to = _g1->heap_region_containing(obj);
171 if (_from == to) {
172 return;
173 }
174
175 handle_non_cset_obj_common(state, p, obj);
176
177 to->rem_set()->add_reference(p, _worker_i);
178 }
179 }
180
181 template <class T>
182 inline void G1ScanObjsDuringScanRSClosure::do_oop_nv(T* p) {
183 T heap_oop = oopDesc::load_heap_oop(p);
184 if (oopDesc::is_null(heap_oop)) {
185 return;
186 }
187 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
188
189 const InCSetState state = _g1->in_cset_state(obj);
190 if (state.is_in_cset()) {
191 prefetch_and_push(p, obj);
192 } else {
193 handle_non_cset_obj_common(state, p, obj);
194 }
195 }
196
197 template <class T>
198 void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) {
199 if (_g1->heap_region_containing(new_obj)->is_young()) {
200 _scanned_klass->record_modified_oops();
201 }
202 }
203
204 void G1ParCopyHelper::mark_object(oop obj) {
205 assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
206
207 // We know that the object is not moving so it's safe to read its size.
208 _cm->grayRoot(obj);
209 }
210
211 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
212 assert(from_obj->is_forwarded(), "from obj should be forwarded");
|
61 inline void G1ScanClosureBase::handle_non_cset_obj_common(InCSetState const state, T* p, oop const obj) {
62 if (state.is_humongous()) {
63 _g1->set_humongous_is_live(obj);
64 } else if (state.is_ext()) {
65 _par_scan_state->do_oop_ext(p);
66 }
67 }
68
69 template <class T>
70 inline void G1ScanEvacuatedObjClosure::do_oop_nv(T* p) {
71 T heap_oop = oopDesc::load_heap_oop(p);
72
73 if (oopDesc::is_null(heap_oop)) {
74 return;
75 }
76 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
77 const InCSetState state = _g1->in_cset_state(obj);
78 if (state.is_in_cset()) {
79 prefetch_and_push(p, obj);
80 } else {
81 if (HeapRegion::is_in_same_region(p, obj)) {
82 return;
83 }
84 handle_non_cset_obj_common(state, p, obj);
85 _par_scan_state->update_rs(_from, p, obj);
86 }
87 }
88
89 template <class T>
90 inline void G1CMOopClosure::do_oop_nv(T* p) {
91 oop obj = oopDesc::load_decode_heap_oop(p);
92 _task->deal_with_reference(obj);
93 }
94
95 template <class T>
96 inline void G1RootRegionScanClosure::do_oop_nv(T* p) {
97 T heap_oop = oopDesc::load_heap_oop(p);
98 if (!oopDesc::is_null(heap_oop)) {
99 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
100 HeapRegion* hr = _g1h->heap_region_containing((HeapWord*) obj);
101 _cm->grayRoot(obj, hr);
102 }
103 }
104
156 if (oopDesc::is_null(o)) {
157 return;
158 }
159 oop obj = oopDesc::decode_heap_oop_not_null(o);
160
161 check_obj_during_refinement(p, obj);
162
163 assert(!_g1->is_in_cset((HeapWord*)p), "Oop originates from " PTR_FORMAT " (region: %u) which is in the collection set.", p2i(p), _g1->addr_to_region((HeapWord*)p));
164 const InCSetState state = _g1->in_cset_state(obj);
165 if (state.is_in_cset()) {
166 // Since the source is always from outside the collection set, here we implicitly know
167 // that this is a cross-region reference too.
168 prefetch_and_push(p, obj);
169
170 _has_refs_into_cset = true;
171 } else {
172 HeapRegion* to = _g1->heap_region_containing(obj);
173 if (_from == to) {
174 return;
175 }
176 handle_non_cset_obj_common(state, p, obj);
177 to->rem_set()->add_reference(p, _worker_i);
178 }
179 }
180
181 template <class T>
182 inline void G1ScanObjsDuringScanRSClosure::do_oop_nv(T* p) {
183 T heap_oop = oopDesc::load_heap_oop(p);
184 if (oopDesc::is_null(heap_oop)) {
185 return;
186 }
187 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
188
189 const InCSetState state = _g1->in_cset_state(obj);
190 if (state.is_in_cset()) {
191 prefetch_and_push(p, obj);
192 } else {
193 if (HeapRegion::is_in_same_region(p, obj)) {
194 return;
195 }
196 handle_non_cset_obj_common(state, p, obj);
197 }
198 }
199
200 template <class T>
201 void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) {
202 if (_g1->heap_region_containing(new_obj)->is_young()) {
203 _scanned_klass->record_modified_oops();
204 }
205 }
206
207 void G1ParCopyHelper::mark_object(oop obj) {
208 assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
209
210 // We know that the object is not moving so it's safe to read its size.
211 _cm->grayRoot(obj);
212 }
213
214 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
215 assert(from_obj->is_forwarded(), "from obj should be forwarded");
|