[foreign-memaccess+abi] RFR: 8310362: Improve composability of handle derived from layouts [v2]
Jorn Vernee
jvernee at openjdk.org
Thu Jun 22 21:59:27 UTC 2023
On Thu, 22 Jun 2023 21:01:50 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Jorn Vernee has updated the pull request incrementally with five additional commits since the last revision:
>>
>> - missing changes
>> - rework offset computation doc
>> - address most review comments
>> - add collectCoordinates void filter review changes
>> - include root layout check review changes
>
> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 343:
>
>> 341: */
>> 342: @ForceInline
>> 343: default long scale(long offset, long index) {
>
> was thinking... do we want the output of this method to ever be negative? (since it's used as an offset to a segment). Also, should we check for overflows with multiplyExact?
I initially consider negative inputs, I wasn't sure, but thought they might be useful in some cases, so I left them in.
multiplyExact/addExtact seems like a good idea to use.
> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 387:
>
>> 385: * <ul>
>> 386: * <li>its return type is {@code long};</li>
>> 387: * <li>it has at least one {@code long} leading parameter representing the base offset;</li>
>
> should be "it has one" e.g. not "at least one" right?
I put at least one as a hint there might be more (dynamic) coordinates. But maybe it's not important. I'll simplify
-------------
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/840#discussion_r1239068812
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/840#discussion_r1239067606
More information about the panama-dev
mailing list