<div dir="ltr">Hello valhalla community,<div>While looking at the new non-atomic model that allows flattening in the heap, I wonder if we can represent null-restricted 64-bit atomic data where the most and the least significant bits shouldn't tear.</div><div><br></div><div>An example would be a modifier collection, where some modifier bits are dependent on others, while 0 (the default) is a valid value. One such dependency present in JDK itself is that ABSTRACT modifier must be set if INTERFACE modifier is, and at most one of PUBLIC, PRIVATE, or PROTECTED modifiers can be set. Such constraints can happen across the 32-bit boundary, and thus primitive long is not a suitable choice for its non-atomicity.</div><div><br></div><div>How should I declare a value class that ensures atomicity of the null-restricted long value it contains? And how can a correct declaration consistently benefit from the 64-bit atomic operations offered on modern architectures?</div><div><br></div><div>Truly curious,<br>Chen Liang</div></div>