--- old/src/hotspot/share/runtime/basicLock.cpp 2019-10-17 17:28:55.000000000 -0400 +++ new/src/hotspot/share/runtime/basicLock.cpp 2019-10-17 17:28:55.000000000 -0400 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "runtime/basicLock.hpp" +#include "runtime/objectMonitor.hpp" #include "runtime/synchronizer.hpp" void BasicLock::print_on(outputStream* st) const { @@ -62,8 +63,11 @@ // 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.