Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7901989

Use VarHandles Opaque mode instead of volatile checks

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • None
    • tools
    • None
    • jmh

      On some architectures, volatile reads come with the associated performance costs. We need to see if VarHandles Opaque mode fits better for "isDone" flag checks, and around the Blackholes. This might drop down the lower time bound for the measurable effects on those platforms.

      Caveats:

      We want to break optimizations *across* isDone checks, i.e. between separate @Benchmark calls. Right now we are somewhat saved by having the non-counted loop that would not be unrolled. As implemented now, Opaque does not suffer from this, because it just emits the CPUOrder barriers around the access. But we have to wonder if careful optimization would be able to enforce the subordering only for non-plain accesses.

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: