Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8280828

Improve invariants in NonblockingQueue::append

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • 19
    • hotspot
    • gc
    • b09

      NonblockingQueue::append has a somewhat complicated and limited set of invariants for the cases where the queue was (logically) empty and is being changed to non-empty.

      When NonblockingQueue::try_pop takes the last element from the queue, it performs some cleanup of the queue _head and _tail. The order of that cleanup is currently _tail then _head. The order doesn't affect the correctness of the algorithm. But if the order were reversed, i.e. _head then _tail, then the invariants in append could be improved. In particular, when append finds a NULL old_tail then the value of _head must also be NULL. That doesn't hold with the current order.

            kbarrett Kim Barrett
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: