< prev index next >
src/hotspot/share/prims/jvmtiEnv.cpp
Print this page
*** 1199,1223 ****
// owned_monitor_count_ptr - pre-checked for NULL
// owned_monitors_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::GetOwnedMonitorInfo(JavaThread* java_thread, jint* owned_monitor_count_ptr, jobject** owned_monitors_ptr) {
jvmtiError err = JVMTI_ERROR_NONE;
- JavaThread* calling_thread = JavaThread::current();
// growable array of jvmti monitors info on the C-heap
GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list =
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, true);
// It is only safe to perform the direct operation on the current
! // thread. All other usage needs to use a vm-safepoint-op for safety.
! if (java_thread == calling_thread) {
! err = get_owned_monitors(calling_thread, java_thread, owned_monitors_list);
} else {
! // JVMTI get monitors info at safepoint. Do not require target thread to
! // be suspended.
! VM_GetOwnedMonitorInfo op(this, calling_thread, java_thread, owned_monitors_list);
! VMThread::execute(&op);
err = op.result();
}
jint owned_monitor_count = owned_monitors_list->length();
if (err == JVMTI_ERROR_NONE) {
if ((err = allocate(owned_monitor_count * sizeof(jobject *),
--- 1199,1221 ----
// owned_monitor_count_ptr - pre-checked for NULL
// owned_monitors_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::GetOwnedMonitorInfo(JavaThread* java_thread, jint* owned_monitor_count_ptr, jobject** owned_monitors_ptr) {
jvmtiError err = JVMTI_ERROR_NONE;
// growable array of jvmti monitors info on the C-heap
GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list =
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, true);
// It is only safe to perform the direct operation on the current
! // thread. All other usage needs to use a direct handshake for safety.
! if (java_thread == JavaThread::current()) {
! err = get_owned_monitors(java_thread, owned_monitors_list);
} else {
! // get owned monitors info with handshake
! GetOwnedMonitorInfoClosure op(this, owned_monitors_list);
! Handshake::execute_direct(&op, java_thread);
err = op.result();
}
jint owned_monitor_count = owned_monitors_list->length();
if (err == JVMTI_ERROR_NONE) {
if ((err = allocate(owned_monitor_count * sizeof(jobject *),
*** 1245,1269 ****
// monitor_info_count_ptr - pre-checked for NULL
// monitor_info_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::GetOwnedMonitorStackDepthInfo(JavaThread* java_thread, jint* monitor_info_count_ptr, jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
jvmtiError err = JVMTI_ERROR_NONE;
- JavaThread* calling_thread = JavaThread::current();
// growable array of jvmti monitors info on the C-heap
GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list =
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, true);
// It is only safe to perform the direct operation on the current
! // thread. All other usage needs to use a vm-safepoint-op for safety.
! if (java_thread == calling_thread) {
! err = get_owned_monitors(calling_thread, java_thread, owned_monitors_list);
} else {
! // JVMTI get owned monitors info at safepoint. Do not require target thread to
! // be suspended.
! VM_GetOwnedMonitorInfo op(this, calling_thread, java_thread, owned_monitors_list);
! VMThread::execute(&op);
err = op.result();
}
jint owned_monitor_count = owned_monitors_list->length();
if (err == JVMTI_ERROR_NONE) {
--- 1243,1265 ----
// monitor_info_count_ptr - pre-checked for NULL
// monitor_info_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::GetOwnedMonitorStackDepthInfo(JavaThread* java_thread, jint* monitor_info_count_ptr, jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
jvmtiError err = JVMTI_ERROR_NONE;
// growable array of jvmti monitors info on the C-heap
GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list =
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<jvmtiMonitorStackDepthInfo*>(1, true);
// It is only safe to perform the direct operation on the current
! // thread. All other usage needs to use a direct handshake for safety.
! if (java_thread == JavaThread::current()) {
! err = get_owned_monitors(java_thread, owned_monitors_list);
} else {
! // get owned monitors info with handshake
! GetOwnedMonitorInfoClosure op(this, owned_monitors_list);
! Handshake::execute_direct(&op, java_thread);
err = op.result();
}
jint owned_monitor_count = owned_monitors_list->length();
if (err == JVMTI_ERROR_NONE) {
*** 1294,1313 ****
// java_thread - pre-checked
// monitor_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::GetCurrentContendedMonitor(JavaThread* java_thread, jobject* monitor_ptr) {
jvmtiError err = JVMTI_ERROR_NONE;
- JavaThread* calling_thread = JavaThread::current();
// It is only safe to perform the direct operation on the current
! // thread. All other usage needs to use a vm-safepoint-op for safety.
! if (java_thread == calling_thread) {
! err = get_current_contended_monitor(calling_thread, java_thread, monitor_ptr);
} else {
! // get contended monitor information at safepoint.
! VM_GetCurrentContendedMonitor op(this, calling_thread, java_thread, monitor_ptr);
! VMThread::execute(&op);
err = op.result();
}
return err;
} /* end GetCurrentContendedMonitor */
--- 1290,1308 ----
// java_thread - pre-checked
// monitor_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::GetCurrentContendedMonitor(JavaThread* java_thread, jobject* monitor_ptr) {
jvmtiError err = JVMTI_ERROR_NONE;
// It is only safe to perform the direct operation on the current
! // thread. All other usage needs to use a direct handshake for safety.
! if (java_thread == JavaThread::current()) {
! err = get_current_contended_monitor(java_thread, monitor_ptr);
} else {
! // get contended monitor information with handshake
! GetCurrentContendedMonitorClosure op(this, monitor_ptr);
! Handshake::execute_direct(&op, java_thread);
err = op.result();
}
return err;
} /* end GetCurrentContendedMonitor */
< prev index next >