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