Unsafe making too strong assumptions about array alignment?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed May 28 09:37:32 UTC 2025


On 27/05/2025 17:53, Andrew Haley wrote:
> I think. `base` isn't really guaranteed to be a multiple of 8 on all 
> VMs, and as Rémi said, may soon not be on HotSpot. 

My understanding is that Lilliput will change header size, not the way 
objects are aligned in the heap?

Header size affects the "offset" part, not the base part -- so my 
considerations remain? I think we're confusing header size with 
alignment of object in the heap -- the current Java impl of 
putLongUnaligned makes assumptions on the latter, not on the former.

Or is this more of a theoretical concern (e.g. an implementation "might" 
align objects at 4-byte boundaries) ?

Maurizio



More information about the panama-dev mailing list