RFR: 8257184: Upstream 8252504: Add a method to MemoryLayout which returns a offset-computing method handle

Chris Hegarty chegar at openjdk.java.net
Fri Nov 27 09:14:59 UTC 2020


On Thu, 26 Nov 2020 19:24:16 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> This upstreams the patch from: https://github.com/openjdk/panama-foreign/pull/396
> 
> There were only some minor merge conflicts due to imports and some tests being replaced by java/foreign/TestNulls. All tests still pass, no other changes were needed.
> 
> CSR: https://bugs.openjdk.java.net/browse/JDK-8257187

src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java line 433:

> 431:      * multiple sequence element indices (see {@link PathElement#sequenceElement(long, long)}).
> 432:      * @throws UnsupportedOperationException if one of the layouts traversed by the layout path has unspecified size.
> 433:      * @throws NullPointerException if either {@code elements == null}, or if any of the elements

Given the recent class-level note about null handling, then this explicit at NullPointerException tag can probably be dropped.

src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java line 423:

> 421:      * arguments, whereas {@code c_1}, {@code c_2}, ... {@code c_m} and {@code s_0}, {@code s_1}, ... {@code s_n} are
> 422:      * <em>static</em> stride constants which are derived from the layout path.
> 423:      *

Would it be worth adding a simple example that demonstrates how this particular MH can be used, e.g.
with a sequence layout of say 10 Java ints ?

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

PR: https://git.openjdk.java.net/jdk/pull/1468


More information about the core-libs-dev mailing list