sun.nio.ch.DirectBuffer and jdk9/jigsaw
Alan.Bateman at oracle.com
Thu Feb 23 10:02:19 UTC 2017
On 22/02/2017 14:06, Vitaly Davidovich wrote:
> Yes, I know it's never been supported. That's been fine and it has
> worked well ... until jigsaw came into the picture. So my real
> question is really whether there can be a proper/supported API, with
> good performance characteristics, that would give access to the base
> address of a direct bytebuffer. In other words, can we make the
> notion of a direct bytebuffer first class? That notion would carry the
> base address with it (amongst whatever else is deemed worthwhile).
> NewDirectByteBuffer is used on the JNI side already, but I need
> something at the Java level to get the base address so that field
> offsets can be calculated for reading data using Unsafe (yes, another
> performance hack because officially supported Java variants currently
> don't JIT well enough). The use case is a "view" of native memory,
> attached to a DBB, used for IPC.
If you are using NewDirectByteBuffer already then couldn't you use a map
of ByteBuffer -> address?
More information about the jigsaw-dev