[foreign] RFR 8209496: Minimize allocation in NativeInvoker::invokeNormal
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Aug 14 13:12:10 UTC 2018
Hi,
this patch avoids some expensive allocations in the
NativeInvoker::invokeNormal code path. This code has to perform two tasks:
* given an input array of (Java) object arguments, it has to copy the
marshalled version of such arguments into a long array
* given a long array contaning return value, it has to extract a Java
object out of it (or copying the contents in the desired memory location)
To carry out most of these operation, it suffices to operate at a low
level, by viewing the long arrays managed by the system ABI as a 'heap'
pointer (see new routine BoundedPointer::fromLongArray). From there, we
can simply get/set values, using the pointer setter/getters which will
directly affect the underlying array, with no need to go via a third
pointer.
Webrev:
http://cr.openjdk.java.net/~mcimadamore/panama/8209496/
P.S.
Given the touched area is quite delicate, some testing on different
platforms would be appreciated :-)
Cheers
Maurizio
More information about the panama-dev
mailing list