[foreign-memaccess+abi] RFR: Beef up javadoc for base offset in var handles derived from layouts [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Oct 4 18:00:52 UTC 2023


> This PR adds more javadoc to explain how base offsets in var handles obtained from layouts can be used.
> 
> First, a number of examples in the main `MemoryLayout` javadoc is rectified, as such examples did not use the additional base offset parameter (and were hence incorrect).
> 
> Second, the var handles part in the `MemorySegment` section on "accessing memory segment" has been rewritten to avoid duplication with the concepts exposed in `MemoryLayout`. Now we show how `MemorySegment::get` and `MemorySegment::getAtIndex` can be obtained using basic var handles and combinators. We mention that more complex var handles can be obtained using layout paths, but we now just reference the layout path section.
> 
> Last, I've added a new section on the `MemoryLayout` javadoc, with an example on how to deal with variable-length structs. This example showcases how var handles can be used in intricate situations, and combined with the new `scaleOffset` method.

Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:

  Address review comments

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

Changes:
  - all: https://git.openjdk.org/panama-foreign/pull/901/files
  - new: https://git.openjdk.org/panama-foreign/pull/901/files/8be813b1..add4ad14

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=panama-foreign&pr=901&range=01
 - incr: https://webrevs.openjdk.org/?repo=panama-foreign&pr=901&range=00-01

  Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/panama-foreign/pull/901.diff
  Fetch: git fetch https://git.openjdk.org/panama-foreign.git pull/901/head:pull/901

PR: https://git.openjdk.org/panama-foreign/pull/901


More information about the panama-dev mailing list