Print this page
rev 2896 : 7121547: G1: High number mispredicted branches while iterating over the marking bitmap
Summary: There is a high number of mispredicted branches associated with calling BitMap::iteratate() from within CMBitMapRO::iterate(). Implement a version of CMBitMapRO::iterate() directly using inline-able routines.
Reviewed-by:

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/concurrentMark.cpp
          +++ new/src/share/vm/gc_implementation/g1/concurrentMark.cpp
↓ open down ↓ 95 lines elided ↑ open up ↑
  96   96    assert(nextAddr == limit || !isMarked(nextAddr),
  97   97           "get_next_one postcondition");
  98   98    return nextAddr;
  99   99  }
 100  100  
 101  101  int CMBitMapRO::heapWordDiffToOffsetDiff(size_t diff) const {
 102  102    assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
 103  103    return (int) (diff >> _shifter);
 104  104  }
 105  105  
 106      -bool CMBitMapRO::iterate(BitMapClosure* cl, MemRegion mr) {
 107      -  HeapWord* left  = MAX2(_bmStartWord, mr.start());
 108      -  HeapWord* right = MIN2(_bmStartWord + _bmWordSize, mr.end());
 109      -  if (right > left) {
 110      -    // Right-open interval [leftOffset, rightOffset).
 111      -    return _bm.iterate(cl, heapWordToOffset(left), heapWordToOffset(right));
 112      -  } else {
 113      -    return true;
 114      -  }
 115      -}
 116      -
 117  106  void CMBitMapRO::mostly_disjoint_range_union(BitMap*   from_bitmap,
 118  107                                               size_t    from_start_index,
 119  108                                               HeapWord* to_start_word,
 120  109                                               size_t    word_num) {
 121  110    _bm.mostly_disjoint_range_union(from_bitmap,
 122  111                                    from_start_index,
 123  112                                    heapWordToOffset(to_start_word),
 124  113                                    word_num);
 125  114  }
 126  115  
↓ open down ↓ 4662 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX