JDK-8254780 : EnterInterpOnlyModeClosure::completed() always returns true
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-10-14
  • Updated: 2020-10-22
  • Resolved: 2020-10-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b21Fixed
Related Reports
Relates :  
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. 
Comments
Changeset: da2f5ab5 Author: Aleksey Shipilev <shade@openjdk.org> Date: 2020-10-14 20:56:58 +0000 URL: https://git.openjdk.java.net/jdk/commit/da2f5ab5
14-10-2020