[foreign-abi] RFR: 8254156: Simplify ABI classification logic
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Thu Oct 8 10:07:56 UTC 2020
On Thu, 8 Oct 2020 09:49:17 GMT, Chris Vest <github.com+7993+chrisvest at openjdk.org> wrote:
>> This patch reverts recent changes to introduce a public CValueLayout class; the realization here is that, after all,
>> CValueLayout exposes a public `Type` enum which is used by ABI classification. So, instead of using subclassing (which
>> is messy and tedious with immutable data structures with covariant overrides), let's just double down on layout
>> attributes, get rid of CValueLayout and simply expose the Type enum (now renamed to TypeKind).
>
> src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/CLinker.java line 749:
>
>> 747: * A kind corresponding to the a C pointer type
>> 748: */
>> 749: POINTER(false);
>
> Pointer or pointer-sized? We'd also use this one for `size_t` for instance, right?
This is pointer; e.g. values of this layout will be associated with the MemoryAddress.class carrier. So, no, for
size_t, you need something different (either LONG or LONGLONG, depending on the platform). We could probably add a
SIZE_T in there, since it's frequent enough.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/371
More information about the panama-dev
mailing list