8059559: SIGSEGV at CodeHeap::allocate(unsigned int, bool)
authorthartmann
Mon, 06 Oct 2014 07:58:50 +0200
changeset 27015 7a7b66fbc782
parent 27014 8c348142e099
child 27016 58e6c6d54017
8059559: SIGSEGV at CodeHeap::allocate(unsigned int, bool) Summary: Create the non-profiled code heap if TieredStopAtLevel=0 is set because we compile method handle intrinsics. Reviewed-by: kvn
hotspot/src/share/vm/code/codeCache.cpp
hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java
--- a/hotspot/src/share/vm/code/codeCache.cpp	Fri Oct 03 13:34:46 2014 -0700
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Mon Oct 06 07:58:50 2014 +0200
@@ -254,8 +254,7 @@
   if (!SegmentedCodeCache) {
     // No segmentation: use a single code heap
     return (code_blob_type == CodeBlobType::All);
-  } else if ((Arguments::mode() == Arguments::_int) ||
-             (TieredStopAtLevel == CompLevel_none)) {
+  } else if (Arguments::mode() == Arguments::_int) {
     // Interpreter only: we don't need any method code heaps
     return (code_blob_type == CodeBlobType::NonNMethod);
   } else if (TieredCompilation && (TieredStopAtLevel > CompLevel_simple)) {
--- a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java	Fri Oct 03 13:34:46 2014 -0700
+++ b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java	Mon Oct 06 07:58:50 2014 +0200
@@ -38,22 +38,26 @@
 
   private static void verifySegmentedCodeCache(ProcessBuilder pb, boolean enabled) throws Exception {
     OutputAnalyzer out = new OutputAnalyzer(pb.start());
+    out.shouldHaveExitValue(0);
     if (enabled) {
       try {
         // Non-nmethod code heap should be always available with the segmented code cache
         out.shouldContain(NON_METHOD);
       } catch (RuntimeException e) {
-        // TieredCompilation is disabled in a client VM
-        out.shouldContain("TieredCompilation is disabled in this release.");
+        // Check if TieredCompilation is disabled (in a client VM)
+        if(!out.getOutput().contains("TieredCompilation is disabled in this release.")) {
+          // Code cache is not segmented
+          throw new RuntimeException("No code cache segmentation.");
+        }
       }
     } else {
       out.shouldNotContain(NON_METHOD);
     }
-    out.shouldHaveExitValue(0);
   }
 
   private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception {
     OutputAnalyzer out = new OutputAnalyzer(pb.start());
+    out.shouldHaveExitValue(0);
     for (String name : heapNames) {
       out.shouldNotContain(name);
     }
@@ -86,6 +90,10 @@
                                                "-XX:ReservedCodeCacheSize=240m",
                                                "-XX:+PrintCodeCache", "-version");
     verifySegmentedCodeCache(pb, true);
+    pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation",
+                                               "-XX:ReservedCodeCacheSize=400m",
+                                               "-XX:+PrintCodeCache", "-version");
+    verifySegmentedCodeCache(pb, true);
 
     // Always enabled if SegmentedCodeCache is set
     pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
@@ -100,12 +108,13 @@
                                                "-Xint",
                                                "-XX:+PrintCodeCache", "-version");
     verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED);
+
+    // If we stop compilation at CompLevel_none or CompLevel_simple we
+    // don't need a profiled code heap.
     pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
                                                "-XX:TieredStopAtLevel=0",
                                                "-XX:+PrintCodeCache", "-version");
-    verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED);
-
-    // If we stop compilation at CompLevel_simple
+    verifyCodeHeapNotExists(pb, PROFILED);
     pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
                                                "-XX:TieredStopAtLevel=1",
                                                "-XX:+PrintCodeCache", "-version");