< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaVFrame.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -104,10 +104,13 @@
         StackValueCollection locs = getLocals();
         if (!locs.isEmpty()) {
           StackValue sv = locs.get(0);
           if (sv.getType() == BasicType.getTObject()) {
             OopHandle o = sv.getObject();
+            if (OopUtilities.threadOopGetThreadStatus(thread.getThreadObj()) == OopUtilities.THREAD_STATUS_BLOCKED_ON_MONITOR_ENTER) {
+                waitState = "waiting to re-lock in wait()";
+            }
             printLockedObjectClassName(tty, o, waitState);
           }
         } else {
           tty.println("\t- " + waitState + " <no object reference available>");
         }

@@ -144,17 +147,10 @@
             // monitor before, then we need to see if we have completed
             // the lock or if we are blocked trying to acquire it. Only
             // an inflated monitor that is first on the monitor list in
             // the first frame can block us on a monitor enter.
             lockState = identifyLockState(monitor, "waiting to lock");
-          } else if (frameCount != 0) {
-            // This is not the first frame so we either own this monitor
-            // or we owned the monitor before and called wait(). Because
-            // wait() could have been called on any monitor in a lower
-            // numbered frame on the stack, we have to check all the
-            // monitors on the list for this frame.
-            lockState = identifyLockState(monitor, "waiting to re-lock in wait()");
           }
           printLockedObjectClassName(tty, monitor.owner(), lockState);
           foundFirstMonitor = true;
         }
       }
< prev index next >