[foreign-memaccess] RFR: 8252504: Add a method to MemoryLayout which returns a offset-computing method handle [v2]
Jorn Vernee
jvernee at openjdk.java.net
Tue Nov 24 15:14:27 UTC 2020
> 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
-------------
Changes: https://git.openjdk.java.net/panama-foreign/pull/396/files
Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=396&range=01
Stats: 315 lines in 4 files changed: 256 ins; 7 del; 52 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/396.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/396/head:pull/396
PR: https://git.openjdk.java.net/panama-foreign/pull/396
More information about the panama-dev
mailing list