RFR: 8272094: compiler/codecache/TestStressCodeBuffers.java crashes with "failed to allocate space for trampoline"

Andrew Haley aph at openjdk.java.net
Mon May 16 15:41:23 UTC 2022


This problem is, I believe, caused by an assertion left in the source code after development.
The fix is simply to remove the assertion.

It's not at all easy to reproduce this bug, being a very intermittent failure, but in the end I reproduced it by making `-XX:+StressCodeBuffers` much more stressful, like so:


diff --git a/src/hotspot/share/asm/codeBuffer.cpp b/src/hotspot/share/asm/codeBuffer.cpp
index ddd946d7542..c74ba21cf63 100644
--- a/src/hotspot/share/asm/codeBuffer.cpp
+++ b/src/hotspot/share/asm/codeBuffer.cpp
@@ -837,7 +837,8 @@ void CodeBuffer::expand(CodeSection* which_cs, csize_t amount) {
   if (StressCodeBuffers && blob() != NULL) {
     static int expand_count = 0;
     if (expand_count >= 0)  expand_count += 1;
-    if (expand_count > 100 && is_power_of_2(expand_count)) {
+    if (expand_count > 100 && // is_power_of_2(expand_count)
+        expand_count % 40 == 0) {
       tty->print_cr("StressCodeBuffers: have expanded %d times", expand_count);
       // simulate an occasional allocation failure:
       free_blob();

-------------

Commit messages:
 - 8272094: compiler/codecache/TestStressCodeBuffers.java crashes with "failed to allocate space for trampoline"

Changes: https://git.openjdk.java.net/jdk/pull/8730/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8730&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8272094
  Stats: 2 lines in 2 files changed: 0 ins; 2 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8730.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8730/head:pull/8730

PR: https://git.openjdk.java.net/jdk/pull/8730


More information about the hotspot-dev mailing list