Aligned long views over byte arrays and heap ByteBuffers

Paul Sandoz paul.sandoz at
Fri Jan 15 09:28:25 UTC 2016

Hi Vitaly,

That should be possible if alignment behaviour is always guaranteed on hardware supporting platforms.

It would mean that all atomic accesses should go through the handle such that on software supported platforms a lock can be used, which IIUC is kind of similar to Unsafe behaviour.


> On 15 Jan 2016, at 00:58, Vitaly Davidovich <vitalyd at> wrote:
> Is it possible to detect at runtime whether arrays are 8-byte aligned (i.e.
> 64 or 32 bit VM) and then change how long accesses via VarHandle operate? I
> suppose on 32-bit you'd have to do the access in software vs hardware
> instructions, but as you say, 32bit JVMs (at least Hotspot) aren't common
> these days.

More information about the valhalla-dev mailing list