hotspot/src/share/vm/gc/g1/heapRegion.cpp
changeset 46520 de5cb3eed39b
parent 46518 69f8479862a2
child 46611 3b8b1f7ee3b4
equal deleted inserted replaced
46519:40c9c132f961 46520:de5cb3eed39b
   825 // G1OffsetTableContigSpace code; copied from space.cpp.  Hope this can go
   825 // G1OffsetTableContigSpace code; copied from space.cpp.  Hope this can go
   826 // away eventually.
   826 // away eventually.
   827 
   827 
   828 void G1ContiguousSpace::clear(bool mangle_space) {
   828 void G1ContiguousSpace::clear(bool mangle_space) {
   829   set_top(bottom());
   829   set_top(bottom());
   830   _scan_top = bottom();
       
   831   CompactibleSpace::clear(mangle_space);
   830   CompactibleSpace::clear(mangle_space);
   832   reset_bot();
   831   reset_bot();
   833 }
   832 }
   834 
   833 
   835 #ifndef PRODUCT
   834 #ifndef PRODUCT
   857                                                     HeapWord* end) {
   856                                                     HeapWord* end) {
   858   _bot_part.alloc_block(start, end);
   857   _bot_part.alloc_block(start, end);
   859   return _bot_part.threshold();
   858   return _bot_part.threshold();
   860 }
   859 }
   861 
   860 
   862 HeapWord* G1ContiguousSpace::scan_top() const {
       
   863   G1CollectedHeap* g1h = G1CollectedHeap::heap();
       
   864   HeapWord* local_top = top();
       
   865   OrderAccess::loadload();
       
   866   const unsigned local_time_stamp = _gc_time_stamp;
       
   867   assert(local_time_stamp <= g1h->get_gc_time_stamp(), "invariant");
       
   868   if (local_time_stamp < g1h->get_gc_time_stamp()) {
       
   869     return local_top;
       
   870   } else {
       
   871     return _scan_top;
       
   872   }
       
   873 }
       
   874 
       
   875 void G1ContiguousSpace::record_timestamp() {
   861 void G1ContiguousSpace::record_timestamp() {
   876   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   862   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   877   uint curr_gc_time_stamp = g1h->get_gc_time_stamp();
   863   uint curr_gc_time_stamp = g1h->get_gc_time_stamp();
   878 
   864 
   879   if (_gc_time_stamp < curr_gc_time_stamp) {
   865   if (_gc_time_stamp < curr_gc_time_stamp) {
   880     // Setting the time stamp here tells concurrent readers to look at
       
   881     // scan_top to know the maximum allowed address to look at.
       
   882 
       
   883     // scan_top should be bottom for all regions except for the
       
   884     // retained old alloc region which should have scan_top == top
       
   885     HeapWord* st = _scan_top;
       
   886     guarantee(st == _bottom || st == _top, "invariant");
       
   887 
       
   888     _gc_time_stamp = curr_gc_time_stamp;
   866     _gc_time_stamp = curr_gc_time_stamp;
   889   }
   867   }
   890 }
       
   891 
       
   892 void G1ContiguousSpace::record_retained_region() {
       
   893   // scan_top is the maximum address where it's safe for the next gc to
       
   894   // scan this region.
       
   895   _scan_top = top();
       
   896 }
   868 }
   897 
   869 
   898 void G1ContiguousSpace::safe_object_iterate(ObjectClosure* blk) {
   870 void G1ContiguousSpace::safe_object_iterate(ObjectClosure* blk) {
   899   object_iterate(blk);
   871   object_iterate(blk);
   900 }
   872 }
   917 }
   889 }
   918 
   890 
   919 void G1ContiguousSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
   891 void G1ContiguousSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
   920   CompactibleSpace::initialize(mr, clear_space, mangle_space);
   892   CompactibleSpace::initialize(mr, clear_space, mangle_space);
   921   _top = bottom();
   893   _top = bottom();
   922   _scan_top = bottom();
       
   923   set_saved_mark_word(NULL);
   894   set_saved_mark_word(NULL);
   924   reset_bot();
   895   reset_bot();
   925 }
   896 }
   926 
   897