< prev index next >

src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp

Print this page




 286 }
 287 
 288 void PSMarkSweepDecorator::adjust_pointers() {
 289   // adjust all the interior pointers to point at the new locations of objects
 290   // Used by MarkSweep::mark_sweep_phase3()
 291 
 292   HeapWord* q = space()->bottom();
 293   HeapWord* t = _end_of_live;  // Established by "prepare_for_compaction".
 294 
 295   assert(_first_dead <= _end_of_live, "Stands to reason, no?");
 296 
 297   if (q < t && _first_dead > q &&
 298       !oop(q)->is_gc_marked()) {
 299     // we have a chunk of the space which hasn't moved and we've
 300     // reinitialized the mark word during the previous pass, so we can't
 301     // use is_gc_marked for the traversal.
 302     HeapWord* end = _first_dead;
 303 
 304     while (q < end) {
 305       // point all the oops to the new location
 306       size_t size = oop(q)->adjust_pointers();
 307       q += size;
 308     }
 309 
 310     if (_first_dead == t) {
 311       q = t;
 312     } else {
 313       // $$$ This is funky.  Using this to read the previously written
 314       // LiveRange.  See also use below.
 315       q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer();
 316     }
 317   }
 318   const intx interval = PrefetchScanIntervalInBytes;
 319 
 320   debug_only(HeapWord* prev_q = NULL);
 321   while (q < t) {
 322     // prefetch beyond q
 323     Prefetch::write(q, interval);
 324     if (oop(q)->is_gc_marked()) {
 325       // q is alive
 326       // point all the oops to the new location
 327       size_t size = oop(q)->adjust_pointers();
 328       debug_only(prev_q = q);
 329       q += size;
 330     } else {
 331       // q is not a live object, so its mark should point at the next
 332       // live object
 333       debug_only(prev_q = q);
 334       q = (HeapWord*) oop(q)->mark()->decode_pointer();
 335       assert(q > prev_q, "we should be moving forward through memory");
 336     }
 337   }
 338 
 339   assert(q == t, "just checking");
 340 }
 341 
 342 void PSMarkSweepDecorator::compact(bool mangle_free_space ) {
 343   // Copy all live objects to their new location
 344   // Used by MarkSweep::mark_sweep_phase4()
 345 
 346   HeapWord*       q = space()->bottom();
 347   HeapWord* const t = _end_of_live;




 286 }
 287 
 288 void PSMarkSweepDecorator::adjust_pointers() {
 289   // adjust all the interior pointers to point at the new locations of objects
 290   // Used by MarkSweep::mark_sweep_phase3()
 291 
 292   HeapWord* q = space()->bottom();
 293   HeapWord* t = _end_of_live;  // Established by "prepare_for_compaction".
 294 
 295   assert(_first_dead <= _end_of_live, "Stands to reason, no?");
 296 
 297   if (q < t && _first_dead > q &&
 298       !oop(q)->is_gc_marked()) {
 299     // we have a chunk of the space which hasn't moved and we've
 300     // reinitialized the mark word during the previous pass, so we can't
 301     // use is_gc_marked for the traversal.
 302     HeapWord* end = _first_dead;
 303 
 304     while (q < end) {
 305       // point all the oops to the new location
 306       size_t size = MarkSweep::adjust_pointers(oop(q));
 307       q += size;
 308     }
 309 
 310     if (_first_dead == t) {
 311       q = t;
 312     } else {
 313       // $$$ This is funky.  Using this to read the previously written
 314       // LiveRange.  See also use below.
 315       q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer();
 316     }
 317   }
 318   const intx interval = PrefetchScanIntervalInBytes;
 319 
 320   debug_only(HeapWord* prev_q = NULL);
 321   while (q < t) {
 322     // prefetch beyond q
 323     Prefetch::write(q, interval);
 324     if (oop(q)->is_gc_marked()) {
 325       // q is alive
 326       // point all the oops to the new location
 327       size_t size = MarkSweep::adjust_pointers(oop(q));
 328       debug_only(prev_q = q);
 329       q += size;
 330     } else {
 331       // q is not a live object, so its mark should point at the next
 332       // live object
 333       debug_only(prev_q = q);
 334       q = (HeapWord*) oop(q)->mark()->decode_pointer();
 335       assert(q > prev_q, "we should be moving forward through memory");
 336     }
 337   }
 338 
 339   assert(q == t, "just checking");
 340 }
 341 
 342 void PSMarkSweepDecorator::compact(bool mangle_free_space ) {
 343   // Copy all live objects to their new location
 344   // Used by MarkSweep::mark_sweep_phase4()
 345 
 346   HeapWord*       q = space()->bottom();
 347   HeapWord* const t = _end_of_live;


< prev index next >