< prev index next >

src/share/vm/gc/g1/heapRegion.cpp

Print this page
rev 12936 : [mq]: 8xxxxxxx-rebuild-remembered-sets
rev 12939 : imported patch 8071280-specialize-heapregion-oops-on-card-seq-iterate
rev 12942 : imported patch 8162928-micro-optimizations-in-remembered-set-scan
rev 12946 : imported patch 8177044-remove-scan-top


 816     prev_p = p;
 817     p += obj_size;
 818   }
 819 }
 820 
 821 void HeapRegion::verify_rem_set() const {
 822   bool failures = false;
 823   verify_rem_set(VerifyOption_G1UsePrevMarking, &failures);
 824   guarantee(!failures, "HeapRegion RemSet verification failed");
 825 }
 826 
 827 void HeapRegion::prepare_for_compaction(CompactPoint* cp) {
 828   scan_and_forward(this, cp);
 829 }
 830 
 831 // G1OffsetTableContigSpace code; copied from space.cpp.  Hope this can go
 832 // away eventually.
 833 
 834 void G1ContiguousSpace::clear(bool mangle_space) {
 835   set_top(bottom());
 836   _scan_top = bottom();
 837   CompactibleSpace::clear(mangle_space);
 838   reset_bot();
 839 }
 840 
 841 #ifndef PRODUCT
 842 void G1ContiguousSpace::mangle_unused_area() {
 843   mangle_unused_area_complete();
 844 }
 845 
 846 void G1ContiguousSpace::mangle_unused_area_complete() {
 847   SpaceMangler::mangle_region(MemRegion(top(), end()));
 848 }
 849 #endif
 850 
 851 void G1ContiguousSpace::print() const {
 852   print_short();
 853   tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
 854                 INTPTR_FORMAT ", " INTPTR_FORMAT ")",
 855                 p2i(bottom()), p2i(top()), p2i(_bot_part.threshold()), p2i(end()));
 856 }
 857 
 858 HeapWord* G1ContiguousSpace::initialize_threshold() {
 859   return _bot_part.initialize_threshold();
 860 }
 861 
 862 HeapWord* G1ContiguousSpace::cross_threshold(HeapWord* start,
 863                                                     HeapWord* end) {
 864   _bot_part.alloc_block(start, end);
 865   return _bot_part.threshold();
 866 }
 867 
 868 HeapWord* G1ContiguousSpace::scan_top() const {
 869   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 870   HeapWord* local_top = top();
 871   OrderAccess::loadload();
 872   const unsigned local_time_stamp = _gc_time_stamp;
 873   assert(local_time_stamp <= g1h->get_gc_time_stamp(), "invariant");
 874   if (local_time_stamp < g1h->get_gc_time_stamp()) {
 875     return local_top;
 876   } else {
 877     return _scan_top;
 878   }
 879 }
 880 
 881 void G1ContiguousSpace::record_timestamp() {
 882   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 883   uint curr_gc_time_stamp = g1h->get_gc_time_stamp();
 884 
 885   if (_gc_time_stamp < curr_gc_time_stamp) {
 886     // Setting the time stamp here tells concurrent readers to look at
 887     // scan_top to know the maximum allowed address to look at.
 888 
 889     // scan_top should be bottom for all regions except for the
 890     // retained old alloc region which should have scan_top == top
 891     HeapWord* st = _scan_top;
 892     guarantee(st == _bottom || st == _top, "invariant");
 893 
 894     _gc_time_stamp = curr_gc_time_stamp;
 895   }
 896 }
 897 
 898 void G1ContiguousSpace::record_retained_region() {
 899   // scan_top is the maximum address where it's safe for the next gc to
 900   // scan this region.
 901   _scan_top = top();
 902 }
 903 
 904 void G1ContiguousSpace::safe_object_iterate(ObjectClosure* blk) {
 905   object_iterate(blk);
 906 }
 907 
 908 void G1ContiguousSpace::object_iterate(ObjectClosure* blk) {
 909   HeapWord* p = bottom();
 910   while (p < top()) {
 911     if (block_is_obj(p)) {
 912       blk->do_object(oop(p));
 913     }
 914     p += block_size(p);
 915   }
 916 }
 917 
 918 G1ContiguousSpace::G1ContiguousSpace(G1BlockOffsetTable* bot) :
 919   _bot_part(bot, this),
 920   _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
 921   _gc_time_stamp(0)
 922 {
 923 }
 924 
 925 void G1ContiguousSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
 926   CompactibleSpace::initialize(mr, clear_space, mangle_space);
 927   _top = bottom();
 928   _scan_top = bottom();
 929   set_saved_mark_word(NULL);
 930   reset_bot();
 931 }
 932 


 816     prev_p = p;
 817     p += obj_size;
 818   }
 819 }
 820 
 821 void HeapRegion::verify_rem_set() const {
 822   bool failures = false;
 823   verify_rem_set(VerifyOption_G1UsePrevMarking, &failures);
 824   guarantee(!failures, "HeapRegion RemSet verification failed");
 825 }
 826 
 827 void HeapRegion::prepare_for_compaction(CompactPoint* cp) {
 828   scan_and_forward(this, cp);
 829 }
 830 
 831 // G1OffsetTableContigSpace code; copied from space.cpp.  Hope this can go
 832 // away eventually.
 833 
 834 void G1ContiguousSpace::clear(bool mangle_space) {
 835   set_top(bottom());

 836   CompactibleSpace::clear(mangle_space);
 837   reset_bot();
 838 }
 839 
 840 #ifndef PRODUCT
 841 void G1ContiguousSpace::mangle_unused_area() {
 842   mangle_unused_area_complete();
 843 }
 844 
 845 void G1ContiguousSpace::mangle_unused_area_complete() {
 846   SpaceMangler::mangle_region(MemRegion(top(), end()));
 847 }
 848 #endif
 849 
 850 void G1ContiguousSpace::print() const {
 851   print_short();
 852   tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
 853                 INTPTR_FORMAT ", " INTPTR_FORMAT ")",
 854                 p2i(bottom()), p2i(top()), p2i(_bot_part.threshold()), p2i(end()));
 855 }
 856 
 857 HeapWord* G1ContiguousSpace::initialize_threshold() {
 858   return _bot_part.initialize_threshold();
 859 }
 860 
 861 HeapWord* G1ContiguousSpace::cross_threshold(HeapWord* start,
 862                                                     HeapWord* end) {
 863   _bot_part.alloc_block(start, end);
 864   return _bot_part.threshold();
 865 }
 866 













 867 void G1ContiguousSpace::record_timestamp() {
 868   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 869   uint curr_gc_time_stamp = g1h->get_gc_time_stamp();
 870 
 871   if (_gc_time_stamp < curr_gc_time_stamp) {








 872     _gc_time_stamp = curr_gc_time_stamp;
 873   }
 874 }
 875 






 876 void G1ContiguousSpace::safe_object_iterate(ObjectClosure* blk) {
 877   object_iterate(blk);
 878 }
 879 
 880 void G1ContiguousSpace::object_iterate(ObjectClosure* blk) {
 881   HeapWord* p = bottom();
 882   while (p < top()) {
 883     if (block_is_obj(p)) {
 884       blk->do_object(oop(p));
 885     }
 886     p += block_size(p);
 887   }
 888 }
 889 
 890 G1ContiguousSpace::G1ContiguousSpace(G1BlockOffsetTable* bot) :
 891   _bot_part(bot, this),
 892   _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true),
 893   _gc_time_stamp(0)
 894 {
 895 }
 896 
 897 void G1ContiguousSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
 898   CompactibleSpace::initialize(mr, clear_space, mangle_space);
 899   _top = bottom();

 900   set_saved_mark_word(NULL);
 901   reset_bot();
 902 }
 903 
< prev index next >