[foreign-abi] [Rev 01] RFR: 8241504: Expose MemoryLayout annotations/attributes in the public API

Jorn Vernee jvernee at openjdk.java.net
Tue Mar 24 16:22:08 UTC 2020


On Tue, 24 Mar 2020 14:24:23 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Addressed review comments + added basic tests
>
> test/jdk/java/foreign/TestLayoutConstants.java line 111:
> 
>> 110:                 { MemoryLayouts.BITS_32_LE.withBitAlignment(8) },
>> 111:                 { MemoryLayouts.BITS_32_LE.withAttribute("xyz", "xyz") },
>> 112:         };
> 
> Maybe change the test to have name != value, so that we also detect bugs where we serialize the name for both.

Good idea!

> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java line 204:
> 
>> 203:
>> 204:         var optAbiType = baseType.attribute(SystemABI.NATIVE_TYPE, SystemABI.Type.class);
>> 205:         ArgumentClassImpl baseArgClass = optAbiType.map(AArch64ABI::argumentClassFor).orElse(null);
> 
> Since all ABI layouts are going to have an annotation of this kind, would it make sense to add a static helper function
> in the SystemABI.Type enum to get the ABI type from a layout e.g.
> Type fromLayout(Layout layout) throws IllegalArgumentException //if not an ABI layout

Good idea, will add this as well.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/64


More information about the panama-dev mailing list