Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiExport.cpp @ 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 | 37f87013dfd8 |
children | 16c930df1e9b |
comparison
equal
deleted
inserted
replaced
608:0386097d43d8 | 609:ea20d7ce26b0 |
---|---|
1870 void JvmtiExport::post_dynamic_code_generated_while_holding_locks(const char* name, | 1870 void JvmtiExport::post_dynamic_code_generated_while_holding_locks(const char* name, |
1871 address code_begin, address code_end) | 1871 address code_begin, address code_end) |
1872 { | 1872 { |
1873 // register the stub with the current dynamic code event collector | 1873 // register the stub with the current dynamic code event collector |
1874 JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current()); | 1874 JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current()); |
1875 // state can only be NULL if the current thread is exiting which | |
1876 // should not happen since we're trying to post an event | |
1877 guarantee(state != NULL, "attempt to register stub via an exiting thread"); | |
1875 JvmtiDynamicCodeEventCollector* collector = state->get_dynamic_code_event_collector(); | 1878 JvmtiDynamicCodeEventCollector* collector = state->get_dynamic_code_event_collector(); |
1876 guarantee(collector != NULL, "attempt to register stub without event collector"); | 1879 guarantee(collector != NULL, "attempt to register stub without event collector"); |
1877 collector->register_stub(name, code_begin, code_end); | 1880 collector->register_stub(name, code_begin, code_end); |
1878 } | 1881 } |
1879 | 1882 |
2251 | 2254 |
2252 // Setup current current thread for event collection. | 2255 // Setup current current thread for event collection. |
2253 void JvmtiEventCollector::setup_jvmti_thread_state() { | 2256 void JvmtiEventCollector::setup_jvmti_thread_state() { |
2254 // set this event collector to be the current one. | 2257 // set this event collector to be the current one. |
2255 JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current()); | 2258 JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current()); |
2259 // state can only be NULL if the current thread is exiting which | |
2260 // should not happen since we're trying to configure for event collection | |
2261 guarantee(state != NULL, "exiting thread called setup_jvmti_thread_state"); | |
2256 if (is_vm_object_alloc_event()) { | 2262 if (is_vm_object_alloc_event()) { |
2257 _prev = state->get_vm_object_alloc_event_collector(); | 2263 _prev = state->get_vm_object_alloc_event_collector(); |
2258 state->set_vm_object_alloc_event_collector((JvmtiVMObjectAllocEventCollector *)this); | 2264 state->set_vm_object_alloc_event_collector((JvmtiVMObjectAllocEventCollector *)this); |
2259 } else if (is_dynamic_code_event()) { | 2265 } else if (is_dynamic_code_event()) { |
2260 _prev = state->get_dynamic_code_event_collector(); | 2266 _prev = state->get_dynamic_code_event_collector(); |