1481 (*callback)(env->jvmti_external(), tag); |
1481 (*callback)(env->jvmti_external(), tag); |
1482 } |
1482 } |
1483 } |
1483 } |
1484 |
1484 |
1485 void JvmtiExport::post_resource_exhausted(jint resource_exhausted_flags, const char* description) { |
1485 void JvmtiExport::post_resource_exhausted(jint resource_exhausted_flags, const char* description) { |
|
1486 |
|
1487 JavaThread *thread = JavaThread::current(); |
|
1488 |
|
1489 // JDK-8213834: handlers of ResourceExhausted may attempt some analysis |
|
1490 // which often requires running java. |
|
1491 // This will cause problems on threads not able to run java, e.g. compiler |
|
1492 // threads. To forestall these problems, we therefore suppress sending this |
|
1493 // event from threads which are not able to run java. |
|
1494 if (!thread->can_call_java()) { |
|
1495 return; |
|
1496 } |
|
1497 |
1486 EVT_TRIG_TRACE(JVMTI_EVENT_RESOURCE_EXHAUSTED, ("Trg resource exhausted event triggered" )); |
1498 EVT_TRIG_TRACE(JVMTI_EVENT_RESOURCE_EXHAUSTED, ("Trg resource exhausted event triggered" )); |
1487 |
1499 |
1488 JvmtiEnvIterator it; |
1500 JvmtiEnvIterator it; |
1489 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { |
1501 for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { |
1490 if (env->is_enabled(JVMTI_EVENT_RESOURCE_EXHAUSTED)) { |
1502 if (env->is_enabled(JVMTI_EVENT_RESOURCE_EXHAUSTED)) { |
1491 EVT_TRACE(JVMTI_EVENT_RESOURCE_EXHAUSTED, ("Evt resource exhausted event sent" )); |
1503 EVT_TRACE(JVMTI_EVENT_RESOURCE_EXHAUSTED, ("Evt resource exhausted event sent" )); |
1492 |
1504 |
1493 JavaThread *thread = JavaThread::current(); |
|
1494 JvmtiThreadEventMark jem(thread); |
1505 JvmtiThreadEventMark jem(thread); |
1495 JvmtiJavaThreadEventTransition jet(thread); |
1506 JvmtiJavaThreadEventTransition jet(thread); |
1496 jvmtiEventResourceExhausted callback = env->callbacks()->ResourceExhausted; |
1507 jvmtiEventResourceExhausted callback = env->callbacks()->ResourceExhausted; |
1497 if (callback != NULL) { |
1508 if (callback != NULL) { |
1498 (*callback)(env->jvmti_external(), jem.jni_env(), |
1509 (*callback)(env->jvmti_external(), jem.jni_env(), |