test/hotspot/jtreg/runtime/Safepoint/NoSafepointVerifier.java
changeset 59143 1037c4d14378
parent 58409 a595e67d6683
equal deleted inserted replaced
59142:c4be5e03aff7 59143:1037c4d14378
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8184732
    26  * @bug 8184732
    27  * @summary Ensure that special locks never safepoint check and are vm_block.
    27  * @summary Ensure that special locks never safepoint check.
    28  * @library /test/lib
    28  * @library /test/lib
    29  * @modules java.base/jdk.internal.misc
    29  * @modules java.base/jdk.internal.misc
    30  *          java.management
    30  *          java.management
    31  * @build sun.hotspot.WhiteBox
    31  * @build sun.hotspot.WhiteBox
    32  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
    32  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
    55             output.shouldContain(test);
    55             output.shouldContain(test);
    56         }
    56         }
    57     }
    57     }
    58 
    58 
    59     static String test1 = "Special locks or below should never safepoint";
    59     static String test1 = "Special locks or below should never safepoint";
    60     static String test2 = "Special locks or below should allow the vm to block";
    60     static String test2 = "Possible safepoint reached by thread that does not allow it";
    61     static String test3 = "Possible safepoint reached by thread that does not allow it";
       
    62 
    61 
    63     public static void main(String args[]) throws Exception {
    62     public static void main(String args[]) throws Exception {
    64         if (args.length > 0) {
    63         if (args.length > 0) {
    65             if (args[0].equals(test1)) {
    64             if (args[0].equals(test1)) {
    66                 WhiteBox.getWhiteBox().assertSpecialLock(/*vm_block*/true, /*safepoint_check_always*/true);
    65                 WhiteBox.getWhiteBox().assertSpecialLock(/*vm_block*/true, /*safepoint_check_always*/true);
    67             } else if (args[0].equals(test2)) {
    66             } else if (args[0].equals(test2)) {
    68                 WhiteBox.getWhiteBox().assertSpecialLock(/*vm_block*/false, /*safepoint_check_always*/false);
       
    69             } else if (args[0].equals(test3)) {
       
    70                 WhiteBox.getWhiteBox().assertSpecialLock(/*vm_block*/true, /*safepoint_check_always*/false);
    67                 WhiteBox.getWhiteBox().assertSpecialLock(/*vm_block*/true, /*safepoint_check_always*/false);
    71             }
    68             }
    72         } else {
    69         } else {
    73             runTest(test1);
    70             runTest(test1);
    74             runTest(test2);
    71             runTest(test2);
    75             runTest(test3);
       
    76         }
    72         }
    77     }
    73     }
    78 }
    74 }