6800721: 3/4 JavaThread::jvmti_thread_state() and JvmtiThreadState::state_for() robustness

Check for NULL return values from jvmti_thread_state() and state_for() and return a JVM TI error code as appropriate.

Reviewed-by: coleenp, swamyv
This commit is contained in:
Daniel D. Daugherty 2009-03-02 14:00:23 -07:00
parent 74a99e1e82
commit 56fe18e375
7 changed files with 47 additions and 7 deletions

View file

@ -1345,6 +1345,13 @@ public:
public:
// Thread local information maintained by JVMTI.
void set_jvmti_thread_state(JvmtiThreadState *value) { _jvmti_thread_state = value; }
// A JvmtiThreadState is lazily allocated. This jvmti_thread_state()
// getter is used to get this JavaThread's JvmtiThreadState if it has
// one which means NULL can be returned. JvmtiThreadState::state_for()
// is used to get the specified JavaThread's JvmtiThreadState if it has
// one or it allocates a new JvmtiThreadState for the JavaThread and
// returns it. JvmtiThreadState::state_for() will return NULL only if
// the specified JavaThread is exiting.
JvmtiThreadState *jvmti_thread_state() const { return _jvmti_thread_state; }
static ByteSize jvmti_thread_state_offset() { return byte_offset_of(JavaThread, _jvmti_thread_state); }
void set_jvmti_get_loaded_classes_closure(JvmtiGetLoadedClassesClosure* value) { _jvmti_get_loaded_classes_closure = value; }