[foreign-memaccess] RFR 8226526: Add extra static checks to MemoryAccessVarHandles
Jorn Vernee
jbvernee at xs4all.nl
Tue Jun 25 15:44:52 UTC 2019
On 2019-06-21 10:58, Maurizio Cimadamore wrote:
> I realized that there is an issue in the way we construct indexed
> access VH with the combinator - that is, we should _prepend_ the new
> stride to the existing list, not append it.
Good catch, thanks!
> In other words, you want the access coordinates of the final var
> handle to affect the outermost sequence first, then the next enclosed
> sequence, and so forth.
>
> I've also added a test that checks this.
>
> http://cr.openjdk.java.net/~mcimadamore/panama/8226526_v2/
>
> (the patch has been rebased on top of 8226519, so it might not apply
> cleanly on a vanilla repo)
FWIW, having multiple different accessors in JLIAccess was one of the
reasons I ended putting MemoryAccessVarHandles in java.lang.invoke.
Patch looks good. Minor nits:
- In MemoryAccessVarHandles in a bunch of places in the javadoc; "a
memory access memory access" -> "Creates a memory access var handle"
- Maybe dereferenceVarHandle should be renamed to dereferenceHandle to
be more in line with the other names?
Also, I'm wondering if there needs to be a public method for getting the
default alignment as well. If someone just wants to change the byte
order, a readable way of getting the default alignment would be nice,
just like we have ByteOrder.nativeOrder().
Jorn
> Maurizio
>
> On 20/06/2019 17:50, Maurizio Cimadamore wrote:
>> Hi,
>> as discussed in [1], here's a patch which adds extra checks to the
>> combinator methods in MemoryAccessVarHandles.
>>
>> This also consolidates the combinators API, by removing the alignment
>> and byte order combinators (which are now part of the leaf combinator
>> method).
>>
>> I also moved MemoryAccessVarHandle from j.l.invoke to java.foreign -
>> we want to keep the foreign classes close together in preparation for
>> when we'll need to push them onto a different (incubating) module.
>>
>> Webrev:
>>
>> http://cr.openjdk.java.net/~mcimadamore/panama/8226526/
>>
>> Cheers
>> Maurizio
>>
More information about the panama-dev
mailing list