< prev index next >

src/share/vm/gc/shared/space.cpp

Print this page




 394     q->forward_to(oop(compact_top));
 395     assert(q->is_gc_marked(), "encoding the pointer should preserve the mark");
 396   } else {
 397     // if the object isn't moving we can just set the mark to the default
 398     // mark and handle it specially later on.
 399     q->init_mark();
 400     assert(q->forwardee() == NULL, "should be forwarded to NULL");
 401   }
 402 
 403   compact_top += size;
 404 
 405   // we need to update the offset table so that the beginnings of objects can be
 406   // found during scavenge.  Note that we are updating the offset table based on
 407   // where the object will be once the compaction phase finishes.
 408   if (compact_top > cp->threshold)
 409     cp->threshold =
 410       cp->space->cross_threshold(compact_top - size, compact_top);
 411   return compact_top;
 412 }
 413 
 414 
 415 bool CompactibleSpace::insert_deadspace(size_t& allowed_deadspace_words,
 416                                         HeapWord* q, size_t deadlength) {
 417   if (allowed_deadspace_words >= deadlength) {
 418     allowed_deadspace_words -= deadlength;
 419     CollectedHeap::fill_with_object(q, deadlength);
 420     oop(q)->set_mark(oop(q)->mark()->set_marked());
 421     assert((int) deadlength == oop(q)->size(), "bad filler object size");
 422     // Recall that we required "q == compaction_top".
 423     return true;
 424   } else {
 425     allowed_deadspace_words = 0;
 426     return false;
 427   }
 428 }
 429 
 430 void ContiguousSpace::prepare_for_compaction(CompactPoint* cp) {
 431   scan_and_forward(this, cp);
 432 }
 433 
 434 void CompactibleSpace::adjust_pointers() {
 435   // Check first is there is any work to do.
 436   if (used() == 0) {
 437     return;   // Nothing to do.
 438   }
 439 
 440   scan_and_adjust_pointers(this);
 441 }
 442 
 443 void CompactibleSpace::compact() {
 444   scan_and_compact(this);
 445 }
 446 
 447 void Space::print_short() const { print_short_on(tty); }
 448 
 449 void Space::print_short_on(outputStream* st) const {




 394     q->forward_to(oop(compact_top));
 395     assert(q->is_gc_marked(), "encoding the pointer should preserve the mark");
 396   } else {
 397     // if the object isn't moving we can just set the mark to the default
 398     // mark and handle it specially later on.
 399     q->init_mark();
 400     assert(q->forwardee() == NULL, "should be forwarded to NULL");
 401   }
 402 
 403   compact_top += size;
 404 
 405   // we need to update the offset table so that the beginnings of objects can be
 406   // found during scavenge.  Note that we are updating the offset table based on
 407   // where the object will be once the compaction phase finishes.
 408   if (compact_top > cp->threshold)
 409     cp->threshold =
 410       cp->space->cross_threshold(compact_top - size, compact_top);
 411   return compact_top;
 412 }
 413 
















 414 void ContiguousSpace::prepare_for_compaction(CompactPoint* cp) {
 415   scan_and_forward(this, cp);
 416 }
 417 
 418 void CompactibleSpace::adjust_pointers() {
 419   // Check first is there is any work to do.
 420   if (used() == 0) {
 421     return;   // Nothing to do.
 422   }
 423 
 424   scan_and_adjust_pointers(this);
 425 }
 426 
 427 void CompactibleSpace::compact() {
 428   scan_and_compact(this);
 429 }
 430 
 431 void Space::print_short() const { print_short_on(tty); }
 432 
 433 void Space::print_short_on(outputStream* st) const {


< prev index next >