code: private void sweep() {
          for (Node p = head, s, n; p != null && (s = p.next) != null; ) {
              if (!s.isMatched())
                  // Unmatched nodes are never self-linked
                  p = s;
              else if ((n = s.next) == null) // trailing node is pinned
                  break;
              else if (UNLINKED == n)    // stale
                  // No need to also check for p == s, since that implies s == n
                  p = head;
              else
                  p.casNext(s, n);
          }
      }
docs: Unlinks matched (typically cancelled) nodes encountered in a
  traversal from head.