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

changeset 6990
1526a938e670
parent 6988
a8137787acfe
child 6992
2c6ef90f030a
     1.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp	Thu Jun 26 13:20:18 2014 +0200
     1.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp	Thu Jun 26 11:36:58 2014 +0200
     1.3 @@ -30,6 +30,7 @@
     1.4  #include "gc_implementation/g1/heapRegion.inline.hpp"
     1.5  #include "gc_implementation/g1/heapRegionRemSet.hpp"
     1.6  #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
     1.7 +#include "gc_implementation/shared/liveRange.hpp"
     1.8  #include "memory/genOopClosures.inline.hpp"
     1.9  #include "memory/iterator.hpp"
    1.10  #include "memory/space.inline.hpp"
    1.11 @@ -60,7 +61,7 @@
    1.12                                 HeapRegion* hr,
    1.13                                 HeapWord* cur, HeapWord* top) {
    1.14    oop cur_oop = oop(cur);
    1.15 -  int oop_size = cur_oop->size();
    1.16 +  size_t oop_size = hr->block_size(cur);
    1.17    HeapWord* next_obj = cur + oop_size;
    1.18    while (next_obj < top) {
    1.19      // Keep filtering the remembered set.
    1.20 @@ -71,7 +72,7 @@
    1.21      }
    1.22      cur = next_obj;
    1.23      cur_oop = oop(cur);
    1.24 -    oop_size = cur_oop->size();
    1.25 +    oop_size = hr->block_size(cur);
    1.26      next_obj = cur + oop_size;
    1.27    }
    1.28    return cur;
    1.29 @@ -81,7 +82,7 @@
    1.30                                        HeapWord* bottom,
    1.31                                        HeapWord* top) {
    1.32    G1CollectedHeap* g1h = _g1;
    1.33 -  int oop_size;
    1.34 +  size_t oop_size;
    1.35    ExtendedOopClosure* cl2 = NULL;
    1.36  
    1.37    FilterIntoCSClosure intoCSFilt(this, g1h, _cl);
    1.38 @@ -101,7 +102,7 @@
    1.39    if (!g1h->is_obj_dead(oop(bottom), _hr)) {
    1.40      oop_size = oop(bottom)->oop_iterate(cl2, mr);
    1.41    } else {
    1.42 -    oop_size = oop(bottom)->size();
    1.43 +    oop_size = _hr->block_size(bottom);
    1.44    }
    1.45  
    1.46    bottom += oop_size;
    1.47 @@ -452,7 +453,7 @@
    1.48      if (cl->abort()) return cur;
    1.49      // The check above must occur before the operation below, since an
    1.50      // abort might invalidate the "size" operation.
    1.51 -    cur += obj->size();
    1.52 +    cur += block_size(cur);
    1.53    }
    1.54    return NULL;
    1.55  }
    1.56 @@ -524,7 +525,7 @@
    1.57        return cur;
    1.58      }
    1.59      // Otherwise...
    1.60 -    next = (cur + obj->size());
    1.61 +    next = cur + block_size(cur);
    1.62    }
    1.63  
    1.64    // If we finish the above loop...We have a parseable object that
    1.65 @@ -532,10 +533,9 @@
    1.66    // inside or spans the entire region.
    1.67  
    1.68    assert(obj == oop(cur), "sanity");
    1.69 -  assert(cur <= start &&
    1.70 -         obj->klass_or_null() != NULL &&
    1.71 -         (cur + obj->size()) > start,
    1.72 -         "Loop postcondition");
    1.73 +  assert(cur <= start, "Loop postcondition");
    1.74 +  assert(obj->klass_or_null() != NULL, "Loop postcondition");
    1.75 +  assert((cur + block_size(cur)) > start, "Loop postcondition");
    1.76  
    1.77    if (!g1h->is_obj_dead(obj)) {
    1.78      obj->oop_iterate(cl, mr);
    1.79 @@ -549,7 +549,7 @@
    1.80      };
    1.81  
    1.82      // Otherwise:
    1.83 -    next = (cur + obj->size());
    1.84 +    next = cur + block_size(cur);
    1.85  
    1.86      if (!g1h->is_obj_dead(obj)) {
    1.87        if (next < end || !obj->is_objArray()) {
    1.88 @@ -904,7 +904,7 @@
    1.89    size_t object_num = 0;
    1.90    while (p < top()) {
    1.91      oop obj = oop(p);
    1.92 -    size_t obj_size = obj->size();
    1.93 +    size_t obj_size = block_size(p);
    1.94      object_num += 1;
    1.95  
    1.96      if (is_humongous != g1->isHumongous(obj_size)) {
    1.97 @@ -1040,7 +1040,9 @@
    1.98  // away eventually.
    1.99  
   1.100  void G1OffsetTableContigSpace::clear(bool mangle_space) {
   1.101 -  ContiguousSpace::clear(mangle_space);
   1.102 +  set_top(bottom());
   1.103 +  set_saved_mark_word(bottom());
   1.104 +  CompactibleSpace::clear(mangle_space);
   1.105    _offsets.zero_bottom_entry();
   1.106    _offsets.initialize_threshold();
   1.107  }
   1.108 @@ -1078,7 +1080,7 @@
   1.109    if (_gc_time_stamp < g1h->get_gc_time_stamp())
   1.110      return top();
   1.111    else
   1.112 -    return ContiguousSpace::saved_mark_word();
   1.113 +    return Space::saved_mark_word();
   1.114  }
   1.115  
   1.116  void G1OffsetTableContigSpace::record_top_and_timestamp() {
   1.117 @@ -1093,7 +1095,7 @@
   1.118      // of region. If it does so after _gc_time_stamp = ..., then it
   1.119      // will pick up the right saved_mark_word() as the high water mark
   1.120      // of the region. Either way, the behaviour will be correct.
   1.121 -    ContiguousSpace::set_saved_mark();
   1.122 +    Space::set_saved_mark_word(top());
   1.123      OrderAccess::storestore();
   1.124      _gc_time_stamp = curr_gc_time_stamp;
   1.125      // No need to do another barrier to flush the writes above. If
   1.126 @@ -1104,6 +1106,26 @@
   1.127    }
   1.128  }
   1.129  
   1.130 +void G1OffsetTableContigSpace::safe_object_iterate(ObjectClosure* blk) {
   1.131 +  object_iterate(blk);
   1.132 +}
   1.133 +
   1.134 +void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) {
   1.135 +  HeapWord* p = bottom();
   1.136 +  while (p < top()) {
   1.137 +    if (block_is_obj(p)) {
   1.138 +      blk->do_object(oop(p));
   1.139 +    }
   1.140 +    p += block_size(p);
   1.141 +  }
   1.142 +}
   1.143 +
   1.144 +#define block_is_always_obj(q) true
   1.145 +void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) {
   1.146 +  SCAN_AND_FORWARD(cp, top, block_is_always_obj, block_size);
   1.147 +}
   1.148 +#undef block_is_always_obj
   1.149 +
   1.150  G1OffsetTableContigSpace::
   1.151  G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
   1.152                           MemRegion mr) :
   1.153 @@ -1113,7 +1135,8 @@
   1.154  {
   1.155    _offsets.set_space(this);
   1.156    // false ==> we'll do the clearing if there's clearing to be done.
   1.157 -  ContiguousSpace::initialize(mr, false, SpaceDecorator::Mangle);
   1.158 +  CompactibleSpace::initialize(mr, false, SpaceDecorator::Mangle);
   1.159 +  _top = bottom();
   1.160    _offsets.zero_bottom_entry();
   1.161    _offsets.initialize_threshold();
   1.162  }

mercurial