[Integrated] [foreign-abi] RFR: 8244720: Check MethodType and FunctionDescritpor used when linking

Jorn Vernee jvernee at openjdk.java.net
Mon May 11 11:53:12 UTC 2020


On Mon, 11 May 2020 10:19:39 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Hi,
> 
> This patch adds exhaustive checking to the MethodType and FunctionDescriptor used to link down calls and upcalls.
> 
> These checks define and enforce a set of acceptable carrier types, as well as which carrier type & memory layout
> combinations are acceptable. The set of accepted carrier types is:
> 1. The primitives: byte, short, char, int, long, float and double (excluding void and boolean)
> 2. MemoryAddress
> 3. MemorySegment
> 
> For (1), it is also checked that the used MemoryLayout is a ValueLayout, and that the size of the carrier matches the
> size of the layout. For (2) the expected layout must also be a ValueLayout, and again the size is checked. For (3) it
> is only checked that the layout is a GroupLayout, (since we don't have access to the size of the segment when
> linking).  This makes it easier to reason about the set of MethodType and FunctionDescriptor combinations that can be
> used during linking, as well as helping to catch any errors made with mismatching carrier types and memory layouts.
> The additional checks turned up 2 cases of carrier type to memory layout mismatch in StdLibTest, which I've fixed.
> Thanks,
> Jorn

This pull request has now been integrated.

Changeset: 5deb924b
Author:    Jorn Vernee <jvernee at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/5deb924b
Stats:     194 lines in 11 files changed: 13 ins; 170 del; 11 mod

8244720: Check MethodType and FunctionDescritpor used when linking

Reviewed-by: mcimadamore

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

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


More information about the panama-dev mailing list