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

Chris Hegarty chegar at openjdk.java.net
Tue Nov 24 17:36:14 UTC 2020


On Tue, 24 Nov 2020 15:14:27 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).
>
> Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 10 commits:
> 
>  - Merge branch 'foreign-memaccess' into OffsetHandle
>  - Touch up javadoc v1
>  - Simplify impl to use strides array
>  - Add test with multiple indexes
>  - Add positive byteOffsetHandle test, and test that tests a bit offset that is not a multiple of 8
>  - Polish impl
>  - Remove unused imports
>  - Added more tests, touched up javadoc
>  - WIP - javadoc
>  - WIP

Marked as reviewed by chegar (no project role).

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

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


More information about the panama-dev mailing list