RFR(S): 8210514: Obsolete SyncVerbose

John Rose john.r.rose at oracle.com
Sat Sep 8 15:02:50 UTC 2018


On Sep 8, 2018, at 9:15 AM, Daniel D. Daugherty <daniel.daugherty at oracle.com> wrote:
> 
> 
> 
>> and this looks like it supresses output or only prints output if there's a collision in the increment?
>> 
>> - if ((v & (v - 1)) == 0) { \
> 
> All these years and I never noticed that line of code
> might be wrong. Because 'v' is a local copy of 'ctr'
> that value will never change so that statement will
> always be true.

That's not wrong; it just isn't doing what you expect.
Check out is_power_of_2 in globalDefinitions.hpp.
It's apparently an exponential backoff trick, to cut
down on output.

We should replace the puzzler expression (v & (v-1))==0
by an named function call is_power_of_2(v), so that the
next person to look at this code will know what is intended.
(More correctly, perhaps (v == 0) || is_power_of_2(v), but
I think that's not necessary.)

— John


More information about the hotspot-runtime-dev mailing list