From f6e91700570894505ad1d82bd0829afd264f0528 Mon Sep 17 00:00:00 2001 From: dbuck Date: Fri, 11 Aug 2017 23:51:07 -0400 Subject: [PATCH] 8185164: GetOwnedMonitorInfo() returns incorrect owned monitor Summary: The GetOwnedMonitorInfo() should not return a pending monitor Reviewed-by: dcubed --- src/share/vm/runtime/objectMonitor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/vm/runtime/objectMonitor.cpp b/src/share/vm/runtime/objectMonitor.cpp index 94f4492d3..3e5733329 100644 --- a/src/share/vm/runtime/objectMonitor.cpp +++ b/src/share/vm/runtime/objectMonitor.cpp @@ -381,6 +381,8 @@ void ATTR ObjectMonitor::enter(TRAPS) { { // Change java thread status to indicate blocked on monitor enter. JavaThreadBlockedOnMonitorEnterState jtbmes(jt, this); + Self->set_current_pending_monitor(this); + DTRACE_MONITOR_PROBE(contended__enter, this, object(), jt); if (JvmtiExport::should_post_monitor_contended_enter()) { JvmtiExport::post_monitor_contended_enter(jt, this); @@ -395,8 +397,6 @@ void ATTR ObjectMonitor::enter(TRAPS) { OSThreadContendState osts(Self->osthread()); ThreadBlockInVM tbivm(jt); - Self->set_current_pending_monitor(this); - // TODO-FIXME: change the following for(;;) loop to straight-line code. for (;;) { jt->set_suspend_equivalent(); -- GitLab