RFR: 8329997: Add provisions for checking memory segment alignment constraints [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Apr 15 13:23:48 UTC 2024


On Mon, 15 Apr 2024 13:17:26 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> test/jdk/java/foreign/TestMemoryAlignment.java line 154:
>> 
>>> 152:              Arena arena = Arena.ofConfined()) {
>>> 153:             var segment =channel.map(FileChannel.MapMode.READ_WRITE, 0L, 32L, arena);
>>> 154:             assertTrue(segment.maxByteAlignment() >= Long.BYTES);
>> 
>> Is this always the case? Smells of platform-dependent... (e.g. think also of x86)
>
> I think the alignment is always the biggest of the directly supported primitive types so maybe we should change to `Integer.BYTES` here.

Yes, but, I mean, we don't have a test for checking what's the alignment of `malloc` - so I wonder why we should have a test for mapped segments - it's not like the API makes any promises there, right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18779#discussion_r1565789636


More information about the core-libs-dev mailing list