< prev index next >

src/hotspot/share/runtime/basicLock.cpp

Print this page
rev 57595 : v2.09a with 8235795, 8235931 and 8236035 extracted; rebased to jdk-14+28; merge with 8236035.patch.cr1; merge with 8235795.patch.cr1; merge with 8236035.patch.cr2; merge with 8235795.patch.cr2; merge with 8235795.patch.cr3.

@@ -22,10 +22,11 @@
  *
  */
 
 #include "precompiled.hpp"
 #include "runtime/basicLock.hpp"
+#include "runtime/objectMonitor.hpp"
 #include "runtime/synchronizer.hpp"
 
 void BasicLock::print_on(outputStream* st) const {
   st->print("monitor");
   markWord mark_word = displaced_header();

@@ -60,12 +61,15 @@
   // we need to ensure that both locations refer to the current thread's stack.
   // There are some subtle concurrency issues, however, and since the benefit is
   // is small (given the support for inflated fast-path locking in the fast_lock, etc)
   // we'll leave that optimization for another time.
 
+  // Disallow async deflation of the inflated monitor so the
+  // displaced header stays stable until we've copied it.
+  ObjectMonitorHandle omh;
   if (displaced_header().is_neutral()) {
-    ObjectSynchronizer::inflate_helper(obj);
+    ObjectSynchronizer::inflate_helper(&omh, obj);
     // WARNING: We can not put check here, because the inflation
     // will not update the displaced header. Once BasicLock is inflated,
     // no one should ever look at its content.
   } else {
     // Typically the displaced header will be 0 (recursive stack lock) or
< prev index next >