[foreign-jextract] RFR 8238232: Jextract erroneously inserts sequence layouts into function descriptor parameter/return

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jan 30 13:37:18 UTC 2020


Hi,
a number of issues have been reported which share a common cause: 
jextract is erroneously using sequence layouts in function 
parameters/returns; also, jextract is also erroneously using 
MemorySegment carriers when this issue happens (instead of just 
MemoryAddress).

I did a bit of a cleanup in our handling of types in functions - now:

1) when we create a function _type_ we always lower array 
parameter/return types to that on a corresponding pointer (as the C 
compiler would do)
2) in the Declaration.Function object, it is possible to access the 
function parameter declarations - no lower is done here (in case 
somebody wanted to retrieve original types as per source code)
3) since Java carriers and FunctionDescriptor are both derived from the 
function type (which is lowered as per (1)) no further fixup is needed - 
the right thing will just happen

This leads to a simpler code, where lowering is done in a single place, 
rather than in 2 (or more) places like before.

I've added a test and refactored our SmokeTest a little to add 
capability to lookup declarations of a given kind.

Webrev:

http://cr.openjdk.java.net/~mcimadamore/panama/8238232/

Cheers
Maurizio



More information about the panama-dev mailing list