hotspot/test/compiler/stable/StableConfiguration.java
changeset 30859 76147e537436
parent 25641 d99065e4572b
child 36604 e9c073b0c19e
child 36508 5f9eee6b383b
equal deleted inserted replaced
30850:56166ce66037 30859:76147e537436
    39         isServerWithStable = isStableEnabled && get();
    39         isServerWithStable = isStableEnabled && get();
    40         System.out.println("@Stable:         " + (isStableEnabled ? "enabled" : "disabled"));
    40         System.out.println("@Stable:         " + (isStableEnabled ? "enabled" : "disabled"));
    41         System.out.println("Server Compiler: " + get());
    41         System.out.println("Server Compiler: " + get());
    42     }
    42     }
    43 
    43 
       
    44     // The method 'get' below returns true if the method is server compiled
       
    45     // and is used by the Stable tests to determine whether methods in
       
    46     // general are being server compiled or not as the -XX:+FoldStableValues
       
    47     // option is only applicable to -server.
       
    48     //
       
    49     // On aarch64 we DeOptimize when patching. This means that when the
       
    50     // method is compiled as a result of -Xcomp it DeOptimizes immediately.
       
    51     // The result is that getMethodCompilationLevel returns 0. This means
       
    52     // the method returns true based on java.vm.name.
       
    53     //
       
    54     // However when the tests are run with -XX:+TieredCompilation and
       
    55     // -XX:TieredStopAtLevel=1 this fails because methods will always
       
    56     // be client compiled.
       
    57     //
       
    58     // Solution is to add a simple method 'get1' which should never be
       
    59     // DeOpted and use that to determine the compilation level instead.
       
    60     static void get1() {
       
    61     }
       
    62 
       
    63 
       
    64 
    44     // ::get() is among immediately compiled methods.
    65     // ::get() is among immediately compiled methods.
    45     static boolean get() {
    66     static boolean get() {
    46         try {
    67         try {
    47             Method m = StableConfiguration.class.getDeclaredMethod("get");
    68             get1();
       
    69             Method m = StableConfiguration.class.getDeclaredMethod("get1");
    48             int level = WB.getMethodCompilationLevel(m);
    70             int level = WB.getMethodCompilationLevel(m);
    49             if (level > 0) {
    71             if (level > 0) {
    50               return (level == 4);
    72               return (level == 4);
    51             } else {
    73             } else {
    52               String javaVM = System.getProperty("java.vm.name", "");
    74               String javaVM = System.getProperty("java.vm.name", "");