[foreign-memaccess] RFR 8235837: Memory access API refinements
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Jan 8 18:59:52 UTC 2020
Not so sure about this no more.
I think if we drop MemoryAddress.offset() and we do nothing else,
MemoryAddress will be hard to work with. You would need at least a
plus(MemoryAddress), minus(MemoryAddress) in order to do be able to do
the stuff that you can do now (although, maybe, the new rebase() - which
is in foreign-abi - can also be used for that use case).
So I'm warming up again to this suggestion from Paul
> s/offset(long l)/relativeTo(long offset) ?
>
> "Returns a new address relative to the given offset from this address.
> The offset of the new address is the sum of the offset of this
> address plus the given offset. The given offset may be negative.”
But I have a question - both 'relativeTo' and "Returns a new address
relative to" seems to suggest that the address you get back is relative
to a new value - which is not true - as the address you get back is
still relative to the owning segment's base address.
Am I the only one finding the use of the 'relative' word confusing here?
E.g. that "relativeTo" seems to suggest re-interpreting of same memory
location, rather than a change in the addressed location.
Maurizio
On 08/01/2020 16:14, Maurizio Cimadamore wrote:
> Hi,
> following the discussion on the API refinements in [1], we have
> converged on the two changes listed below:
>
> * drop the MemoryAddress::offset()
> * add an overload of MemorySegment::asSlice to create a new slice
> given a new memory address (base) + length
> * replace isAccessible with a owner() accessor, which returns the
> owning thread
>
> Webrev:
>
> http://cr.openjdk.java.net/~mcimadamore/panama/8235837/
>
> Cheers
> Maurizio
>
>
More information about the panama-dev
mailing list