Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8227002

Encode SATBMarkQueue active flag in _index

XMLWordPrintable

    • gc

      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.]

            kbarrett Kim Barrett
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: