EVALUATION
Some of the NULL checks need to return an error code:
101 state = JvmtiThreadState::state_for(java_thread);
102 if (state == NULL) {
103 return JVMTI_ERROR_THREAD_NOT_ALIVE;
104 }
Some of the state_for() calls and new error code return checks
are moved above the check that returns
JVMTI_ERROR_THREAD_NOT_SUSPENDED. I think it makes sense to
check for liveness before suspension and return the error codes
in that order; an exiting thread won't show up as being not
suspended.
Some of the NULL checks need to return a benign value:
481 if (state == NULL) {
482 // associated JavaThread is exiting
483 return (jlong)0;
484 }
Some of the NULL checks are guarantee() calls since a NULL
JvmtiThreadState value shouldn't happen in that location, i.e.,
when the caller is the current thread, it can't be exiting.
|