Nits and typos found during review of fix for JDK-8366659

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • 26
    • Affects Version/s: 26
    • Component/s: hotspot
    • generic
    • generic

      I did a few read-throughs of the changes for:

          JDK-8366659 ObjectMonitor::wait() can deadlock with a suspension request

      I noticed various nits and typos and didn't want put them in that PR
      since the fix might need backporting.

      Here's what I have found so far:

      jdk/src/hotspot/share/runtime/objectMonitor.cpp

      189: // Once we have formed a doubly linked list it's easy to find the
      190: // successor (A), wake it up, have it remove itself, and update the
      191: // tail pointer, as seen in and 3) below.

      Typo: s/, as seen in and 3) below./see 3) below./
      to match the style in #1's reference to #2.


      735: assert(!has_successor(current), "invariant");
      736: assert(has_owner(current), "invariant");

      The usual order is check 'owner' then check 'successor'.

      943: assert(!has_successor(current), "invariant");
      944: assert(has_owner(current), "invariant");

      The usual order is check 'owner' then check 'successor'.

      964: assert(!has_successor(current), "invariant");
      965: assert(!has_owner(current), "invariant");

      1041: // We can find that we were unpark()ed and redesignated _succ while
      1042: // we were spinning. That's harmless. If we iterate and call park(),
      1043: // park() will consume the event and return immediately and we'll
      1044: // just spin again. This pattern can repeat, leaving _succ to simply
      1045: // spin on a CPU.
      1046:
      1047: if (has_successor(current)) clear_successor();

      Please put the 'clear_successor()' on a line by itself and add
      enclosing '{' and '}'.

      Also, there should be a single space after the periods in the comments
      and not double spaces.

      1060: // *must* retry _owner before parking.

      Nit: extra space after 'retry' and before '_owner'.

      1103: // of carriers. This can happen, for example, if a mixed of unmounted and

      Typo: s/if a mixed of/if a mix of/

      1153: // The lock is still contested.

      Typo: s/contested/contended/

      1157: if (has_successor(current)) clear_successor();

      Please put the 'clear_successor()' on a line by itself and add
      enclosing '{' and '}'.

      1170: if (has_successor(current)) clear_successor();

      Please put the 'clear_successor()' on a line by itself and add
      enclosing '{' and '}'.

      Also needs this comment:
          // Note that we don't need to do OrderAccess::fence() after clearing
          // _succ here, since we own the lock.

      1210: if (has_successor(current)) clear_successor();
      1211: if (waiter == nullptr) delete node; // for Object.wait() don't delete yet

      Please put each of the statement parts on a line by itself and add
      enclosing '{' and '}'.

      Also needs this comment after the clear_successor() call:
          // Note that we don't need to do OrderAccess::fence() after clearing
          // _succ here, since we own the lock.

      1249: if (has_successor(current)) clear_successor();

      Please put the 'clear_successor()' on a line by itself and add
      enclosing '{' and '}'.

      1270: if (has_successor(current)) clear_successor();

      Also needs this comment:
          // Note that we don't need to do OrderAccess::fence() after clearing
          // _succ here, since we own the lock.

      Please put the 'clear_successor()' on a line by itself and add
      enclosing '{' and '}'.

      1561: // then calls exit(). Exit release the lock by setting O._owner to null.

      Typo: s/Exit release the lock/Exit releases the lock/

      There should be a single space after each period in this comment
      block and not double spaces.

      1563: // notify() operation moves T1 from O's waitset to O's entry_list. T2 then
      1564: // release the lock "O".

      Typo: s/release the lock/releases the lock/

      1601: // Note that spinners in Enter() also set _succ non-null.

      This reference to 'Enter()' needs to be updated (I think).

      1920: if (has_successor(current)) clear_successor();

      Please put the 'clear_successor()' on a line by itself and add
      enclosing '{' and '}'.

      2468: clear_successor();
      Needs this comment:
          // Note that we don't need to do OrderAccess::fence() after clearing
          // _succ here, since we own the lock.

            Assignee:
            Anton Artemov
            Reporter:
            Daniel Daugherty
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: