520 // method_id - jmethodID of the method being executed |
520 // method_id - jmethodID of the method being executed |
521 |
521 |
522 extern "C" { |
522 extern "C" { |
523 JNIEXPORT |
523 JNIEXPORT |
524 void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { |
524 void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) { |
525 |
|
526 // This is if'd out because we no longer use thread suspension. |
|
527 // However if someone wanted to backport this to a 5.0 jvm then this |
|
528 // code would be important. |
|
529 #if 0 |
|
530 if (SafepointSynchronize::is_synchronizing()) { |
|
531 // The safepoint mechanism is trying to synchronize all the threads. |
|
532 // Since this can involve thread suspension, it is not safe for us |
|
533 // to be here. We can reduce the deadlock risk window by quickly |
|
534 // returning to the SIGPROF handler. However, it is still possible |
|
535 // for VMThread to catch us here or in the SIGPROF handler. If we |
|
536 // are suspended while holding a resource and another thread blocks |
|
537 // on that resource in the SIGPROF handler, then we will have a |
|
538 // three-thread deadlock (VMThread, this thread, the other thread). |
|
539 trace->num_frames = ticks_safepoint; // -10 |
|
540 return; |
|
541 } |
|
542 #endif |
|
543 |
|
544 JavaThread* thread; |
525 JavaThread* thread; |
545 |
526 |
546 if (trace->env_id == NULL || |
527 if (trace->env_id == NULL || |
547 (thread = JavaThread::thread_from_jni_environment(trace->env_id)) == NULL || |
528 (thread = JavaThread::thread_from_jni_environment(trace->env_id)) == NULL || |
548 thread->is_exiting()) { |
529 thread->is_exiting()) { |