src/hotspot/share/runtime/synchronizer.cpp
changeset 57734 18f4d3d46d54
parent 57602 dbe471d2f8f8
child 57777 90ead0febf56
--- a/src/hotspot/share/runtime/synchronizer.cpp	Tue Aug 13 10:10:42 2019 -0700
+++ b/src/hotspot/share/runtime/synchronizer.cpp	Tue Aug 13 16:13:22 2019 -0400
@@ -429,9 +429,10 @@
   assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
 
   ObjectMonitor* monitor = inflate(THREAD, obj, inflate_cause_jni_exit);
-  // If this thread has locked the object, exit the monitor.  Note:  can't use
-  // monitor->check(CHECK); must exit even if an exception is pending.
-  if (monitor->check(THREAD)) {
+  // If this thread has locked the object, exit the monitor. We
+  // intentionally do not use CHECK here because we must exit the
+  // monitor even if an exception is pending.
+  if (monitor->check_owner(THREAD)) {
     monitor->exit(true, THREAD);
   }
 }