113 statisticsBeforeDeopt = s;
114 }
115 }
116
117 Asserts.assertNotNull(statisticsBeforeDeopt,
118 "After LockThreshold was reached, method should be recompiled "
119 + "with rtm lock eliding.");
120 }
121
122 public static class Test implements CompilableTest {
123 private static final Unsafe UNSAFE = Utils.getUnsafe();
124 private final Object monitor = new Object();
125
126 @Override
127 public String getMethodWithLockName() {
128 return this.getClass().getName() + "::forceAbort";
129 }
130
131 @Override
132 public String[] getMethodsToCompileNames() {
133 return new String[] {
134 getMethodWithLockName(),
135 sun.misc.Unsafe.class.getName() + "::addressSize"
136 };
137 }
138
139 public void forceAbort(boolean abort) {
140 synchronized(monitor) {
141 if (abort) {
142 Test.UNSAFE.addressSize();
143 }
144 }
145 }
146
147 /**
148 * Usage:
149 * Test <inflate monitor>
150 */
151 public static void main(String args[]) throws Throwable {
152 Asserts.assertGTE(args.length, 1, "One argument required.");
153 Test t = new Test();
154
155 if (Boolean.valueOf(args[0])) {
156 AbortProvoker.inflateMonitor(t.monitor);
157 }
158 for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
159 t.forceAbort(
160 i == TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD);
161 }
162 }
163 }
164
165 public static void main(String args[]) throws Throwable {
166 new TestRTMDeoptOnLowAbortRatio().test();
167 }
168 }
|
113 statisticsBeforeDeopt = s;
114 }
115 }
116
117 Asserts.assertNotNull(statisticsBeforeDeopt,
118 "After LockThreshold was reached, method should be recompiled "
119 + "with rtm lock eliding.");
120 }
121
122 public static class Test implements CompilableTest {
123 private static final Unsafe UNSAFE = Utils.getUnsafe();
124 private final Object monitor = new Object();
125
126 @Override
127 public String getMethodWithLockName() {
128 return this.getClass().getName() + "::forceAbort";
129 }
130
131 @Override
132 public String[] getMethodsToCompileNames() {
133 return new String[] { getMethodWithLockName() };
134 }
135
136 public void forceAbort(boolean abort) {
137 synchronized(monitor) {
138 if (abort) {
139 Test.UNSAFE.addressSize();
140 }
141 }
142 }
143
144 /**
145 * Usage:
146 * Test <inflate monitor>
147 */
148 public static void main(String args[]) throws Throwable {
149 Asserts.assertGTE(args.length, 1, "One argument required.");
150 Test t = new Test();
151 boolean shouldBeInflated = Boolean.valueOf(args[0]);
152 if (shouldBeInflated) {
153 AbortProvoker.inflateMonitor(t.monitor);
154 }
155 for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
156 AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
157 t.forceAbort(
158 i == TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD);
159 }
160 }
161 }
162
163 public static void main(String args[]) throws Throwable {
164 new TestRTMDeoptOnLowAbortRatio().test();
165 }
166 }
|