changeset 58730:c727d5d4c22e

8233520: Shenandoah: do not sleep when thread is attaching Reviewed-by: rkennke
author shade
date Mon, 04 Nov 2019 19:40:58 +0100
parents 33f9271b3167
children 1d1f9c43138f
files src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp	Mon Nov 04 13:13:34 2019 -0500
+++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp	Mon Nov 04 19:40:58 2019 +0100
@@ -238,6 +238,15 @@
     return;
   }
 
+  // Threads that are attaching should not block at all: they are not
+  // fully initialized yet. Calling sleep() on them would be awkward.
+  // This is probably the path that allocates the thread oop itself.
+  // Forcefully claim without waiting.
+  if (JavaThread::current()->is_attaching_via_jni()) {
+    claim_for_alloc(words, true);
+    return;
+  }
+
   size_t max = ShenandoahPacingMaxDelay;
   double start = os::elapsedTime();