[concurrency-interest] ConcurrentHashMapV8

Doug Lea dl at cs.oswego.edu
Fri Sep 2 14:38:58 EDT 2011


On 09/02/11 09:51, Dr Heinz M. Kabutz wrote:
> else if (e.hash < 0)
> tab = (Node[])e.key;
>
> If would be clearer if that had been:
>
> else if (e.hash == MOVED)
> tab = (Node[])e.key;
>
> Magic constants are usually a bad idea, even with < 0.

Thanks. Changed to ...
     else if (eh < 0) { // sign bit set -- bin was moved during resize
... (plus some other internal documentation improvements),
because in the next update, forwarding nodes will have other
information encoded in hash fields to support range traversals
needed for parallel aggregate operations. The only distinguishing
property is the sign bit, which is most sensibly expressed as
a check of  < 0.

-Doug


More information about the Concurrency-interest mailing list