--- old/src/hotspot/share/runtime/vframe.cpp 2019-11-04 14:59:07.000000000 -0500 +++ new/src/hotspot/share/runtime/vframe.cpp 2019-11-04 14:59:07.000000000 -0500 @@ -122,8 +122,12 @@ if (mons->is_empty()) return result; bool found_first_monitor = false; - ObjectMonitor *pending_monitor = thread()->current_pending_monitor(); - ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor(); + ObjectMonitorHandle omh; + ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor(&omh); + ObjectMonitor *pending_monitor = NULL; + if (waiting_monitor == NULL) { + pending_monitor = thread()->current_pending_monitor(&omh); + } oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : (oop) NULL); oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : (oop) NULL); @@ -231,9 +235,10 @@ // an inflated monitor that is first on the monitor list in // the first frame can block us on a monitor enter. markWord mark = monitor->owner()->mark(); + ObjectMonitorHandle omh; if (mark.has_monitor() && ( // we have marked ourself as pending on this monitor - mark.monitor() == thread()->current_pending_monitor() || + mark.monitor() == thread()->current_pending_monitor(&omh) || // we are not the owner of this monitor !mark.monitor()->is_entered(thread()) )) {