[foreign-memaccess] Integrated: 8248487: Add static helpers to access segments (continued)

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Jul 3 16:01:44 UTC 2020


On Fri, 3 Jul 2020 14:15:24 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> Following some feedback from jextract experiments, we have noted that, while the set of primitive accessors is the
> right one to expose, as it is the most primitive (and others can be derived from that), usability-wise we lose a bit
> when it comes to perform dereference at offset 0 (in which case an extra offset 0 has to be specified), or a
> dereference with a logical index (e.g. `p[i] = ...`).  To overcome these issues, I've added two additional variants of
> static accessors - now:
> * `getByte_LE(MemoryAddress addr)` -> dereference at given address
> * `getByteAtOffset(MemoryAddress, byte offset)` -> dereference at given address + offset (in bytes)
> * `getByteAtIndex(MemoryAddress, long index)` -> dereference at given logical index (where offset = index * stride)
> 
> Looking at TestByteBuffer, this immediately seem to make things better.

This pull request has now been integrated.

Changeset: 3a5eb82f
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/3a5eb82f
Stats:     1354 lines in 2 files changed: 0 ins; 1292 del; 62 mod

8248487: Add static helpers to access segments (continued)

Reviewed-by: jvernee

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

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


More information about the panama-dev mailing list