atomicity for value types

John Rose john.r.rose at oracle.com
Wed Jan 15 00:40:34 UTC 2020


On Dec 18, 2019, at 5:46 PM, John Rose <john.r.rose at oracle.com> wrote:
> 
> - Define a contextual keyword “alwaysatomic" (working title “__AlwaysAtomic”).

I just referred more carefully to the draft JEP on keyword
management https://openjdk.java.net/jeps/8223002 and
realize that it guides us toward a so-called “hyphenated
contextual keyword” in preference to a “unitary contextual
keyword”.  That is, “always-atomic” is more in keeping with
that document than “alwaysatomic”.

I do think this looks more jarring than the unitary keyword:

always-atomic inline class Cursor { … }

But, that’s only because it’s an early hyphenated keyword,
which nobody is eye-trained on yet.  If we believe that
hyphenated keywords are the wave of the future, as I do,
then we should embrace it, rather than the old-school
unitary token “alwaysatomic”.

In the prototype I’m using a temporary (unitary contextual) keyword
__AlwaysAtomic, plus a temporary annotation @__alwaysatomic__.


In the JVMs the draft of the corresponding modifier bit looks like this:

ACC_ALWAYSATOMIC	0x0040	Instances of this inline type are never torn.



More information about the valhalla-spec-observers mailing list