Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiThreadState.hpp @ 609:ea20d7ce26b0
6800721: 3/4 JavaThread::jvmti_thread_state() and JvmtiThreadState::state_for() robustness
Summary: 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
author | dcubed |
---|---|
date | Mon, 02 Mar 2009 14:00:23 -0700 |
parents | 0386097d43d8 |
children | 6deeaebad47a |
comparison
equal
deleted
inserted
replaced
608:0386097d43d8 | 609:ea20d7ce26b0 |
---|---|
312 bool has_last_frame() { return _thread->has_last_Java_frame(); } | 312 bool has_last_frame() { return _thread->has_last_Java_frame(); } |
313 | 313 |
314 void update_for_pop_top_frame(); | 314 void update_for_pop_top_frame(); |
315 | 315 |
316 // already holding JvmtiThreadState_lock - retrieve or create JvmtiThreadState | 316 // already holding JvmtiThreadState_lock - retrieve or create JvmtiThreadState |
317 // Can return NULL if JavaThread is exiting. | |
317 inline static JvmtiThreadState *state_for_while_locked(JavaThread *thread) { | 318 inline static JvmtiThreadState *state_for_while_locked(JavaThread *thread) { |
318 assert(JvmtiThreadState_lock->is_locked(), "sanity check"); | 319 assert(JvmtiThreadState_lock->is_locked(), "sanity check"); |
319 | 320 |
320 JvmtiThreadState *state = thread->jvmti_thread_state(); | 321 JvmtiThreadState *state = thread->jvmti_thread_state(); |
321 if (state == NULL) { | 322 if (state == NULL) { |
328 } | 329 } |
329 return state; | 330 return state; |
330 } | 331 } |
331 | 332 |
332 // retrieve or create JvmtiThreadState | 333 // retrieve or create JvmtiThreadState |
334 // Can return NULL if JavaThread is exiting. | |
333 inline static JvmtiThreadState *state_for(JavaThread *thread) { | 335 inline static JvmtiThreadState *state_for(JavaThread *thread) { |
334 JvmtiThreadState *state = thread->jvmti_thread_state(); | 336 JvmtiThreadState *state = thread->jvmti_thread_state(); |
335 if (state == NULL) { | 337 if (state == NULL) { |
336 MutexLocker mu(JvmtiThreadState_lock); | 338 MutexLocker mu(JvmtiThreadState_lock); |
337 // check again with the lock held | 339 // check again with the lock held |