8244720: Check MethodType and FunctionDescritpor used when linking #158
Conversation
|
Webrevs
|
Good fix overall - it seems like it also pointed out subtle issues in some of our tests. I've added some (optional) suggestions about code reuse. |
...ncubator.foreign/share/classes/jdk/internal/foreign/abi/SharedUtils.java
Show resolved
Hide resolved
@JornVernee This change now passes all automated pre-integration checks, type
There are currently no new commits on the
|
/integrate |
@JornVernee |
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:
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
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/panama-foreign pull/158/head:pull/158
$ git checkout pull/158