< prev index next >

src/hotspot/share/runtime/sharedRuntime.cpp

Print this page
rev 54612 : Checkpoint latest preliminary review patches for full OpenJDK review; merge with 8222295.patch.

@@ -62,12 +62,14 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/objectMonitor.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/synchronizer.hpp"
 #include "runtime/vframe.inline.hpp"
 #include "runtime/vframeArray.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"

@@ -3108,13 +3110,17 @@
   for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
        kptr2 < fr.interpreter_frame_monitor_begin();
        kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
     if (kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
       BasicLock *lock = kptr2->lock();
+      // Disallow async deflation of the inflated monitor so the
+      // displaced header stays stable until we've copied it.
+      ObjectMonitorHandle omh;
       // Inflate so the displaced header becomes position-independent
-      if (lock->displaced_header()->is_unlocked())
-        ObjectSynchronizer::inflate_helper(kptr2->obj());
+      if (lock->displaced_header()->is_unlocked()) {
+        ObjectSynchronizer::inflate_helper(&omh, kptr2->obj());
+      }
       // Now the displaced header is free to move
       buf[i++] = (intptr_t)lock->displaced_header();
       buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
     }
   }
< prev index next >