[foreign-memaccess] Integrated: 8252504: Add a method to MemoryLayout which returns a offset-computing method handle

Jorn Vernee jvernee at openjdk.java.net
Tue Nov 24 19:09:12 UTC 2020


On Thu, 19 Nov 2020 15:53:44 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> This PR adds two new methods: `bitOffsetHandle` and `byteOffsetHandle` to `MemoryLayout`, that can be used to create method handles that can compute the effective offset of a layout element given a set of additional `long` indexes.
> 
> I also cleaned up a leftover in the javadoc of bitOffset and byteOffset where an API note was stating that `sequenceElement()` layout path elements would be interpreted as `sequenceElement(0)`, but they were actually being rejected outright (as they should).
> 
> I also added some tests to cover the corner case where an UnsupportedOperationException was being thrown. (some of the churn in the tests is from introducing static imports. I hope it's not too noisy).

This pull request has now been integrated.

Changeset: 2293ba7e
Author:    Jorn Vernee <jvernee at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/2293ba7e
Stats:     315 lines in 4 files changed: 256 ins; 7 del; 52 mod

8252504: Add a method to MemoryLayout which returns a offset-computing method handle

Reviewed-by: mcimadamore, chegar

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

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


More information about the panama-dev mailing list