[foreign] RFR: misc binder improvements

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jun 21 16:55:19 UTC 2018


Hi,
I took care of some suboptimal things in the binder, to make it as fast 
as possible (w/o going too deep into premature optimization territory). 
Among the improved patterns:

* Reference class is rewritten so that all MH are now static

* related to above: turned LayoutType into an interface (so that 
carrier(), pointertype() elementtype() are not exposed to public API, 
but can be accessed internally)

* Avoid Scope.allocateStruct in NativeInvoker, as that causes layout parsing

* pre-cache all static info about a call (e.g. all LayoutTypes), again 
Util.makeType can cause layout parsing so we don't want to do that in 
the middle of a native call

* as before, but from the UpcallHandler path (this meant a new class 
UpcallHandlerFactory is added that caches all static info)

These improvements bring the panama generated code almost in parity with 
JNI code when running the clang-ffi test.

Webrev:
http://cr.openjdk.java.net/~mcimadamore/panama/binder-opts/

Maurizio




More information about the panama-dev mailing list