test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java

Print this page




  34  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  35  *                   -XX:+WhiteBoxAPI TestUseRTMLockingOptionWithBiasedLocking
  36  */
  37 
  38 import com.oracle.java.testlibrary.*;
  39 import com.oracle.java.testlibrary.cli.*;
  40 import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
  41 import rtm.predicate.SupportedCPU;
  42 import rtm.predicate.SupportedVM;
  43 
  44 public class TestUseRTMLockingOptionWithBiasedLocking
  45         extends CommandLineOptionTest {
  46     private TestUseRTMLockingOptionWithBiasedLocking() {
  47         super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
  48     }
  49 
  50     @Override
  51     public void runTestCases() throws Throwable {
  52         String warningMessage
  53                 = RTMGenericCommandLineOptionTest.RTM_BIASED_LOCKING_WARNING;



  54         // verify that we will not get a warning
  55         CommandLineOptionTest.verifySameJVMStartup(null,
  56                 new String[] { warningMessage }, ExitCode.OK,

  57                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  58                 "-XX:+UseRTMLocking", "-XX:-UseBiasedLocking");

  59         // verify that we will get a warning
  60         CommandLineOptionTest.verifySameJVMStartup(
  61                 new String[] { warningMessage }, null, ExitCode.OK,





  62                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  63                 "-XX:+UseRTMLocking", "-XX:+UseBiasedLocking");
  64         // verify that UseBiasedLocking is false when we use rtm locking
  65         CommandLineOptionTest.verifyOptionValueForSameVM("UseBiasedLocking",
  66                 "false", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,



  67                 "-XX:+UseRTMLocking");
  68         // verify that we can't turn on biased locking when
  69         // using rtm locking
  70         CommandLineOptionTest.verifyOptionValueForSameVM("UseBiasedLocking",
  71                 "false", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,






  72                 "-XX:+UseRTMLocking", "-XX:+UseBiasedLocking");
  73     }
  74 
  75     public static void main(String args[]) throws Throwable {
  76         new TestUseRTMLockingOptionWithBiasedLocking().test();
  77     }
  78 }


  34  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  35  *                   -XX:+WhiteBoxAPI TestUseRTMLockingOptionWithBiasedLocking
  36  */
  37 
  38 import com.oracle.java.testlibrary.*;
  39 import com.oracle.java.testlibrary.cli.*;
  40 import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
  41 import rtm.predicate.SupportedCPU;
  42 import rtm.predicate.SupportedVM;
  43 
  44 public class TestUseRTMLockingOptionWithBiasedLocking
  45         extends CommandLineOptionTest {
  46     private TestUseRTMLockingOptionWithBiasedLocking() {
  47         super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
  48     }
  49 
  50     @Override
  51     public void runTestCases() throws Throwable {
  52         String warningMessage
  53                 = RTMGenericCommandLineOptionTest.RTM_BIASED_LOCKING_WARNING;
  54         String shouldPassMessage = "JVM startup should pass with both "
  55                 + "-XX:+UseRTMLocking and "
  56                 + "-XX:-UseBiasedLocking flags set without any warnings";
  57         // verify that we will not get a warning
  58         CommandLineOptionTest.verifySameJVMStartup(null,
  59                 new String[] { warningMessage }, shouldPassMessage,
  60                 shouldPassMessage, ExitCode.OK,
  61                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  62                 "-XX:+UseRTMLocking", "-XX:-UseBiasedLocking");
  63 
  64         // verify that we will get a warning
  65         CommandLineOptionTest.verifySameJVMStartup( 
  66                 new String[] { warningMessage }, null,
  67                 "JVM startup should pass when both -XX:+UseRTMLocking and "
  68                         + "-XX:+UseBiasedLocking flags set",
  69                 "Flags -XX:+UseRTMLocking"
  70                         + " and -XX:+UseBiasedLocking conflicts. "
  71                         + "Warning should be shown.", ExitCode.OK,
  72                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  73                 "-XX:+UseRTMLocking", "-XX:+UseBiasedLocking");
  74         // verify that UseBiasedLocking is false when we use rtm locking
  75         CommandLineOptionTest.verifyOptionValueForSameVM("UseBiasedLocking",
  76                 "false",
  77                 "Value of option 'UseBiasedLocking' should be false if"
  78                         + "-XX:+UseRTMLocking flag set.",
  79                 CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  80                 "-XX:+UseRTMLocking");
  81         // verify that we can't turn on biased locking when
  82         // using rtm locking
  83         CommandLineOptionTest
  84                 .verifyOptionValueForSameVM(
  85                         "UseBiasedLocking",
  86                         "false",
  87                         "Value of option 'UseBiasedLocking' should be false if"
  88                                 + "both -XX:+UseRTMLocking and "
  89                                 + "-XX:+UseBiasedLocking flags set.",
  90                         CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
  91                         "-XX:+UseRTMLocking", "-XX:+UseBiasedLocking");
  92     }
  93 
  94     public static void main(String args[]) throws Throwable {
  95         new TestUseRTMLockingOptionWithBiasedLocking().test();
  96     }
  97 }