[foreign-preview] RFR: 8280597: Refactor java.lang.invoke.MethodHandles::memoryAccessVarHandle

Julia Boes jboes at openjdk.java.net
Mon Mar 7 14:11:30 UTC 2022


On Mon, 7 Mar 2022 13:56:55 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This patch renames `MethodHandles::memoryAccessVarHandle` to `MethodHandles:memorySegmentViewVarHandle`, which is consistent with other methods in that class like `byteArrayViewVarHandle` and `byteBufferViewVarHandle`.
> 
> When doing this, I also renamed several implementation classes and methods (included some automatically generated ones) to use the new names, and be more consistent with the naming scheme adopted for byte buffer var handle views.
> 
> Finally, I tweaked the javadoc to use the new name. When doing this, I realized that the toplevel package javadoc was diving into var handles and combinators way too soon, so I have beefed up the memory segment dereference section (in the `MemorySegment` javadoc) and added a link from the package javadoc to that section.
> 
> I'm still not 100% happy about how the memory segment javadoc looks, but for unrelated reasons, and I will deal with that in a separate pass.

Looks good, aside from the few comments on the doc text.

src/java.base/share/classes/java/lang/foreign/package-info.java line 35:

> 33:  * The main abstraction introduced to support foreign memory access is {@link java.lang.foreign.MemorySegment}, which
> 34:  * models a contiguous memory region, which can reside either inside or outside the Java heap. Moreover,
> 35:  * the {@link java.lang.foreign.MemoryLayout} class hierarchy enables description of <em>memory layouts</em>

enables **the** description of <em>memory layouts</em> and basic operations such as computing the size in bytes of a given layout **or** obtaining its alignment requirements?

src/java.base/share/classes/java/lang/invoke/VarHandles.java line 305:

> 303:      * Creates a memory segment view var handle.
> 304:      *
> 305:      * Resulting var handle will take a memory segment as first argument (the segment to be dereferenced),

Maybe "The resulting var handle"?

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

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


More information about the panama-dev mailing list