[foreign] RFR: add binder support for panama array carriers

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri May 25 17:35:47 UTC 2018


Slightly updated webrev which hoists the MH creation in 
BoundedArray::copyTo/From

http://cr.openjdk.java.net/~mcimadamore/panama/array_carrier-v2/

Maurizio


On 25/05/18 18:26, Maurizio Cimadamore wrote:
> Hi,
> this patch removes binder support for Java array carriers and rewrires 
> array support to use the Panama Array class.
>
> To allow interop from Java arrays and back the following API points 
> have been added:
>
> Array<Integer> nativeArray = ...
> int[] ia = nativeArray.toArray(int[]::new);
>
> And, the reverse operation is handled by Scope, by having a form of 
> native array allocation which takes a Java array initializer:
>
> Array<Integer> newNativeArray = scope.allocateArray(NativeTypes.INT32, 
> ia);
>
> This seems to work pretty well in terms of usability. Under the hood, 
> the methods BoundedArray::copyFrom/To use MethodHandles to avoid 
> boxing of elements.
>
> I've removed a lot of code that had to do, directly or indirectly, 
> with Java array accessors generated by the binder.
>
> Webrev:
>
> http://cr.openjdk.java.net/~mcimadamore/panama/array_carrier/
>
> Cheers
> Maurizio
>
>



More information about the panama-dev mailing list