< prev index next >

src/hotspot/share/runtime/basicLock.cpp

Print this page
rev 56635 : v2.00 -> v2.05 (CR5/v2.05/8-for-jdk13) patches combined into one; merge with 8229212.patch; merge with jdk-14+11; merge with 8230184.patch; merge with 8230876.patch; merge with jdk-14+15; merge with jdk-14+18.

@@ -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 >