[foreign-memaccess] RFR 8226526: Add extra static checks to MemoryAccessVarHandles

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Jun 25 17:27:16 UTC 2019


>
> 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?
Fixed both and pushed, thanks
>
> 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().

Well, default alignment in simple cases is just == carrier size. So, for 
these there are already some static fields in the JDK, see 
Integer::SIZE, which could be used for this purpose.

For now I'm leaning towards: we don't need this; but we can always add 
later if needs arise.

Maurizio

>
> 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