[concurrency-interest] 8145539: (coll) AbstractMap.keySet and .values should not be volatile

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Apr 20 10:25:04 EDT 2016


On 04/20/2016 04:50 PM, Volker.Borchert at atis-systems.com wrote:
>> The block in navigableKeySet() is semantically the same as suggested in
>> the Javadoc: it reads the non-volatile $navigableKeySet exactly once.

...

> but only the last one was changed. Am I just routine-blinded?
> 
>> The patch changed keySet() and values() that were doing two racy reads.
> 
> TreeMap.keySet() delegates to navigableKeySet() so the patch to AbstractMap
> won't affect it.

Sorry, I should have meant AbstractMap.keySet() and values(). Those were
broken under non-volatile keySet/values fields.

Others were merely a style/readability rewrites to match the suggested
use: avoiding inline assignments makes reasoning about load/stores
easier. We are quite probably missing those style tuneups in other
places, but this does not affect correctness.

-Aleksey

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20160420/d7f7502c/attachment.bin>


More information about the Concurrency-interest mailing list