8059559: SIGSEGV at CodeHeap::allocate(unsigned int, bool)

Create the non-profiled code heap if TieredStopAtLevel=0 is set because we compile method handle intrinsics.

Reviewed-by: kvn
This commit is contained in:
Tobias Hartmann 2014-10-06 07:58:50 +02:00
parent c39454ae56
commit 4c1c76ae4f
2 changed files with 16 additions and 8 deletions

View File

@ -254,8 +254,7 @@ bool CodeCache::heap_available(int code_blob_type) {
if (!SegmentedCodeCache) { if (!SegmentedCodeCache) {
// No segmentation: use a single code heap // No segmentation: use a single code heap
return (code_blob_type == CodeBlobType::All); return (code_blob_type == CodeBlobType::All);
} else if ((Arguments::mode() == Arguments::_int) || } else if (Arguments::mode() == Arguments::_int) {
(TieredStopAtLevel == CompLevel_none)) {
// Interpreter only: we don't need any method code heaps // Interpreter only: we don't need any method code heaps
return (code_blob_type == CodeBlobType::NonNMethod); return (code_blob_type == CodeBlobType::NonNMethod);
} else if (TieredCompilation && (TieredStopAtLevel > CompLevel_simple)) { } else if (TieredCompilation && (TieredStopAtLevel > CompLevel_simple)) {

View File

@ -38,22 +38,26 @@ public class CheckSegmentedCodeCache {
private static void verifySegmentedCodeCache(ProcessBuilder pb, boolean enabled) throws Exception { private static void verifySegmentedCodeCache(ProcessBuilder pb, boolean enabled) throws Exception {
OutputAnalyzer out = new OutputAnalyzer(pb.start()); OutputAnalyzer out = new OutputAnalyzer(pb.start());
out.shouldHaveExitValue(0);
if (enabled) { if (enabled) {
try { try {
// Non-nmethod code heap should be always available with the segmented code cache // Non-nmethod code heap should be always available with the segmented code cache
out.shouldContain(NON_METHOD); out.shouldContain(NON_METHOD);
} catch (RuntimeException e) { } catch (RuntimeException e) {
// TieredCompilation is disabled in a client VM // Check if TieredCompilation is disabled (in a client VM)
out.shouldContain("TieredCompilation is disabled in this release."); if(!out.getOutput().contains("TieredCompilation is disabled in this release.")) {
// Code cache is not segmented
throw new RuntimeException("No code cache segmentation.");
}
} }
} else { } else {
out.shouldNotContain(NON_METHOD); out.shouldNotContain(NON_METHOD);
} }
out.shouldHaveExitValue(0);
} }
private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception { private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception {
OutputAnalyzer out = new OutputAnalyzer(pb.start()); OutputAnalyzer out = new OutputAnalyzer(pb.start());
out.shouldHaveExitValue(0);
for (String name : heapNames) { for (String name : heapNames) {
out.shouldNotContain(name); out.shouldNotContain(name);
} }
@ -86,6 +90,10 @@ public class CheckSegmentedCodeCache {
"-XX:ReservedCodeCacheSize=240m", "-XX:ReservedCodeCacheSize=240m",
"-XX:+PrintCodeCache", "-version"); "-XX:+PrintCodeCache", "-version");
verifySegmentedCodeCache(pb, true); verifySegmentedCodeCache(pb, true);
pb = ProcessTools.createJavaProcessBuilder("-XX:+TieredCompilation",
"-XX:ReservedCodeCacheSize=400m",
"-XX:+PrintCodeCache", "-version");
verifySegmentedCodeCache(pb, true);
// Always enabled if SegmentedCodeCache is set // Always enabled if SegmentedCodeCache is set
pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
@ -100,12 +108,13 @@ public class CheckSegmentedCodeCache {
"-Xint", "-Xint",
"-XX:+PrintCodeCache", "-version"); "-XX:+PrintCodeCache", "-version");
verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED); 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", pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
"-XX:TieredStopAtLevel=0", "-XX:TieredStopAtLevel=0",
"-XX:+PrintCodeCache", "-version"); "-XX:+PrintCodeCache", "-version");
verifyCodeHeapNotExists(pb, PROFILED, NON_PROFILED); verifyCodeHeapNotExists(pb, PROFILED);
// If we stop compilation at CompLevel_simple
pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache", pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
"-XX:TieredStopAtLevel=1", "-XX:TieredStopAtLevel=1",
"-XX:+PrintCodeCache", "-version"); "-XX:+PrintCodeCache", "-version");