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) {
// 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)) {

View File

@ -38,22 +38,26 @@ public class CheckSegmentedCodeCache {
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 @@ public class CheckSegmentedCodeCache {
"-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 @@ public class CheckSegmentedCodeCache {
"-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");