[foreign-abi] RFR: 8253255: Investigate replacing ABI layout attributes with custom subtypes of ValueLayout

Jorn Vernee jvernee at openjdk.java.net
Mon Sep 28 16:07:56 UTC 2020


Hi,

This patch removes ABI attributes, and replaces them with a custom ValueLayout subtype, called CValueLayout.

This, for one, allows us to override the describeConstable method to return a dynamic constant descriptor that will
load the public constant field in CLinker. This avoids getting illegal access errors when trying to resolve the
internal ABI attributes. The illegal access error was forcing clients, like jextract, to basically re-implement the
describeConstable methods for FunctionDescriptor, GroupLayout, SequenceLayout and ValueLayout in order the
'cannonicalize' these constant descriptors to reference the fields.

Most of the needed changes were in the TypeClass classes, which now need to map the CValueLayout.Kind into the
appropriate ABI classes (though doing this was pretty straight forward).

I've also added a test to make sure it is possible to resolve constant descriptors with these CValueLayouts inside with
a public Lookup object.

Thanks,
Jorn

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

Commit messages:
 - - add missing copyright header
 - Replace ABI attributes with custom CValueLayout subclass

Changes: https://git.openjdk.java.net/panama-foreign/pull/358/files
 Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=358&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8253255
  Stats: 491 lines in 14 files changed: 252 ins; 163 del; 76 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/358.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/358/head:pull/358

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


More information about the panama-dev mailing list