RFR (M): 8184334: Generalizing Atomic with templates

Aleksey Shipilev shade at redhat.com
Mon Jul 17 16:49:19 UTC 2017


On 07/17/2017 05:56 PM, Aleksey Shipilev wrote:
> On 07/17/2017 05:49 PM, Erik Österlund wrote:
>>> Something like the Unsafe.{get|put|CAS} -Xint performance test would be nice to
>>> have.
>>
>> Sorry, but I do not understand what you mean here.
>>
>> 1) The code only boils down to performing casts that do not change any bit
>> pattern, and is by contract forced to be expanded and inlined at compile time,
>> so I would be very surprised about any regressions.
>> 2) This code executes when we are about to perform atomic operations, so any
>> accidental code generated for the casting (which seems odd in the first place),
>> I would be very surprised to see.
>> 3) Even if there was some barely noticeable regression in fastdebug atomics for
>> whatever reason, I do not know if I think it makes sense to pollute the code
>> with ugly hacks to micro optimize fastdebug execution time.
> 
> I agree that fastdebug should not be our primary optimization target. I was
> wondering if all the template magic actually works well in fastdebug builds.
> 
> Or product builds, for that matter: because while templates are indeed done
> during compile-time, say, the inliner that has to deal with new code shapes can
> have opinions.
> 
> There are some VarHandles perf tests I have lying around, I can check this
> myself today.

Checked, times are the same for baseline/patched builds with either fastdebug or
release bits. Ditto the instruction counts, number of memory accesses, branches,
etc. Seems good!

Thanks,
-Aleksey



More information about the hotspot-runtime-dev mailing list