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

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:


  67   // constructor
  68   CMBitMapRO(ReservedSpace rs, int shifter);
  69 
  70   enum { do_yield = true };
  71 
  72   // inquiries
  73   HeapWord* startWord()   const { return _bmStartWord; }
  74   size_t    sizeInWords() const { return _bmWordSize;  }
  75   // the following is one past the last word in space
  76   HeapWord* endWord()     const { return _bmStartWord + _bmWordSize; }
  77 
  78   // read marks
  79 
  80   bool isMarked(HeapWord* addr) const {
  81     assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
  82            "outside underlying space?");
  83     return _bm.at(heapWordToOffset(addr));
  84   }
  85 
  86   // iteration
  87   bool iterate(BitMapClosure* cl) { return _bm.iterate(cl); }
  88   bool iterate(BitMapClosure* cl, MemRegion mr);
  89 
  90   // Return the address corresponding to the next marked bit at or after
  91   // "addr", and before "limit", if "limit" is non-NULL.  If there is no
  92   // such bit, returns "limit" if that is non-NULL, or else "endWord()".
  93   HeapWord* getNextMarkedWordAddress(HeapWord* addr,
  94                                      HeapWord* limit = NULL) const;
  95   // Return the address corresponding to the next unmarked bit at or after
  96   // "addr", and before "limit", if "limit" is non-NULL.  If there is no
  97   // such bit, returns "limit" if that is non-NULL, or else "endWord()".
  98   HeapWord* getNextUnmarkedWordAddress(HeapWord* addr,
  99                                        HeapWord* limit = NULL) const;
 100 
 101   // conversion utilities
 102   // XXX Fix these so that offsets are size_t's...
 103   HeapWord* offsetToHeapWord(size_t offset) const {
 104     return _bmStartWord + (offset << _shifter);
 105   }
 106   size_t heapWordToOffset(HeapWord* addr) const {
 107     return pointer_delta(addr, _bmStartWord) >> _shifter;
 108   }




  67   // constructor
  68   CMBitMapRO(ReservedSpace rs, int shifter);
  69 
  70   enum { do_yield = true };
  71 
  72   // inquiries
  73   HeapWord* startWord()   const { return _bmStartWord; }
  74   size_t    sizeInWords() const { return _bmWordSize;  }
  75   // the following is one past the last word in space
  76   HeapWord* endWord()     const { return _bmStartWord + _bmWordSize; }
  77 
  78   // read marks
  79 
  80   bool isMarked(HeapWord* addr) const {
  81     assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
  82            "outside underlying space?");
  83     return _bm.at(heapWordToOffset(addr));
  84   }
  85 
  86   // iteration
  87   inline bool iterate(BitMapClosure* cl, MemRegion mr);
  88   inline bool iterate(BitMapClosure* cl);
  89 
  90   // Return the address corresponding to the next marked bit at or after
  91   // "addr", and before "limit", if "limit" is non-NULL.  If there is no
  92   // such bit, returns "limit" if that is non-NULL, or else "endWord()".
  93   HeapWord* getNextMarkedWordAddress(HeapWord* addr,
  94                                      HeapWord* limit = NULL) const;
  95   // Return the address corresponding to the next unmarked bit at or after
  96   // "addr", and before "limit", if "limit" is non-NULL.  If there is no
  97   // such bit, returns "limit" if that is non-NULL, or else "endWord()".
  98   HeapWord* getNextUnmarkedWordAddress(HeapWord* addr,
  99                                        HeapWord* limit = NULL) const;
 100 
 101   // conversion utilities
 102   // XXX Fix these so that offsets are size_t's...
 103   HeapWord* offsetToHeapWord(size_t offset) const {
 104     return _bmStartWord + (offset << _shifter);
 105   }
 106   size_t heapWordToOffset(HeapWord* addr) const {
 107     return pointer_delta(addr, _bmStartWord) >> _shifter;
 108   }