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

Jorn Vernee jvernee at openjdk.java.net
Mon May 11 11:44:56 UTC 2020

> 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

Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev
excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since
the last revision:

 - Reduce code duplication as suggested in review
 - Add more type checking for MethodType and FunctionDescriptors used for linking


  - all: https://git.openjdk.java.net/panama-foreign/pull/158/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/158/files/6e55e6cc..cc8402a9

 - full: https://webrevs.openjdk.java.net/panama-foreign/158/webrev.01
 - incr: https://webrevs.openjdk.java.net/panama-foreign/158/webrev.00-01

  Stats: 197 lines in 6 files changed: 133 ins; 32 del; 32 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/158.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/158/head:pull/158

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

More information about the panama-dev mailing list