8232534: Shenandoah: guard against reentrant ShenandoahHeapLock locking
authorshade
Thu, 17 Oct 2019 20:56:04 +0200
changeset 58675 0cc52a55fce4
parent 58674 42a3a8941418
child 58676 92e7d617897e
8232534: Shenandoah: guard against reentrant ShenandoahHeapLock locking Reviewed-by: rkennke
src/hotspot/share/gc/shenandoah/shenandoahLock.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahLock.hpp	Thu Oct 17 13:14:48 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahLock.hpp	Thu Oct 17 20:56:04 2019 +0200
@@ -41,6 +41,9 @@
   ShenandoahLock() : _state(unlocked), _owner(NULL) {};
 
   void lock() {
+#ifdef ASSERT
+    assert(_owner != Thread::current(), "reentrant locking attempt, would deadlock");
+#endif
     Thread::SpinAcquire(&_state, "Shenandoah Heap Lock");
 #ifdef ASSERT
     assert(_state == locked, "must be locked");