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

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Jul 1 11:44:24 UTC 2013


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.

>> 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

-Aleksey.



More information about the core-libs-dev mailing list