JDK-8227002 : Encode SATBMarkQueue active flag in _index
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 14
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2019-06-30
  • Updated: 2023-07-26
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.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
SATBMarkQueue presently has a bool _active member for the active flag. The _index member is scaled to a byte index into the word-valued buffer, so the low LogBytesPerWord bits are always zero. We could also encode the (inverted) active state in _index, with a value of min_intx indicating inactive. This would allow a smaller and faster dispatch among (1) inactive, (2) active fast path, and (3) active slow path. Rather than the existing sequence of two load-test-branch and a later subtraction on the enqueue path, we could have something like (for x86 &etc, for example)

  mov rindex, index_offset(rthread)
  sub rindex, #BytesPerWord
  jo #inactive        // branch on overflow (min_intx - BytesPerWord overflows)
  jl #slow_path     // branch on negative (0 - BytesPerWord is negative)
  // fast path code
  // can use rindex directly, with no further adjustments needed.

[Updated for JDK-8258255, which moved the active flag from PtrQueue to SATBMarkQueue.]

Comments
JDK-8312213 may provide the needed C2 functionality for x86 (only). Would want other platforms to do something similar before considering moving forward with this idea.
26-07-2023