< prev index next >

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

Print this page

537   debug_only(HeapWord* prev_obj = NULL);
538   while (cur_obj < end_of_live) {
539     if (!cast_to_oop(cur_obj)->is_gc_marked()) {
540       debug_only(prev_obj = cur_obj);
541       // The first word of the dead object contains a pointer to the next live object or end of space.
542       cur_obj = *(HeapWord**)cur_obj;
543       assert(cur_obj > prev_obj, "we should be moving forward through memory");
544     } else {
545       // prefetch beyond q
546       Prefetch::read(cur_obj, scan_interval);
547 
548       // size and destination
549       size_t size = cast_to_oop(cur_obj)->size();
550       HeapWord* compaction_top = cast_from_oop<HeapWord*>(cast_to_oop(cur_obj)->forwardee());
551 
552       // prefetch beyond compaction_top
553       Prefetch::write(compaction_top, copy_interval);
554 
555       // copy object and reinit its mark
556       assert(cur_obj != compaction_top, "everything in this pass should be moving");
557       Copy::aligned_conjoint_words(cur_obj, compaction_top, size);
558       cast_to_oop(compaction_top)->init_mark();
559       assert(cast_to_oop(compaction_top)->klass() != NULL, "should have a class");
560 
561       debug_only(prev_obj = cur_obj);
562       cur_obj += size;
563     }
564   }
565 
566   clear_empty_region(this);
567 }
568 
569 #endif // INCLUDE_SERIALGC
570 
571 void Space::print_short() const { print_short_on(tty); }
572 
573 void Space::print_short_on(outputStream* st) const {
574   st->print(" space " SIZE_FORMAT "K, %3d%% used", capacity() / K,
575               (int) ((double) used() * 100 / capacity()));
576 }
577 

537   debug_only(HeapWord* prev_obj = NULL);
538   while (cur_obj < end_of_live) {
539     if (!cast_to_oop(cur_obj)->is_gc_marked()) {
540       debug_only(prev_obj = cur_obj);
541       // The first word of the dead object contains a pointer to the next live object or end of space.
542       cur_obj = *(HeapWord**)cur_obj;
543       assert(cur_obj > prev_obj, "we should be moving forward through memory");
544     } else {
545       // prefetch beyond q
546       Prefetch::read(cur_obj, scan_interval);
547 
548       // size and destination
549       size_t size = cast_to_oop(cur_obj)->size();
550       HeapWord* compaction_top = cast_from_oop<HeapWord*>(cast_to_oop(cur_obj)->forwardee());
551 
552       // prefetch beyond compaction_top
553       Prefetch::write(compaction_top, copy_interval);
554 
555       // copy object and reinit its mark
556       assert(cur_obj != compaction_top, "everything in this pass should be moving");
557       cast_to_oop(cur_obj)->copy_conjoint(compaction_top, size);
558       cast_to_oop(compaction_top)->init_mark();
559       assert(cast_to_oop(compaction_top)->klass() != NULL, "should have a class");
560 
561       debug_only(prev_obj = cur_obj);
562       cur_obj += size;
563     }
564   }
565 
566   clear_empty_region(this);
567 }
568 
569 #endif // INCLUDE_SERIALGC
570 
571 void Space::print_short() const { print_short_on(tty); }
572 
573 void Space::print_short_on(outputStream* st) const {
574   st->print(" space " SIZE_FORMAT "K, %3d%% used", capacity() / K,
575               (int) ((double) used() * 100 / capacity()));
576 }
577 
< prev index next >