Integrated: 8317824: Beef up javadoc for base offset in var handles derived from layouts (mainline)

Jorn Vernee jvernee at openjdk.org
Fri Oct 13 19:11:21 UTC 2023


On Tue, 10 Oct 2023 17:58:12 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Port of: https://github.com/openjdk/panama-foreign/pull/901
> 
> Original PR body:
> 
>> 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.

This pull request has now been integrated.

Changeset: 32a60cf1
Author:    Jorn Vernee <jvernee at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/32a60cf11d08aa34592269e6e9bdd7453583a8ad
Stats:     123 lines in 2 files changed: 78 ins; 17 del; 28 mod

8317824: Beef up javadoc for base offset in var handles derived from layouts (mainline)

Co-authored-by: Maurizio Cimadamore <mcimadamore at openjdk.org>
Reviewed-by: mcimadamore

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

PR: https://git.openjdk.org/jdk/pull/16127


More information about the core-libs-dev mailing list