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) {
       // Check if TieredCompilation is disabled (in a client VM)
       if (!out.getOutput().contains("-XX:+TieredCompilation not supported in this VM")) {
         // Code cache is not segmented
         throw new RuntimeException("No code cache segmentation.");
       }
     }
   } else {
     out.shouldNotContain(NON_METHOD);
   }
 }