hotspot/src/share/vm/prims/jvmtiEnvBase.cpp
changeset 23518 00028482ef09
parent 15853 1c4e16950e96
child 24351 61b33cc6d3cf
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp	Fri Mar 28 21:04:37 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp	Tue Mar 11 15:22:44 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -1020,19 +1020,12 @@
     }
 
     if (owning_thread != NULL) {  // monitor is owned
-      if ((address)owning_thread == owner) {
-        // the owner field is the JavaThread *
-        assert(mon != NULL,
-          "must have heavyweight monitor with JavaThread * owner");
-        ret.entry_count = mon->recursions() + 1;
-      } else {
-        // The owner field is the Lock word on the JavaThread's stack
-        // so the recursions field is not valid. We have to count the
-        // number of recursive monitor entries the hard way. We pass
-        // a handle to survive any GCs along the way.
-        ResourceMark rm;
-        ret.entry_count = count_locked_objects(owning_thread, hobj);
-      }
+      // The recursions field of a monitor does not reflect recursions
+      // as lightweight locks before inflating the monitor are not included.
+      // We have to count the number of recursive monitor entries the hard way.
+      // We pass a handle to survive any GCs along the way.
+      ResourceMark rm;
+      ret.entry_count = count_locked_objects(owning_thread, hobj);
     }
     // implied else: entry_count == 0
   }