[foreign-memaccess+abi] RFR: Rework PlatformLayout

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Feb 15 15:53:05 UTC 2023


On Wed, 15 Feb 2023 08:30:05 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR suggests slightly reworking the class `PlatformLayout`. This reduces the number of objects created and aggregates common functionality in a support method.
>
> src/java.base/share/classes/jdk/internal/foreign/PlatformLayouts.java line 252:
> 
>> 250:     }
>> 251: 
>> 252:     private static ValueLayout.OfAddress cPointer(ValueLayout targetLayoutElementLayout) {
> 
> Maybe there is a better name? `elementLayout` perhaps?

I think you can just omit the parameter here - and use JAVA_BYTE. We're not interested in what the layout is - the main thing is that it's unbounded (and that it has minimum alignment). Even using a padding layout of Long.MAX_VALUE would work :-)

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

PR: https://git.openjdk.org/panama-foreign/pull/794


More information about the panama-dev mailing list