RFR: 8268902: Testing for threadObj != NULL is unnecessary in handshake

Coleen Phillimore coleenp at openjdk.java.net
Fri Jun 25 16:39:07 UTC 2021


On Wed, 16 Jun 2021 16:03:04 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> The handshake code tests if the JavaThread->is_exiting or that the threadObj() is null. Ever since JDK-8244997, once the JavaThread is running, the _threadObj won't be null until JavaThread is destroyed. So testing is_exiting is all you need to do.
> In gtest, the test JavaThread doesn't create a _threadObj JDK-8215948 so removing this unnecessary test allows writing gtests for handshakes.
> 
> Tested with tier1-6.

Things got conflated in this PR.  The test is here:

bool HandshakeState::suspend_with_handshake() {
  if (_handshakee->is_exiting() ||
     _handshakee->threadObj() == NULL) {
    log_trace(thread, suspend)("JavaThread:" INTPTR_FORMAT " exiting", p2i(_handshakee));
    return false;
  }

We get the JavaThread from threadObj then call java_suspend, so it can't be NULL!

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

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


More information about the hotspot-runtime-dev mailing list