JDK-7121547 : G1: High number of mispredicted branches while iterating over the marking bitmap
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 7u4
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-12-14
  • Updated: 2013-10-04
  • Resolved: 2012-03-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u4Fixed 8Fixed hs23Fixed
Description
While analysing performance data from benchmark runs using the changes in 6484965 (Piggy-back liveness accounting phase on marking) it was observed that there were a high number of mispredicted branches coming from CMTask::do_marking_step().

Further analysis indicated that these mispredicted branches were the actual call of the BitMap::iterate function. This is caused by a couple of reasons - first BitMap::iterate is defined in the .cpp file and so cannot be inlined.

We might be able to do better by actually implementing a version of the "iterate" routine using inline-able routines from BitMap and using the object sizes to increase the granularity of the iteration.

Comments
EVALUATION http://hg.openjdk.java.net/lambda/lambda/hotspot/rev/2e966d967c5c
22-03-2012

SUGGESTED FIX Implement CMBitMapRO::iterate routines using the get_next_one_offset() from the BitMap class and the sizes of marked objects.
17-01-2012

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-gc/hotspot/rev/2e966d967c5c
14-01-2012

EVALUATION There is a high number of mispredicted branches associated with calling BitMap::iteratate() from within CMBitMapRO::iterate. The reason seems to be that BitMap::iterate can not be inlined. We could implement CMBitMapRO::iterate directly using inline-able routines. This would require no interface changes to the actual marking bitmap itself and no changes to the calling code.
20-12-2011