215
216 template <class SpaceType>
217 inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) {
218 // adjust all the interior pointers to point at the new locations of objects
219 // Used by MarkSweep::mark_sweep_phase3()
220
221 HeapWord* cur_obj = space->bottom();
222 HeapWord* const end_of_live = space->_end_of_live; // Established by "scan_and_forward".
223 HeapWord* const first_dead = space->_first_dead; // Established by "scan_and_forward".
224
225 assert(first_dead <= end_of_live, "Stands to reason, no?");
226
227 const intx interval = PrefetchScanIntervalInBytes;
228
229 debug_only(HeapWord* prev_obj = NULL);
230 while (cur_obj < end_of_live) {
231 Prefetch::write(cur_obj, interval);
232 if (cur_obj < first_dead || oop(cur_obj)->is_gc_marked()) {
233 // cur_obj is alive
234 // point all the oops to the new location
235 size_t size = oop(cur_obj)->oop_iterate_size(&MarkSweep::adjust_pointer_closure);
236 size = space->adjust_obj_size(size);
237 debug_only(prev_obj = cur_obj);
238 cur_obj += size;
239 } else {
240 debug_only(prev_obj = cur_obj);
241 // cur_obj is not a live object, instead it points at the next live object
242 cur_obj = *(HeapWord**)cur_obj;
243 assert(cur_obj > prev_obj, "we should be moving forward through memory, cur_obj: " PTR_FORMAT ", prev_obj: " PTR_FORMAT, p2i(cur_obj), p2i(prev_obj));
244 }
245 }
246
247 assert(cur_obj == end_of_live, "just checking");
248 }
249
250 #ifdef ASSERT
251 template <class SpaceType>
252 inline void CompactibleSpace::verify_up_to_first_dead(SpaceType* space) {
253 HeapWord* cur_obj = space->bottom();
254
255 if (cur_obj < space->_end_of_live && space->_first_dead > cur_obj && !oop(cur_obj)->is_gc_marked()) {
|
215
216 template <class SpaceType>
217 inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) {
218 // adjust all the interior pointers to point at the new locations of objects
219 // Used by MarkSweep::mark_sweep_phase3()
220
221 HeapWord* cur_obj = space->bottom();
222 HeapWord* const end_of_live = space->_end_of_live; // Established by "scan_and_forward".
223 HeapWord* const first_dead = space->_first_dead; // Established by "scan_and_forward".
224
225 assert(first_dead <= end_of_live, "Stands to reason, no?");
226
227 const intx interval = PrefetchScanIntervalInBytes;
228
229 debug_only(HeapWord* prev_obj = NULL);
230 while (cur_obj < end_of_live) {
231 Prefetch::write(cur_obj, interval);
232 if (cur_obj < first_dead || oop(cur_obj)->is_gc_marked()) {
233 // cur_obj is alive
234 // point all the oops to the new location
235 size_t size = MarkSweep::adjust_pointers(oop(cur_obj));
236 size = space->adjust_obj_size(size);
237 debug_only(prev_obj = cur_obj);
238 cur_obj += size;
239 } else {
240 debug_only(prev_obj = cur_obj);
241 // cur_obj is not a live object, instead it points at the next live object
242 cur_obj = *(HeapWord**)cur_obj;
243 assert(cur_obj > prev_obj, "we should be moving forward through memory, cur_obj: " PTR_FORMAT ", prev_obj: " PTR_FORMAT, p2i(cur_obj), p2i(prev_obj));
244 }
245 }
246
247 assert(cur_obj == end_of_live, "just checking");
248 }
249
250 #ifdef ASSERT
251 template <class SpaceType>
252 inline void CompactibleSpace::verify_up_to_first_dead(SpaceType* space) {
253 HeapWord* cur_obj = space->bottom();
254
255 if (cur_obj < space->_end_of_live && space->_first_dead > cur_obj && !oop(cur_obj)->is_gc_marked()) {
|