API review of VarHandles

Vitaly Davidovich vitalyd at gmail.com
Fri Jan 22 14:14:43 UTC 2016

+1, good stuff Aleksey (I had actually seen chatter about this change on
one of these openjdk lists, but people have already moved away from the
field updaters), except every time I think about final instance fields not
being treated as constants I get sad :).  The other wrinkle is the "am I
lucky today to get proper inlining" in order to peel away costs.  I'm not
sure whether VH machinery will make this work reliably, irrespective of
callsite frequency, inlining depth, etc (that's another advantage of
bytecode -- there's no need to crack method chains).

On Fri, Jan 22, 2016 at 9:04 AM, David M. Lloyd <david.lloyd at redhat.com>

> On 01/22/2016 07:57 AM, Aleksey Shipilev wrote:
>> On 01/22/2016 04:54 PM, David M. Lloyd wrote:
>>> The costs are both performance and memory overhead.  The
>>> Atomic*FieldUpdaters are good for memory usage and reasonably usable,
>>> but suffer from performance problems and generics issues.
>> Hopefully, not anymore:
>>   http://shipilev.net/blog/2015/faster-atomic-fu/
>> BTW, those are the same techniques we use to compile VarHandles down to
>> the naked memory accesses.
> Great, nice work, and nice article!
> --
> - DML

More information about the valhalla-dev mailing list