On Fri, 2 Feb 2024 03:34:38 GMT, Jatin Bhateja <jbhat...@openjdk.org> wrote:

>> Hi @sviswa7 , I have rolled back to originally proposed solution.
>
>> I don't think Lilliput will relax the array alignment to below 4 bytes since 
>> the array length needs to be aligned at that.
> 
> HI @merykitty 
> 
> Lilliput wiki mention about shrinking object header below 4 bytes in future. 
> https://wiki.openjdk.org/display/lilliput#:~:text=Future%20work%3A%2032%20bit%20or%20even%20smaller%20header%3F%20(If%20so%3A%20improve%20field%20layout%20to%20put%20fields%20in%20unused%20bits%20of%20header%20word)
> 
> On x86 page size always a power of 2, this along with minimum object size 
> alignment in JVM (8 bytes even 4 bytes) should be ok, We are anyway shuffling 
> and extracting the byte / word of interest so any junk data read will be 
> chopped off. But in edge case an overrun may land us into a non accessible 
> address space, so we want to be super safe here. I am also sitting over other 
> solution which is performant.

Hi @jatin-bhateja,

The layout of an array is as follows:

    [header] - [length] - [data]

Since `length` is a 4-byte field, which is 4-byte aligned, in the foreseeable 
future, even if the `header` is shrunk to below 4 bytes, I don't think `data` 
can be less than 4-byte aligned.

Thanks a lot.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16354#discussion_r1475532720

Reply via email to