< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/aotCode/AOTCodeFlags.java

Print this page
@@ -48,12 +48,12 @@
  import jdk.test.lib.process.OutputAnalyzer;
  
  public class AOTCodeFlags {
      public static void main(String... args) throws Exception {
          Tester t = new Tester();
-         // Run only 2 modes (0 - no AOT code, 1 - AOT adapters) until JDK-8357398 is fixed
-         for (int mode = 0; mode < 2; mode++) {
+         for (int mode = 0; mode < 4; mode++) {
+             if (mode == 2) continue; // Skip stubs until JDK-8357398 is fixed
              t.setTestMode(mode);
              t.run(new String[] {"AOT", "--two-step-training"});
          }
      }
      static class Tester extends CDSAppTester {

@@ -63,15 +63,19 @@
              super("AOTCodeFlags");
              testMode = 0;
          }
  
          boolean isAdapterCachingOn() {
-             return (testMode & 0x1) != 0;
+             return (testMode == 1);
          }
  
          boolean isStubCachingOn() {
-             return (testMode & 0x2) != 0;
+             return (testMode == 2);
+         }
+ 
+         boolean isCodeCachingOn() {
+             return (testMode == 3);
          }
  
          public void setTestMode(int mode) {
              testMode = mode;
          }

@@ -79,10 +83,11 @@
          public List<String> getVMArgsForTestMode() {
              List<String> list = new ArrayList<String>();
              list.add("-XX:+UnlockDiagnosticVMOptions");
              list.add(isAdapterCachingOn() ? "-XX:+AOTAdapterCaching" : "-XX:-AOTAdapterCaching");
              list.add(isStubCachingOn() ? "-XX:+AOTStubCaching" : "-XX:-AOTStubCaching");
+             list.add(isCodeCachingOn() ? "-XX:+AOTCodeCaching" : "-XX:-AOTCodeCaching");
              return list;
          }
  
          @Override
          public String classpath(RunMode runMode) {

@@ -110,18 +115,20 @@
              };
          }
  
          @Override
          public void checkExecution(OutputAnalyzer out, RunMode runMode) throws Exception {
-             if (!isAdapterCachingOn() && !isStubCachingOn()) { // this is equivalent to completely disable AOT code cache
+             if (!isAdapterCachingOn() && !isStubCachingOn()  && !isCodeCachingOn()) { // this is equivalent to completely disable AOT code cache
                  switch (runMode) {
                  case RunMode.ASSEMBLY:
                  case RunMode.PRODUCTION:
                      out.shouldNotMatch("Adapters:\\s+total");
                      out.shouldNotMatch("Shared Blobs:\\s+total");
                      out.shouldNotMatch("C1 Blobs:\\s+total");
                      out.shouldNotMatch("C2 Blobs:\\s+total");
+                     out.shouldNotMatch("Stubs:\\s+total");
+                     out.shouldNotMatch("Nmethods:\\s+total");
                      break;
                  }
              } else {
                  if (isAdapterCachingOn()) {
                      switch (runMode) {

@@ -146,20 +153,39 @@
                      case RunMode.PRODUCTION:
                          // AOTStubCaching is on, non-zero stubs should be stored/loaded
                          out.shouldMatch("Shared Blobs:\\s+total=[1-9][0-9]+");
                          out.shouldMatch("C1 Blobs:\\s+total=[1-9][0-9]+");
                          out.shouldMatch("C2 Blobs:\\s+total=[1-9][0-9]+");
+                         out.shouldMatch("Stubs:\\s+total=[1-9]+");
                          break;
                      }
                  } else {
                      switch (runMode) {
                      case RunMode.ASSEMBLY:
                      case RunMode.PRODUCTION:
                          // AOTStubCaching is off, no stubs should be stored/loaded
                          out.shouldMatch("Shared Blobs:\\s+total=0");
                          out.shouldMatch("C1 Blobs:\\s+total=0");
                          out.shouldMatch("C2 Blobs:\\s+total=0");
+                         out.shouldMatch("Stubs:\\s+total=0");
+                         break;
+                     }
+                 }
+                 if (isCodeCachingOn()) {
+                     switch (runMode) {
+                     case RunMode.ASSEMBLY:
+                     case RunMode.PRODUCTION:
+                         // AOTAdapterCaching is on, non-zero adapters should be stored/loaded
+                         out.shouldMatch("Nmethods:\\s+total=[1-9]+");
+                         break;
+                     }
+                 } else {
+                     switch (runMode) {
+                     case RunMode.ASSEMBLY:
+                     case RunMode.PRODUCTION:
+                         // AOTAdapterCaching is off, no adapters should be stored/loaded
+                         out.shouldMatch("Nmethods:\\s+total=0");
                          break;
                      }
                  }
              }
          }
< prev index next >