JDK-8152932 : Investigate optimal method to set bits in card live data
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2016-03-29
  • Updated: 2018-03-28
  • Resolved: 2018-03-28
Related Reports
Relates :  
Relates :  
Description
After completing marking, G1 collects liveness information on a per-card basis for various purposes.

G1 iterates over the mark bitmap and sets the appropriate bits. It does so by pretty elaborate code that special cases short sequences of bits to set in G1CardLiveDataHelper::set_card_bitmap_range():

if ((end_idx - start_idx) <= 8) {
  for (BitMap::idx_t i = start_idx; i < end_idx; i += 1) {
    _card_bm.set_bit(i);
  }
} else {
  _card_bm.set_range(start_idx, end_idx);
}

The question is whether the special casing for very small ranges (why <= 8?) is necessary, and the entire method could be replaced by a _card_bm.set_range(start_idx, end_idx, BitMap::small_range) call.

Investigate the performance impact and implement a more optimal solution.

Most likely the difference will not be noticeable unless on a really large heap, and if so, special-casing setting the first two bits should be sufficient.
Comments
JDK-8180415 removed the create live data phase and associated data structures.
28-03-2018