[foreign-memacces] RFR 8224993: Add Unsafe support for MemoryAddress
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed May 29 16:17:15 UTC 2019
Hi,
after adding byte buffer interop support, I think it's worth looking at
another avenue of migration - that is, translating a MemoryAddress into
a base/offset coordinate pair, used by the Unsafe class.
http://cr.openjdk.java.net/~mcimadamore/panama/8224993/
In addition to add the trivial Unsafe capabilities, this patch also
fixes some issues that were left unaddressed after the addition of
ByteBuffer support - more specifically, the wrapped 'scoped' buffers do
not have the 'address' , 'hb' and the 'capacity' fields set -
unfortunately, these fields are accessed in a raw fashion to implement
JNI functionalites such as GetDirectBufferAddress and
GetDirectBufferCapacity.
I've also removed the bit-swapping from the
VarHandleMemoryAddressAsBytes class - after all, NativeOrder deals with
_byte_ swapping, so there's nothing meaningful we can do at the byte
level (and that's also consistent with what ByteBuffer does).
Cheers
Maurizio
More information about the panama-dev
mailing list