hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
changeset 28394 6d382dc493e5
parent 28190 5a6b07edeb21
child 28500 8cab8bd43b39
equal deleted inserted replaced
28393:18701d7781e7 28394:6d382dc493e5
   128             return this.getClass().getName() + "::forceAbort";
   128             return this.getClass().getName() + "::forceAbort";
   129         }
   129         }
   130 
   130 
   131         @Override
   131         @Override
   132         public String[] getMethodsToCompileNames() {
   132         public String[] getMethodsToCompileNames() {
   133             return new String[] {
   133             return new String[] { getMethodWithLockName() };
   134                 getMethodWithLockName(),
       
   135                 sun.misc.Unsafe.class.getName() + "::addressSize"
       
   136             };
       
   137         }
   134         }
   138 
   135 
   139         public void forceAbort(boolean abort) {
   136         public void forceAbort(boolean abort) {
   140             synchronized(monitor) {
   137             synchronized(monitor) {
   141                 if (abort) {
   138                 if (abort) {
   149          * Test <inflate monitor>
   146          * Test <inflate monitor>
   150          */
   147          */
   151         public static void main(String args[]) throws Throwable {
   148         public static void main(String args[]) throws Throwable {
   152             Asserts.assertGTE(args.length, 1, "One argument required.");
   149             Asserts.assertGTE(args.length, 1, "One argument required.");
   153             Test t = new Test();
   150             Test t = new Test();
   154 
   151             boolean shouldBeInflated = Boolean.valueOf(args[0]);
   155             if (Boolean.valueOf(args[0])) {
   152             if (shouldBeInflated) {
   156                 AbortProvoker.inflateMonitor(t.monitor);
   153                 AbortProvoker.inflateMonitor(t.monitor);
   157             }
   154             }
   158             for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
   155             for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
       
   156                 AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
   159                 t.forceAbort(
   157                 t.forceAbort(
   160                         i == TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD);
   158                         i == TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD);
   161             }
   159             }
   162         }
   160         }
   163     }
   161     }