--- old/test/compiler/codecache/CheckSegmentedCodeCache.java 2014-10-03 10:26:36.545698656 +0200 +++ new/test/compiler/codecache/CheckSegmentedCodeCache.java 2014-10-03 10:26:36.465698658 +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");