[foreign-memaccess+abi] RFR: Add support for high-level functions to copy to and from Java arrays [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Jun 21 20:48:41 UTC 2021


On Mon, 21 Jun 2021 18:15:58 GMT, Uwe Schindler <uschindler at openjdk.org> wrote:

> Performance is much better, but not yet ideal!
> 
> Maybe you should really think about implementing all those copy methods between arrays and segments without slicing and ideally also without wrapped segments.
> 
> Wouldn't it be so complicated to just implement all the MemoryCopy methods like that?

As you say, it is fairly easy to re-implement the various methods using unsafe directly. It does create a bit of a problem in terms of API stacking, in the sense that the `MemorySegment::copyFrom` method, while in principle is a "primitive" in reality cannot act like one because of performance-related concerns. But perhaps this is just a transient concern: eventually we'll get primitive classes and we'll be able to avoid allocation w/o having to rely on escape analysis.

I'll work to re-implement the various methods tomorrow.

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/555


More information about the panama-dev mailing list