[foreign] RFR: binder should check that no array carriers are present in native functions descriptors

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Aug 7 13:51:32 UTC 2018


Hi,
as a followup of recent's Sundar patch, here's a patch which adds some 
checks to the binder in order to emit a more useful exception when 
attempting to bind a function which contains array carriers. Three cases 
need to be covered:

1) native header binding (this is done through NativeInvoker)
2) callbacks (this is done by adding a check in UpcallHandler)
3) function pointer struct field access - this is done by adding a check 
in LayoutType.ofFunction - which is also handy in case the user wants to 
get a layout type out of an unsupported functional interface

The test check all these three cases. When going through this exercise I 
noted that there was a bug in LayoutResolver when it came to resolving 
arrays - size info was dropped on the floor. I fixed that too.

Two followup comments:

* we should validate what jextract does in cases (2) and (3) as my 
understanding of Sundar patch is that it is mainly focussed at (1)
* we should think of a binder-wide exception type. We are now using 
RuntimeExceptions which is way too broad, we should rethink exception 
handling in the binder

Webrev:

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

Maurizio




More information about the panama-dev mailing list