< prev index next >

src/hotspot/share/runtime/basicLock.cpp

Print this page
rev 58110 : 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.
rev 58111 : See CR9-to-CR10-changes; merge with jdk-15+11.

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, 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.

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