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

[lworld] Revisit atomic access modes in flat var handles

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • repo-valhalla
    • core-libs

      Flat fields cannot, in general support atomic access modes such as `compareAndExchage`. The same goes for array element var handles, as performing an atomic access operation on an element of a flattened array cannot, in general, be supported.

      The current implementation supports these operations using locking. Not only this is inefficient, but atomicity guarantees can only be provided as long as all actors access the storage through the var handle (and its associated lock). That is, if thread A performs an atomic access using a var handle, but thread B just performs a plain access on the same variable, atomicity is lost.

      Conservatively, we should:
      * make sure that var handles pointing to flat fields only support plain modes
      * non-plain access modes on array element var handles reject flat array parameters

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: