295 |
|
* Keys: k, key |
296 |
|
* Values: v, value |
297 |
|
* Comparisons: c |
298 |
– |
* |
299 |
– |
* Note that, with VarHandles, a boolean result of |
300 |
– |
* compareAndSet must be declared even if not used. |
298 |
|
*/ |
299 |
|
|
300 |
|
private static final long serialVersionUID = -8627078645895051609L; |
395 |
|
break; |
396 |
|
} |
397 |
|
} |
398 |
< |
boolean cas = NEXT.compareAndSet(b, n, p); |
398 |
> |
NEXT.compareAndSet(b, n, p); |
399 |
|
} |
400 |
|
} |
401 |
|
|
442 |
|
while ((r = q.right) != null) { |
443 |
|
Node<K,V> p; K k; |
444 |
|
if ((p = r.node) == null || (k = p.key) == null || |
445 |
< |
p.val == null) { // unlink index to deleted node |
446 |
< |
boolean cas = RIGHT.compareAndSet(q, r, r.right); |
450 |
< |
} |
445 |
> |
p.val == null) // unlink index to deleted node |
446 |
> |
RIGHT.compareAndSet(q, r, r.right); |
447 |
|
else if (cpr(cmp, key, k) > 0) |
448 |
|
q = r; |
449 |
|
else |
516 |
|
while ((r = q.right) != null) { |
517 |
|
Node<K,V> p; K k; V v; int c; |
518 |
|
if ((p = r.node) == null || (k = p.key) == null || |
519 |
< |
(v = p.val) == null) { |
520 |
< |
boolean cas = RIGHT.compareAndSet(q, r, r.right); |
525 |
< |
} |
519 |
> |
(v = p.val) == null) |
520 |
> |
RIGHT.compareAndSet(q, r, r.right); |
521 |
|
else if ((c = cpr(cmp, key, k)) > 0) |
522 |
|
q = r; |
523 |
|
else if (c == 0) { |
581 |
|
while ((r = q.right) != null) { |
582 |
|
Node<K,V> p; K k; |
583 |
|
if ((p = r.node) == null || (k = p.key) == null || |
584 |
< |
p.val == null) { |
585 |
< |
boolean cas = RIGHT.compareAndSet(q, r, r.right); |
591 |
< |
} |
584 |
> |
p.val == null) |
585 |
> |
RIGHT.compareAndSet(q, r, r.right); |
586 |
|
else if (cpr(cmp, key, k) > 0) |
587 |
|
q = r; |
588 |
|
else |
645 |
|
head == h) { // try to add new level |
646 |
|
Index<K,V> hx = new Index<K,V>(z, x, null); |
647 |
|
Index<K,V> nh = new Index<K,V>(h.node, h, hx); |
648 |
< |
boolean cas = HEAD.compareAndSet(this, h, nh); |
648 |
> |
HEAD.compareAndSet(this, h, nh); |
649 |
|
} |
650 |
|
if (z.val == null) // deleted while adding indices |
651 |
|
findPredecessor(key, cmp); // clean |
681 |
|
Node<K,V> p; K k; |
682 |
|
if ((p = r.node) == null || (k = p.key) == null || |
683 |
|
p.val == null) { |
684 |
< |
boolean cas = RIGHT.compareAndSet(q, r, r.right); |
684 |
> |
RIGHT.compareAndSet(q, r, r.right); |
685 |
|
c = 0; |
686 |
|
} |
687 |
|
else if ((c = cpr(cmp, key, k)) > 0) |
787 |
|
(d = h.down) != null && d.right == null && |
788 |
|
(e = d.down) != null && e.right == null && |
789 |
|
HEAD.compareAndSet(this, h, d) && |
790 |
< |
h.right != null) { // recheck |
791 |
< |
boolean cas = HEAD.compareAndSet(this, d, h); // try to backout |
798 |
< |
} |
790 |
> |
h.right != null) // recheck |
791 |
> |
HEAD.compareAndSet(this, d, h); // try to backout |
792 |
|
} |
793 |
|
|
794 |
|
/* ---------------- Finding and removing first element -------------- */ |
864 |
|
for (Index<K,V> r, d;;) { |
865 |
|
while ((r = q.right) != null) { |
866 |
|
Node<K,V> p; |
867 |
< |
if ((p = r.node) == null || p.val == null) { |
868 |
< |
boolean cas = RIGHT.compareAndSet(q, r, r.right); |
876 |
< |
} |
867 |
> |
if ((p = r.node) == null || p.val == null) |
868 |
> |
RIGHT.compareAndSet(q, r, r.right); |
869 |
|
else |
870 |
|
q = r; |
871 |
|
} |
925 |
|
for (;;) { |
926 |
|
Index<K,V> d, r; Node<K,V> p; |
927 |
|
while ((r = q.right) != null) { |
928 |
< |
if ((p = r.node) == null || p.val == null) { |
929 |
< |
boolean cas = RIGHT.compareAndSet(q, r, r.right); |
938 |
< |
} |
928 |
> |
if ((p = r.node) == null || p.val == null) |
929 |
> |
RIGHT.compareAndSet(q, r, r.right); |
930 |
|
else if (p.next != null) |
931 |
|
q = r; // continue only if a successor |
932 |
|
else |
1381 |
|
Index<K,V> h, r, d; Node<K,V> b; |
1382 |
|
VarHandle.acquireFence(); |
1383 |
|
while ((h = head) != null) { |
1384 |
< |
if ((r = h.right) != null) { // remove indices |
1385 |
< |
boolean cas = RIGHT.compareAndSet(h, r, null); |
1386 |
< |
} |
1387 |
< |
else if ((d = h.down) != null) { // remove levels |
1397 |
< |
boolean cas = HEAD.compareAndSet(this, h, d); |
1398 |
< |
} |
1384 |
> |
if ((r = h.right) != null) // remove indices |
1385 |
> |
RIGHT.compareAndSet(h, r, null); |
1386 |
> |
else if ((d = h.down) != null) // remove levels |
1387 |
> |
HEAD.compareAndSet(this, h, d); |
1388 |
|
else { |
1389 |
|
long count = 0L; |
1390 |
|
if ((b = h.node) != null) { // remove nodes |