[jmm-dev] Specifying VarHandle acquire/release without ill effects

Martin Buchholz martinrb at google.com
Sat Jun 18 00:40:18 UTC 2016

I looked again at the C++ standard, and it tries hard to specify everything
abstractly via the happens-before order and the total synchronization order
on volatiles.  Which they probably more or less copied from java!  It
should not be too hard to amend the Java memory model to incorporate the
concepts of "acquire operation" and "release operation" back from C++.  We
already mostly have them!  We simply need to introduce acquire operations
and release operations that are not reads/writes of volatiles.

The library API should then simply say things like "this is an acquire
operation" and link to the relevant section of the jls.

(except maybe for fences - those are special and isolated)

We don't know how to fix some aspects of the memory model, but bringing
acquire/release into the existing model (without talking about reorderings)
seems very achievable.

More information about the jmm-dev mailing list