[foreign-memaccess] RFR 8237349: Memory access var handles are never called with exact types
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Jan 30 13:30:31 UTC 2020
Yes - I realized that yesterday... will fix and push if that's ok
Maurizio
On 30/01/2020 13:28, Jorn Vernee wrote:
> Hi,
>
> Aren't you missing the fixup for the other two
> memoryAddressViewVarHandle calls in MemoryHandles?
>
> Jorn
>
> On 29/01/2020 17:10, Maurizio Cimadamore wrote:
>> We currently have an issue: since the memory access var handle have
>> to use MemoryAddressProxy as their first coordinate (such handles are
>> generated in java.base which doesn't see the true MemoryAddress
>> interface), whenever a var handle get/set fall outside the guards in
>> VarHandleGuards performance suffer big time, because a full asType()
>> adaptation has to occur.
>>
>> For instance these are some numbers for the TestOverNonConstant
>> benchmark:
>>
>> W/ guards
>>
>> 0.306 ms/op
>>
>> W/o guards (-Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false)
>>
>> 13.926 ms/op
>>
>> The proposed patch adds an adaptation step to all memory access
>> handles, so that their coordinate type is adjusted to be
>> MemoryAddress, not MemoryAddressProxy. With this, there's no
>> difference in performances w/ and w/o guards.
>>
>> Webrev:
>>
>> http://cr.openjdk.java.net/~mcimadamore/panama/8237349/
>>
>> Note: as demonstrated in the test changes, this also makes adapting
>> access var handle easier, since the user can't really access
>> MemoryAddressProxy.
>>
>> P.S.
>> As a precaution I've run all our microbenchmark which seem unaffected
>> by this (except in cases where, as shown above, this patch makes
>> quite the - positive - difference).
>>
>> Maurizio
>>
>>
More information about the panama-dev
mailing list