RFR: 8254780: EnterInterpOnlyModeClosure::completed() always returns true

Aleksey Shipilev shade at openjdk.java.net
Wed Oct 14 15:25:20 UTC 2020


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.

Attention @robehn :)

-------------

Commit messages:
 - 8254780: EnterInterpOnlyModeClosure::completed() always returns true

Changes: https://git.openjdk.java.net/jdk/pull/662/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=662&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8254780
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/662.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/662/head:pull/662

PR: https://git.openjdk.java.net/jdk/pull/662


More information about the serviceability-dev mailing list