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

EnterInterpOnlyModeClosure::completed() always returns true

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 16
    • Fix Version/s: 16
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b21

      Description

      JDK-8238761 introduced this funky code:

      class EnterInterpOnlyModeClosure : public HandshakeClosure {
       private:
        bool _completed;
       public:
        EnterInterpOnlyModeClosure() : HandshakeClosure("EnterInterpOnlyMode"), _completed(false) { }
        void do_thread(Thread* th) {
           ...
           _completed = true;
        }
        bool completed() {
          return _completed = true;
        }
      };

      It seems the flag is there to communicate that target thread indeed executed the handshake. But `completed()` sets the bool unconditionally and always returns true. And it is used in one and only place here:

           guarantee(hs.completed(), "Handshake failed: Target thread is not alive?");

      ...which means that guarantee always passes.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shade Aleksey Shipilev
              Reporter:
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: