RFR (XS): 8014890 : Reference queues may return more entries than expected

David Holmes david.holmes at oracle.com
Fri Jul 5 05:58:32 UTC 2013


On 1/07/2013 9:44 PM, Aleksey Shipilev wrote:
> On 07/01/2013 03:37 PM, David Holmes wrote:
>> On 1/07/2013 8:14 PM, Aleksey Shipilev wrote:
>>> The same "thou shalt not do multiple volatile reads" applies to
>>> "(r.queue == NULL) || (r.queue == ENQUEUED)" now.
>>
>> Doesn't that just reduce to "r.queue != this" ? (The assert suggests
>> so :) )
>
> Thomas' original patch had this in form of "r.queue != this". I argue it
> is more future-proof to distinguish the concrete cases.

Seems dubious to me - depends on what the future change would be. Here 
and now it does two comparisons instead of one - which seems a micro 
deoptimization.

>>> Also, continuing on the micro-optimization spree, you might want to
>>> use bitwise |, not logical ||, saving a branch.
>>
>> Bit-wise OR? What bits are you ORing ?
>
> You *can* bitwise OR two booleans; which would only remove
> short-circuiting behavior with the benefit of clearing one branch. See
> http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2

How obscure :)

David

> -Aleksey.
>



More information about the core-libs-dev mailing list