< prev index next >

src/hotspot/share/prims/jvmtiEnvBase.cpp

Print this page
rev 57595 : v2.09a with 8235795, 8235931 and 8236035 extracted; rebased to jdk-14+28; merge with 8236035.patch.cr1; merge with 8235795.patch.cr1; merge with 8236035.patch.cr2; merge with 8235795.patch.cr2; merge with 8235795.patch.cr3.

*** 649,666 **** jvmtiError JvmtiEnvBase::get_current_contended_monitor(JavaThread *calling_thread, JavaThread *java_thread, jobject *monitor_ptr) { #ifdef ASSERT uint32_t debug_bits = 0; #endif assert((SafepointSynchronize::is_at_safepoint() || java_thread->is_thread_fully_suspended(false, &debug_bits)), "at safepoint or target thread is suspended"); oop obj = NULL; ! ObjectMonitor *mon = java_thread->current_waiting_monitor(); if (mon == NULL) { // thread is not doing an Object.wait() call ! mon = java_thread->current_pending_monitor(); if (mon != NULL) { // The thread is trying to enter() an ObjectMonitor. obj = (oop)mon->object(); assert(obj != NULL, "ObjectMonitor should have a valid object!"); } --- 649,674 ---- jvmtiError JvmtiEnvBase::get_current_contended_monitor(JavaThread *calling_thread, JavaThread *java_thread, jobject *monitor_ptr) { #ifdef ASSERT uint32_t debug_bits = 0; #endif + // Note: The is_thread_fully_suspended() part of the assert() is + // from an older implementation that recognized suspension as + // being safe. However, that was racy in the face of rogue resumes. + // Should be replaced with "calling_thread == java_thread". assert((SafepointSynchronize::is_at_safepoint() || java_thread->is_thread_fully_suspended(false, &debug_bits)), "at safepoint or target thread is suspended"); oop obj = NULL; ! // For all of the get_current_contended_monitor() call sites, we ! // are either at a safepoint or the calling thread is operating ! // on itself so this ObjectMonitorHandle is not strictly necessary. ! ObjectMonitorHandle omh; ! ObjectMonitor *mon = java_thread->current_waiting_monitor(&omh); if (mon == NULL) { // thread is not doing an Object.wait() call ! mon = java_thread->current_pending_monitor(&omh); if (mon != NULL) { // The thread is trying to enter() an ObjectMonitor. obj = (oop)mon->object(); assert(obj != NULL, "ObjectMonitor should have a valid object!"); }
*** 732,751 **** } HandleMark hm; oop wait_obj = NULL; { // save object of current wait() call (if any) for later comparison ! ObjectMonitor *mon = java_thread->current_waiting_monitor(); if (mon != NULL) { wait_obj = (oop)mon->object(); } } oop pending_obj = NULL; { // save object of current enter() call (if any) for later comparison ! ObjectMonitor *mon = java_thread->current_pending_monitor(); if (mon != NULL) { pending_obj = (oop)mon->object(); } } --- 740,767 ---- } HandleMark hm; oop wait_obj = NULL; { + // For all of the get_locked_objects_in_frame() call sites, we + // are either at a safepoint or the calling thread is operating + // on itself so this ObjectMonitorHandle is not strictly necessary. + ObjectMonitorHandle omh; // save object of current wait() call (if any) for later comparison ! ObjectMonitor *mon = java_thread->current_waiting_monitor(&omh); if (mon != NULL) { wait_obj = (oop)mon->object(); } } oop pending_obj = NULL; { + // For all of the get_locked_objects_in_frame() call sites, we + // are either at a safepoint or the calling thread is operating + // on itself so this ObjectMonitorHandle is not strictly necessary. + ObjectMonitorHandle omh; // save object of current enter() call (if any) for later comparison ! ObjectMonitor *mon = java_thread->current_pending_monitor(&omh); if (mon != NULL) { pending_obj = (oop)mon->object(); } }
< prev index next >