src/hotspot/share/prims/jvmtiExport.cpp
changeset 57745 789e967c2731
parent 55513 be05771cdfdf
child 58273 08a5148e7c4e
equal deleted inserted replaced
57739:6717d7e59db4 57745:789e967c2731
  2277 // post a DynamicCodeGenerated event while holding locks in the VM.
  2277 // post a DynamicCodeGenerated event while holding locks in the VM.
  2278 void JvmtiExport::post_dynamic_code_generated_while_holding_locks(const char* name,
  2278 void JvmtiExport::post_dynamic_code_generated_while_holding_locks(const char* name,
  2279                                                                   address code_begin, address code_end)
  2279                                                                   address code_begin, address code_end)
  2280 {
  2280 {
  2281   // register the stub with the current dynamic code event collector
  2281   // register the stub with the current dynamic code event collector
  2282   JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current());
  2282   // Cannot take safepoint here so do not use state_for to get
       
  2283   // jvmti thread state.
       
  2284   JvmtiThreadState* state = JavaThread::current()->jvmti_thread_state();
  2283   // state can only be NULL if the current thread is exiting which
  2285   // state can only be NULL if the current thread is exiting which
  2284   // should not happen since we're trying to post an event
  2286   // should not happen since we're trying to post an event
  2285   guarantee(state != NULL, "attempt to register stub via an exiting thread");
  2287   guarantee(state != NULL, "attempt to register stub via an exiting thread");
  2286   JvmtiDynamicCodeEventCollector* collector = state->get_dynamic_code_event_collector();
  2288   JvmtiDynamicCodeEventCollector* collector = state->get_dynamic_code_event_collector();
  2287   guarantee(collector != NULL, "attempt to register stub without event collector");
  2289   guarantee(collector != NULL, "attempt to register stub without event collector");
  2292 void JvmtiExport::record_vm_internal_object_allocation(oop obj) {
  2294 void JvmtiExport::record_vm_internal_object_allocation(oop obj) {
  2293   Thread* thread = Thread::current_or_null();
  2295   Thread* thread = Thread::current_or_null();
  2294   if (thread != NULL && thread->is_Java_thread())  {
  2296   if (thread != NULL && thread->is_Java_thread())  {
  2295     // Can not take safepoint here.
  2297     // Can not take safepoint here.
  2296     NoSafepointVerifier no_sfpt;
  2298     NoSafepointVerifier no_sfpt;
  2297     // Can not take safepoint here so can not use state_for to get
  2299     // Cannot take safepoint here so do not use state_for to get
  2298     // jvmti thread state.
  2300     // jvmti thread state.
  2299     JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
  2301     JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
  2300     if (state != NULL) {
  2302     if (state != NULL) {
  2301       // state is non NULL when VMObjectAllocEventCollector is enabled.
  2303       // state is non NULL when VMObjectAllocEventCollector is enabled.
  2302       JvmtiVMObjectAllocEventCollector *collector;
  2304       JvmtiVMObjectAllocEventCollector *collector;
  2316 void JvmtiExport::record_sampled_internal_object_allocation(oop obj) {
  2318 void JvmtiExport::record_sampled_internal_object_allocation(oop obj) {
  2317   Thread* thread = Thread::current_or_null();
  2319   Thread* thread = Thread::current_or_null();
  2318   if (thread != NULL && thread->is_Java_thread())  {
  2320   if (thread != NULL && thread->is_Java_thread())  {
  2319     // Can not take safepoint here.
  2321     // Can not take safepoint here.
  2320     NoSafepointVerifier no_sfpt;
  2322     NoSafepointVerifier no_sfpt;
  2321     // Can not take safepoint here so can not use state_for to get
  2323     // Cannot take safepoint here so do not use state_for to get
  2322     // jvmti thread state.
  2324     // jvmti thread state.
  2323     JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
  2325     JvmtiThreadState *state = ((JavaThread*)thread)->jvmti_thread_state();
  2324     if (state != NULL) {
  2326     if (state != NULL) {
  2325       // state is non NULL when SampledObjectAllocEventCollector is enabled.
  2327       // state is non NULL when SampledObjectAllocEventCollector is enabled.
  2326       JvmtiSampledObjectAllocEventCollector *collector;
  2328       JvmtiSampledObjectAllocEventCollector *collector;