src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp

changeset 3691
2a0172480595
parent 3690
748051fd24ce
child 3711
b632e80fc9dc
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Mar 16 09:52:57 2012 +0100
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Apr 05 13:57:23 2012 -0400
     1.3 @@ -1677,202 +1677,6 @@
     1.4    size_t _max_heap_capacity;
     1.5  };
     1.6  
     1.7 -#define use_local_bitmaps         1
     1.8 -#define verify_local_bitmaps      0
     1.9 -#define oop_buffer_length       256
    1.10 -
    1.11 -#ifndef PRODUCT
    1.12 -class GCLabBitMap;
    1.13 -class GCLabBitMapClosure: public BitMapClosure {
    1.14 -private:
    1.15 -  ConcurrentMark* _cm;
    1.16 -  GCLabBitMap*    _bitmap;
    1.17 -
    1.18 -public:
    1.19 -  GCLabBitMapClosure(ConcurrentMark* cm,
    1.20 -                     GCLabBitMap* bitmap) {
    1.21 -    _cm     = cm;
    1.22 -    _bitmap = bitmap;
    1.23 -  }
    1.24 -
    1.25 -  virtual bool do_bit(size_t offset);
    1.26 -};
    1.27 -#endif // !PRODUCT
    1.28 -
    1.29 -class GCLabBitMap: public BitMap {
    1.30 -private:
    1.31 -  ConcurrentMark* _cm;
    1.32 -
    1.33 -  int       _shifter;
    1.34 -  size_t    _bitmap_word_covers_words;
    1.35 -
    1.36 -  // beginning of the heap
    1.37 -  HeapWord* _heap_start;
    1.38 -
    1.39 -  // this is the actual start of the GCLab
    1.40 -  HeapWord* _real_start_word;
    1.41 -
    1.42 -  // this is the actual end of the GCLab
    1.43 -  HeapWord* _real_end_word;
    1.44 -
    1.45 -  // this is the first word, possibly located before the actual start
    1.46 -  // of the GCLab, that corresponds to the first bit of the bitmap
    1.47 -  HeapWord* _start_word;
    1.48 -
    1.49 -  // size of a GCLab in words
    1.50 -  size_t _gclab_word_size;
    1.51 -
    1.52 -  static int shifter() {
    1.53 -    return MinObjAlignment - 1;
    1.54 -  }
    1.55 -
    1.56 -  // how many heap words does a single bitmap word corresponds to?
    1.57 -  static size_t bitmap_word_covers_words() {
    1.58 -    return BitsPerWord << shifter();
    1.59 -  }
    1.60 -
    1.61 -  size_t gclab_word_size() const {
    1.62 -    return _gclab_word_size;
    1.63 -  }
    1.64 -
    1.65 -  // Calculates actual GCLab size in words
    1.66 -  size_t gclab_real_word_size() const {
    1.67 -    return bitmap_size_in_bits(pointer_delta(_real_end_word, _start_word))
    1.68 -           / BitsPerWord;
    1.69 -  }
    1.70 -
    1.71 -  static size_t bitmap_size_in_bits(size_t gclab_word_size) {
    1.72 -    size_t bits_in_bitmap = gclab_word_size >> shifter();
    1.73 -    // We are going to ensure that the beginning of a word in this
    1.74 -    // bitmap also corresponds to the beginning of a word in the
    1.75 -    // global marking bitmap. To handle the case where a GCLab
    1.76 -    // starts from the middle of the bitmap, we need to add enough
    1.77 -    // space (i.e. up to a bitmap word) to ensure that we have
    1.78 -    // enough bits in the bitmap.
    1.79 -    return bits_in_bitmap + BitsPerWord - 1;
    1.80 -  }
    1.81 -public:
    1.82 -  GCLabBitMap(HeapWord* heap_start, size_t gclab_word_size)
    1.83 -    : BitMap(bitmap_size_in_bits(gclab_word_size)),
    1.84 -      _cm(G1CollectedHeap::heap()->concurrent_mark()),
    1.85 -      _shifter(shifter()),
    1.86 -      _bitmap_word_covers_words(bitmap_word_covers_words()),
    1.87 -      _heap_start(heap_start),
    1.88 -      _gclab_word_size(gclab_word_size),
    1.89 -      _real_start_word(NULL),
    1.90 -      _real_end_word(NULL),
    1.91 -      _start_word(NULL) {
    1.92 -    guarantee(false, "GCLabBitMap::GCLabBitmap(): don't call this any more");
    1.93 -  }
    1.94 -
    1.95 -  inline unsigned heapWordToOffset(HeapWord* addr) {
    1.96 -    unsigned offset = (unsigned) pointer_delta(addr, _start_word) >> _shifter;
    1.97 -    assert(offset < size(), "offset should be within bounds");
    1.98 -    return offset;
    1.99 -  }
   1.100 -
   1.101 -  inline HeapWord* offsetToHeapWord(size_t offset) {
   1.102 -    HeapWord* addr =  _start_word + (offset << _shifter);
   1.103 -    assert(_real_start_word <= addr && addr < _real_end_word, "invariant");
   1.104 -    return addr;
   1.105 -  }
   1.106 -
   1.107 -  bool fields_well_formed() {
   1.108 -    bool ret1 = (_real_start_word == NULL) &&
   1.109 -                (_real_end_word == NULL) &&
   1.110 -                (_start_word == NULL);
   1.111 -    if (ret1)
   1.112 -      return true;
   1.113 -
   1.114 -    bool ret2 = _real_start_word >= _start_word &&
   1.115 -      _start_word < _real_end_word &&
   1.116 -      (_real_start_word + _gclab_word_size) == _real_end_word &&
   1.117 -      (_start_word + _gclab_word_size + _bitmap_word_covers_words)
   1.118 -                                                              > _real_end_word;
   1.119 -    return ret2;
   1.120 -  }
   1.121 -
   1.122 -  inline bool mark(HeapWord* addr) {
   1.123 -    guarantee(use_local_bitmaps, "invariant");
   1.124 -    assert(fields_well_formed(), "invariant");
   1.125 -
   1.126 -    if (addr >= _real_start_word && addr < _real_end_word) {
   1.127 -      assert(!isMarked(addr), "should not have already been marked");
   1.128 -
   1.129 -      // first mark it on the bitmap
   1.130 -      at_put(heapWordToOffset(addr), true);
   1.131 -
   1.132 -      return true;
   1.133 -    } else {
   1.134 -      return false;
   1.135 -    }
   1.136 -  }
   1.137 -
   1.138 -  inline bool isMarked(HeapWord* addr) {
   1.139 -    guarantee(use_local_bitmaps, "invariant");
   1.140 -    assert(fields_well_formed(), "invariant");
   1.141 -
   1.142 -    return at(heapWordToOffset(addr));
   1.143 -  }
   1.144 -
   1.145 -  void set_buffer(HeapWord* start) {
   1.146 -    guarantee(false, "set_buffer(): don't call this any more");
   1.147 -
   1.148 -    guarantee(use_local_bitmaps, "invariant");
   1.149 -    clear();
   1.150 -
   1.151 -    assert(start != NULL, "invariant");
   1.152 -    _real_start_word = start;
   1.153 -    _real_end_word   = start + _gclab_word_size;
   1.154 -
   1.155 -    size_t diff =
   1.156 -      pointer_delta(start, _heap_start) % _bitmap_word_covers_words;
   1.157 -    _start_word = start - diff;
   1.158 -
   1.159 -    assert(fields_well_formed(), "invariant");
   1.160 -  }
   1.161 -
   1.162 -#ifndef PRODUCT
   1.163 -  void verify() {
   1.164 -    // verify that the marks have been propagated
   1.165 -    GCLabBitMapClosure cl(_cm, this);
   1.166 -    iterate(&cl);
   1.167 -  }
   1.168 -#endif // PRODUCT
   1.169 -
   1.170 -  void retire() {
   1.171 -    guarantee(false, "retire(): don't call this any more");
   1.172 -
   1.173 -    guarantee(use_local_bitmaps, "invariant");
   1.174 -    assert(fields_well_formed(), "invariant");
   1.175 -
   1.176 -    if (_start_word != NULL) {
   1.177 -      CMBitMap*       mark_bitmap = _cm->nextMarkBitMap();
   1.178 -
   1.179 -      // this means that the bitmap was set up for the GCLab
   1.180 -      assert(_real_start_word != NULL && _real_end_word != NULL, "invariant");
   1.181 -
   1.182 -      mark_bitmap->mostly_disjoint_range_union(this,
   1.183 -                                0, // always start from the start of the bitmap
   1.184 -                                _start_word,
   1.185 -                                gclab_real_word_size());
   1.186 -      _cm->grayRegionIfNecessary(MemRegion(_real_start_word, _real_end_word));
   1.187 -
   1.188 -#ifndef PRODUCT
   1.189 -      if (use_local_bitmaps && verify_local_bitmaps)
   1.190 -        verify();
   1.191 -#endif // PRODUCT
   1.192 -    } else {
   1.193 -      assert(_real_start_word == NULL && _real_end_word == NULL, "invariant");
   1.194 -    }
   1.195 -  }
   1.196 -
   1.197 -  size_t bitmap_size_in_words() const {
   1.198 -    return (bitmap_size_in_bits(gclab_word_size()) + BitsPerWord - 1) / BitsPerWord;
   1.199 -  }
   1.200 -
   1.201 -};
   1.202 -
   1.203  class G1ParGCAllocBuffer: public ParGCAllocBuffer {
   1.204  private:
   1.205    bool        _retired;

mercurial