25 /**
26 * @test
27 * @bug 8227745
28 * @summary Collection of test cases that check if optimizations based on escape analysis are reverted just before non-escaping objects escape through JVMTI.
29 * @author Richard Reingruber richard DOT reingruber AT sap DOT com
30 *
31 * @requires ((vm.compMode == "Xmixed") & vm.compiler2.enabled)
32 * @library /test/lib /test/hotspot/jtreg
33 *
34 * @run build TestScaffold VMConnection TargetListener TargetAdapter jdk.test.whitebox.WhiteBox
35 * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
36 * @run compile -g EATests.java
37 * @run driver EATests
38 * -XX:+UnlockDiagnosticVMOptions
39 * -Xms256m -Xmx256m
40 * -Xbootclasspath/a:.
41 * -XX:CompileCommand=dontinline,*::dontinline_*
42 * -XX:+WhiteBoxAPI
43 * -Xbatch
44 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking
45 * @run driver EATests
46 * -XX:+UnlockDiagnosticVMOptions
47 * -Xms256m -Xmx256m
48 * -Xbootclasspath/a:.
49 * -XX:CompileCommand=dontinline,*::dontinline_*
50 * -XX:+WhiteBoxAPI
51 * -Xbatch
52 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:-EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking -XX:-UseOptoBiasInlining
53 * @run driver EATests
54 * -XX:+UnlockDiagnosticVMOptions
55 * -Xms256m -Xmx256m
56 * -Xbootclasspath/a:.
57 * -XX:CompileCommand=dontinline,*::dontinline_*
58 * -XX:+WhiteBoxAPI
59 * -Xbatch
60 * -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking
61 * @run driver EATests
62 * -XX:+UnlockDiagnosticVMOptions
63 * -Xms256m -Xmx256m
64 * -Xbootclasspath/a:.
65 * -XX:CompileCommand=dontinline,*::dontinline_*
66 * -XX:+WhiteBoxAPI
67 * -Xbatch
68 * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking
69 * @run driver EATests
70 * -XX:+UnlockDiagnosticVMOptions
71 * -Xms256m -Xmx256m
72 * -Xbootclasspath/a:.
73 * -XX:CompileCommand=dontinline,*::dontinline_*
74 * -XX:+WhiteBoxAPI
75 * -Xbatch
76 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking
77 * @run driver EATests
78 * -XX:+UnlockDiagnosticVMOptions
79 * -Xms256m -Xmx256m
80 * -Xbootclasspath/a:.
81 * -XX:CompileCommand=dontinline,*::dontinline_*
82 * -XX:+WhiteBoxAPI
83 * -Xbatch
84 * -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking
85 * @run driver EATests
86 * -XX:+UnlockDiagnosticVMOptions
87 * -Xms256m -Xmx256m
88 * -Xbootclasspath/a:.
89 * -XX:CompileCommand=dontinline,*::dontinline_*
90 * -XX:+WhiteBoxAPI
91 * -Xbatch
92 * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking
93 *
94 * @comment Excercise -XX:+DeoptimizeObjectsALot. Mostly to prevent bit-rot because the option is meant to stress object deoptimization
95 * with non-synthetic workloads.
96 * @run driver EATests
97 * -XX:+UnlockDiagnosticVMOptions
98 * -Xms256m -Xmx256m
99 * -Xbootclasspath/a:.
100 * -XX:CompileCommand=dontinline,*::dontinline_*
101 * -XX:+WhiteBoxAPI
102 * -Xbatch
103 * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking
104 * -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeObjectsALot
105 *
106 */
107 /**
108 * @test
109 * @bug 8227745
110 *
111 * @summary This is another configuration of EATests.java to test Graal. Some testcases are expected
112 * to fail because Graal does not provide all information about non-escaping objects in
113 * scope. These are skipped.
114 *
115 * @author Richard Reingruber richard DOT reingruber AT sap DOT com
116 *
117 * @requires ((vm.compMode == "Xmixed") & vm.graal.enabled)
118 *
119 * @library /test/lib /test/hotspot/jtreg
120 *
121 * @run build TestScaffold VMConnection TargetListener TargetAdapter jdk.test.whitebox.WhiteBox
122 * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
123 * @run compile -g EATests.java
124 *
125 * @comment Test with Graal. Some testcases are expected to fail because Graal does not provide all information about non-escaping
126 * objects in scope. These are skipped.
216 new EAMaterializeLocalVariableUponGetTarget() .run();
217 new EAGetWithoutMaterializeTarget() .run();
218 new EAMaterializeLocalAtObjectReturnTarget() .run();
219 new EAMaterializeLocalAtObjectPollReturnReturnTarget() .run();
220 new EAMaterializeIntArrayTarget() .run();
221 new EAMaterializeLongArrayTarget() .run();
222 new EAMaterializeFloatArrayTarget() .run();
223 new EAMaterializeDoubleArrayTarget() .run();
224 new EAMaterializeObjectArrayTarget() .run();
225 new EAMaterializeObjectWithConstantAndNotConstantValuesTarget() .run();
226 new EAMaterializeObjReferencedBy2LocalsTarget() .run();
227 new EAMaterializeObjReferencedBy2LocalsAndModifyTarget() .run();
228 new EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesTarget() .run();
229 new EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesAndModifyTarget() .run();
230 new EAMaterializeObjReferencedFromOperandStackTarget() .run();
231 new EAMaterializeLocalVariableUponGetAfterSetIntegerTarget() .run();
232
233 // Relocking test cases
234 new EARelockingSimpleTarget() .run();
235 new EARelockingSimple_2Target() .run();
236 new EARelockingRecursiveTarget() .run();
237 new EARelockingNestedInflatedTarget() .run();
238 new EARelockingNestedInflated_02Target() .run();
239 new EARelockingArgEscapeLWLockedInCalleeFrameTarget() .run();
240 new EARelockingArgEscapeLWLockedInCalleeFrame_2Target() .run();
241 new EARelockingArgEscapeLWLockedInCalleeFrame_3Target() .run();
242 new EARelockingArgEscapeLWLockedInCalleeFrame_4Target() .run();
243 new EAGetOwnedMonitorsTarget() .run();
244 new EAEntryCountTarget() .run();
245 new EARelockingObjectCurrentlyWaitingOnTarget() .run();
246
247 // Test cases that require deoptimization even though neither
248 // locks nor allocations are eliminated at the point where
249 // escape state is changed.
250 new EADeoptFrameAfterReadLocalObject_01Target() .run();
251 new EADeoptFrameAfterReadLocalObject_01BTarget() .run();
252 new EADeoptFrameAfterReadLocalObject_02Target() .run();
253 new EADeoptFrameAfterReadLocalObject_02BTarget() .run();
254 new EADeoptFrameAfterReadLocalObject_02CTarget() .run();
255 new EADeoptFrameAfterReadLocalObject_03Target() .run();
256
257 // PopFrame test cases
258 new EAPopFrameNotInlinedTarget() .run();
259 new EAPopFrameNotInlinedReallocFailureTarget() .run();
260 new EAPopInlinedMethodWithScalarReplacedObjectsReallocFailureTarget() .run();
261
262 // ForceEarlyReturn test cases
263 new EAForceEarlyReturnNotInlinedTarget() .run();
264 new EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjectsTarget() .run();
265 new EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjectsReallocFailureTarget().run();
336 new EAMaterializeLocalVariableUponGet() .run(this);
337 new EAGetWithoutMaterialize() .run(this);
338 new EAMaterializeLocalAtObjectReturn() .run(this);
339 new EAMaterializeLocalAtObjectPollReturnReturn() .run(this);
340 new EAMaterializeIntArray() .run(this);
341 new EAMaterializeLongArray() .run(this);
342 new EAMaterializeFloatArray() .run(this);
343 new EAMaterializeDoubleArray() .run(this);
344 new EAMaterializeObjectArray() .run(this);
345 new EAMaterializeObjectWithConstantAndNotConstantValues() .run(this);
346 new EAMaterializeObjReferencedBy2Locals() .run(this);
347 new EAMaterializeObjReferencedBy2LocalsAndModify() .run(this);
348 new EAMaterializeObjReferencedBy2LocalsInDifferentVirtFrames() .run(this);
349 new EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesAndModify() .run(this);
350 new EAMaterializeObjReferencedFromOperandStack() .run(this);
351 new EAMaterializeLocalVariableUponGetAfterSetInteger() .run(this);
352
353 // Relocking test cases
354 new EARelockingSimple() .run(this);
355 new EARelockingSimple_2() .run(this);
356 new EARelockingRecursive() .run(this);
357 new EARelockingNestedInflated() .run(this);
358 new EARelockingNestedInflated_02() .run(this);
359 new EARelockingArgEscapeLWLockedInCalleeFrame() .run(this);
360 new EARelockingArgEscapeLWLockedInCalleeFrame_2() .run(this);
361 new EARelockingArgEscapeLWLockedInCalleeFrame_3() .run(this);
362 new EARelockingArgEscapeLWLockedInCalleeFrame_4() .run(this);
363 new EAGetOwnedMonitors() .run(this);
364 new EAEntryCount() .run(this);
365 new EARelockingObjectCurrentlyWaitingOn() .run(this);
366
367 // Test cases that require deoptimization even though neither
368 // locks nor allocations are eliminated at the point where
369 // escape state is changed.
370 new EADeoptFrameAfterReadLocalObject_01() .run(this);
371 new EADeoptFrameAfterReadLocalObject_01B() .run(this);
372 new EADeoptFrameAfterReadLocalObject_02() .run(this);
373 new EADeoptFrameAfterReadLocalObject_02B() .run(this);
374 new EADeoptFrameAfterReadLocalObject_02C() .run(this);
375 new EADeoptFrameAfterReadLocalObject_03() .run(this);
376
377 // PopFrame test cases
378 new EAPopFrameNotInlined() .run(this);
379 new EAPopFrameNotInlinedReallocFailure() .run(this);
380 new EAPopInlinedMethodWithScalarReplacedObjectsReallocFailure() .run(this);
381
382 // ForceEarlyReturn test cases
383 new EAForceEarlyReturnNotInlined() .run(this);
384 new EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjects() .run(this);
385 new EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjectsReallocFailure().run(this);
1770
1771 class EARelockingSimpleTarget extends EATestCaseBaseTarget {
1772
1773 public void dontinline_testMethod() {
1774 XYVal l1 = new XYVal(4, 2);
1775 synchronized (l1) {
1776 dontinline_brkpt();
1777 }
1778 }
1779 }
1780
1781 /////////////////////////////////////////////////////////////////////////////
1782
1783 /**
1784 * Test if the bias of an object O that escapes globally is revoked correctly if local objects
1785 * escape through JVMTI. O is referenced by field l0.
1786 * This tests a regression of a previous version of the implementation.
1787 */
1788 class EARelockingSimple_2 extends EATestCaseBaseDebugger {
1789
1790 public void runTestCase() throws Exception {
1791 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
1792 printStack(bpe.thread());
1793 @SuppressWarnings("unused")
1794 ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "l1");
1795 }
1796 }
1797
1798 class EARelockingSimple_2Target extends EATestCaseBaseTarget {
1799
1800 public XYVal l0;
1801
1802 public void dontinline_testMethod() {
1803 l0 = new XYVal(4, 2); // GobalEscape
1804 XYVal l1 = new XYVal(4, 2);
1805 synchronized (l0) {
1806 synchronized (l1) {
1807 dontinline_brkpt();
1808 }
1809 }
1810 }
1811 }
1812
1813 /////////////////////////////////////////////////////////////////////////////
1814
1815 // Test recursive locking
1816 class EARelockingRecursiveTarget extends EATestCaseBaseTarget {
1817
1818 @Override
1819 public void setUp() {
1820 super.setUp();
1821 testMethodDepth = 2;
1822 }
1823
1824 public void dontinline_testMethod() {
1825 XYVal l1 = new XYVal(4, 2);
1826 synchronized (l1) {
1827 testMethod_inlined(l1);
1828 }
1829 }
1830
1831 public void testMethod_inlined(XYVal l2) {
1832 synchronized (l2) {
1833 dontinline_brkpt();
1834 }
1913 }
1914
1915 public void dontinline_testMethod() {
1916 @SuppressWarnings("unused")
1917 XYVal xy = new XYVal(1, 1); // scalar replaced
1918 XYVal l1 = inflatedLock; // read by debugger
1919 synchronized (l1) {
1920 testMethod_inlined(l1);
1921 }
1922 }
1923
1924 public void testMethod_inlined(XYVal l2) {
1925 synchronized (l2) { // eliminated nested locking
1926 dontinline_brkpt();
1927 }
1928 }
1929 }
1930
1931 /////////////////////////////////////////////////////////////////////////////
1932
1933 /**
1934 * Checks if an eliminated lock of an ArgEscape object l1 can be relocked if
1935 * l1 is locked in a callee frame.
1936 */
1937 class EARelockingArgEscapeLWLockedInCalleeFrame extends EATestCaseBaseDebugger {
1938
1939 public void runTestCase() throws Exception {
1940 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
1941 printStack(bpe.thread());
1942 @SuppressWarnings("unused")
1943 ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
1944 }
1945 }
1946
1947 class EARelockingArgEscapeLWLockedInCalleeFrameTarget extends EATestCaseBaseTarget {
1948
1949 @Override
1950 public void setUp() {
1951 super.setUp();
1952 testMethodDepth = 2;
2092 synchronized (l1) { // eliminated
2093 l1.dontinline_sync_method_no_brkpt(this); // l1 escapes
2094 // trigger bulk rebias
2095 dontinline_bulkRevokeAfterWarmup(l1.getClass());
2096 // Now the epoch of l1 does not match the epoch of its class.
2097 // This has to be considered when relocking because of JVMTI access
2098 dontinline_brkpt();
2099 }
2100 }
2101
2102
2103 @Override
2104 public boolean testFrameShouldBeDeoptimized() {
2105 // Graal does not provide debug info about arg escape objects, therefore the frame is not deoptimized
2106 return !UseJVMCICompiler && super.testFrameShouldBeDeoptimized();
2107 }
2108 }
2109
2110 /////////////////////////////////////////////////////////////////////////////
2111
2112 /**
2113 * Test relocking eliminated (nested) locks of an object on which the
2114 * target thread currently waits.
2115 */
2116 class EARelockingObjectCurrentlyWaitingOn extends EATestCaseBaseDebugger {
2117
2118 public void runTestCase() throws Exception {
2119 env.vm().resume();
2120 boolean inWait = false;
2121 do {
2122 Thread.sleep(100);
2123 env.targetMainThread.suspend();
2124 printStack(env.targetMainThread);
2125 inWait = env.targetMainThread.frame(0).location().method().name().equals("wait");
2126 if (!inWait) {
2127 msg("Target not yet in java.lang.Object.wait(long).");
2128 env.targetMainThread.resume();
2129 }
2130 } while(!inWait);
2131 StackFrame testMethodFrame = env.targetMainThread.frame(4);
2185 synchronized (l0) {
2186 synchronized (l1) {
2187 testMethod_inlined(l1);
2188 }
2189 }
2190 }
2191
2192 public void testMethod_inlined(ForLocking l2) throws Exception {
2193 synchronized (l2) { // eliminated nested locking
2194 dontinline_waitWhenWarmupDone(l2);
2195 }
2196 }
2197
2198 public void dontinline_waitWhenWarmupDone(ForLocking l2) throws Exception {
2199 if (warmupDone) {
2200 l2.wait();
2201 }
2202 }
2203 }
2204
2205 /////////////////////////////////////////////////////////////////////////////
2206 //
2207 // Test cases that require deoptimization even though neither locks
2208 // nor allocations are eliminated at the point where escape state is changed.
2209 //
2210 /////////////////////////////////////////////////////////////////////////////
2211
2212 /**
2213 * Let xy be NoEscape whose allocation cannot be eliminated (simulated by
2214 * -XX:-EliminateAllocations). The holding compiled frame has to be deoptimized when debugger
2215 * accesses xy because afterwards locking on xy is omitted.
2216 * Note: there are no EA based optimizations at the escape point.
2217 */
2218 class EADeoptFrameAfterReadLocalObject_01 extends EATestCaseBaseDebugger {
2219
2220 public void runTestCase() throws Exception {
2221 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
2222 printStack(bpe.thread());
2223 @SuppressWarnings("unused")
2224 ObjectReference xy = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy");
|
25 /**
26 * @test
27 * @bug 8227745
28 * @summary Collection of test cases that check if optimizations based on escape analysis are reverted just before non-escaping objects escape through JVMTI.
29 * @author Richard Reingruber richard DOT reingruber AT sap DOT com
30 *
31 * @requires ((vm.compMode == "Xmixed") & vm.compiler2.enabled)
32 * @library /test/lib /test/hotspot/jtreg
33 *
34 * @run build TestScaffold VMConnection TargetListener TargetAdapter jdk.test.whitebox.WhiteBox
35 * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
36 * @run compile -g EATests.java
37 * @run driver EATests
38 * -XX:+UnlockDiagnosticVMOptions
39 * -Xms256m -Xmx256m
40 * -Xbootclasspath/a:.
41 * -XX:CompileCommand=dontinline,*::dontinline_*
42 * -XX:+WhiteBoxAPI
43 * -Xbatch
44 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking
45 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1
46 * @run driver EATests
47 * -XX:+UnlockDiagnosticVMOptions
48 * -Xms256m -Xmx256m
49 * -Xbootclasspath/a:.
50 * -XX:CompileCommand=dontinline,*::dontinline_*
51 * -XX:+WhiteBoxAPI
52 * -Xbatch
53 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:-EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking -XX:-UseOptoBiasInlining
54 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1
55 * @run driver EATests
56 * -XX:+UnlockDiagnosticVMOptions
57 * -Xms256m -Xmx256m
58 * -Xbootclasspath/a:.
59 * -XX:CompileCommand=dontinline,*::dontinline_*
60 * -XX:+WhiteBoxAPI
61 * -Xbatch
62 * -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking
63 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1
64 * @run driver EATests
65 * -XX:+UnlockDiagnosticVMOptions
66 * -Xms256m -Xmx256m
67 * -Xbootclasspath/a:.
68 * -XX:CompileCommand=dontinline,*::dontinline_*
69 * -XX:+WhiteBoxAPI
70 * -Xbatch
71 * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking
72 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1
73 * @run driver EATests
74 * -XX:+UnlockDiagnosticVMOptions
75 * -Xms256m -Xmx256m
76 * -Xbootclasspath/a:.
77 * -XX:CompileCommand=dontinline,*::dontinline_*
78 * -XX:+WhiteBoxAPI
79 * -Xbatch
80 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking
81 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1
82 * @run driver EATests
83 * -XX:+UnlockDiagnosticVMOptions
84 * -Xms256m -Xmx256m
85 * -Xbootclasspath/a:.
86 * -XX:CompileCommand=dontinline,*::dontinline_*
87 * -XX:+WhiteBoxAPI
88 * -Xbatch
89 * -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking
90 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1
91 * @run driver EATests
92 * -XX:+UnlockDiagnosticVMOptions
93 * -Xms256m -Xmx256m
94 * -Xbootclasspath/a:.
95 * -XX:CompileCommand=dontinline,*::dontinline_*
96 * -XX:+WhiteBoxAPI
97 * -Xbatch
98 * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking
99 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1
100 *
101 * @run driver EATests
102 * -XX:+UnlockDiagnosticVMOptions
103 * -Xms256m -Xmx256m
104 * -Xbootclasspath/a:.
105 * -XX:CompileCommand=dontinline,*::dontinline_*
106 * -XX:+WhiteBoxAPI
107 * -Xbatch
108 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks
109 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=2
110 * @run driver EATests
111 * -XX:+UnlockDiagnosticVMOptions
112 * -Xms256m -Xmx256m
113 * -Xbootclasspath/a:.
114 * -XX:CompileCommand=dontinline,*::dontinline_*
115 * -XX:+WhiteBoxAPI
116 * -Xbatch
117 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:-EliminateLocks -XX:+EliminateNestedLocks
118 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=2
119 * @run driver EATests
120 * -XX:+UnlockDiagnosticVMOptions
121 * -Xms256m -Xmx256m
122 * -Xbootclasspath/a:.
123 * -XX:CompileCommand=dontinline,*::dontinline_*
124 * -XX:+WhiteBoxAPI
125 * -Xbatch
126 * -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks
127 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=2
128 * @run driver EATests
129 * -XX:+UnlockDiagnosticVMOptions
130 * -Xms256m -Xmx256m
131 * -Xbootclasspath/a:.
132 * -XX:CompileCommand=dontinline,*::dontinline_*
133 * -XX:+WhiteBoxAPI
134 * -Xbatch
135 * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks
136 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=2
137 *
138 * @comment Excercise -XX:+DeoptimizeObjectsALot. Mostly to prevent bit-rot because the option is meant to stress object deoptimization
139 * with non-synthetic workloads.
140 * @run driver EATests
141 * -XX:+UnlockDiagnosticVMOptions
142 * -Xms256m -Xmx256m
143 * -Xbootclasspath/a:.
144 * -XX:CompileCommand=dontinline,*::dontinline_*
145 * -XX:+WhiteBoxAPI
146 * -Xbatch
147 * -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking
148 * -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeObjectsALot
149 *
150 * @bug 8324881
151 * @comment Regression test for using the wrong thread when logging during re-locking from deoptimization.
152 *
153 * @comment DiagnoseSyncOnValueBasedClasses=2 will cause logging when locking on \@ValueBased objects.
154 * @run driver EATests
155 * -XX:+UnlockDiagnosticVMOptions
156 * -Xms256m -Xmx256m
157 * -Xbootclasspath/a:.
158 * -XX:CompileCommand=dontinline,*::dontinline_*
159 * -XX:+WhiteBoxAPI
160 * -Xbatch
161 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks
162 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=1
163 * -XX:DiagnoseSyncOnValueBasedClasses=2
164 *
165 * @comment Re-lock may inflate monitors when re-locking, which cause monitorinflation trace logging.
166 * @run driver EATests
167 * -XX:+UnlockDiagnosticVMOptions
168 * -Xms256m -Xmx256m
169 * -Xbootclasspath/a:.
170 * -XX:CompileCommand=dontinline,*::dontinline_*
171 * -XX:+WhiteBoxAPI
172 * -Xbatch
173 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks
174 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=2
175 * -Xlog:monitorinflation=trace:file=monitorinflation.log
176 *
177 * @comment Re-lock may race with deflation.
178 * @run driver EATests
179 * -XX:+UnlockDiagnosticVMOptions
180 * -Xms256m -Xmx256m
181 * -Xbootclasspath/a:.
182 * -XX:CompileCommand=dontinline,*::dontinline_*
183 * -XX:+WhiteBoxAPI
184 * -Xbatch
185 * -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks
186 * -XX:+UnlockExperimentalVMOptions -XX:LockingMode=0
187 * -XX:GuaranteedAsyncDeflationInterval=1000
188 */
189
190 /**
191 * @test
192 * @bug 8227745
193 *
194 * @summary This is another configuration of EATests.java to test Graal. Some testcases are expected
195 * to fail because Graal does not provide all information about non-escaping objects in
196 * scope. These are skipped.
197 *
198 * @author Richard Reingruber richard DOT reingruber AT sap DOT com
199 *
200 * @requires ((vm.compMode == "Xmixed") & vm.graal.enabled)
201 *
202 * @library /test/lib /test/hotspot/jtreg
203 *
204 * @run build TestScaffold VMConnection TargetListener TargetAdapter jdk.test.whitebox.WhiteBox
205 * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
206 * @run compile -g EATests.java
207 *
208 * @comment Test with Graal. Some testcases are expected to fail because Graal does not provide all information about non-escaping
209 * objects in scope. These are skipped.
299 new EAMaterializeLocalVariableUponGetTarget() .run();
300 new EAGetWithoutMaterializeTarget() .run();
301 new EAMaterializeLocalAtObjectReturnTarget() .run();
302 new EAMaterializeLocalAtObjectPollReturnReturnTarget() .run();
303 new EAMaterializeIntArrayTarget() .run();
304 new EAMaterializeLongArrayTarget() .run();
305 new EAMaterializeFloatArrayTarget() .run();
306 new EAMaterializeDoubleArrayTarget() .run();
307 new EAMaterializeObjectArrayTarget() .run();
308 new EAMaterializeObjectWithConstantAndNotConstantValuesTarget() .run();
309 new EAMaterializeObjReferencedBy2LocalsTarget() .run();
310 new EAMaterializeObjReferencedBy2LocalsAndModifyTarget() .run();
311 new EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesTarget() .run();
312 new EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesAndModifyTarget() .run();
313 new EAMaterializeObjReferencedFromOperandStackTarget() .run();
314 new EAMaterializeLocalVariableUponGetAfterSetIntegerTarget() .run();
315
316 // Relocking test cases
317 new EARelockingSimpleTarget() .run();
318 new EARelockingSimple_2Target() .run();
319 new EARelockingSimpleWithAccessInOtherThreadTarget() .run();
320 new EARelockingRecursiveTarget() .run();
321 new EARelockingNestedInflatedTarget() .run();
322 new EARelockingNestedInflated_02Target() .run();
323 new EARelockingNestedInflated_03Target() .run();
324 new EARelockingArgEscapeLWLockedInCalleeFrameTarget() .run();
325 new EARelockingArgEscapeLWLockedInCalleeFrame_2Target() .run();
326 new EARelockingArgEscapeLWLockedInCalleeFrame_3Target() .run();
327 new EARelockingArgEscapeLWLockedInCalleeFrame_4Target() .run();
328 new EAGetOwnedMonitorsTarget() .run();
329 new EAEntryCountTarget() .run();
330 new EARelockingObjectCurrentlyWaitingOnTarget() .run();
331 new EARelockingValueBasedTarget() .run();
332
333 // Test cases that require deoptimization even though neither
334 // locks nor allocations are eliminated at the point where
335 // escape state is changed.
336 new EADeoptFrameAfterReadLocalObject_01Target() .run();
337 new EADeoptFrameAfterReadLocalObject_01BTarget() .run();
338 new EADeoptFrameAfterReadLocalObject_02Target() .run();
339 new EADeoptFrameAfterReadLocalObject_02BTarget() .run();
340 new EADeoptFrameAfterReadLocalObject_02CTarget() .run();
341 new EADeoptFrameAfterReadLocalObject_03Target() .run();
342
343 // PopFrame test cases
344 new EAPopFrameNotInlinedTarget() .run();
345 new EAPopFrameNotInlinedReallocFailureTarget() .run();
346 new EAPopInlinedMethodWithScalarReplacedObjectsReallocFailureTarget() .run();
347
348 // ForceEarlyReturn test cases
349 new EAForceEarlyReturnNotInlinedTarget() .run();
350 new EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjectsTarget() .run();
351 new EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjectsReallocFailureTarget().run();
422 new EAMaterializeLocalVariableUponGet() .run(this);
423 new EAGetWithoutMaterialize() .run(this);
424 new EAMaterializeLocalAtObjectReturn() .run(this);
425 new EAMaterializeLocalAtObjectPollReturnReturn() .run(this);
426 new EAMaterializeIntArray() .run(this);
427 new EAMaterializeLongArray() .run(this);
428 new EAMaterializeFloatArray() .run(this);
429 new EAMaterializeDoubleArray() .run(this);
430 new EAMaterializeObjectArray() .run(this);
431 new EAMaterializeObjectWithConstantAndNotConstantValues() .run(this);
432 new EAMaterializeObjReferencedBy2Locals() .run(this);
433 new EAMaterializeObjReferencedBy2LocalsAndModify() .run(this);
434 new EAMaterializeObjReferencedBy2LocalsInDifferentVirtFrames() .run(this);
435 new EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesAndModify() .run(this);
436 new EAMaterializeObjReferencedFromOperandStack() .run(this);
437 new EAMaterializeLocalVariableUponGetAfterSetInteger() .run(this);
438
439 // Relocking test cases
440 new EARelockingSimple() .run(this);
441 new EARelockingSimple_2() .run(this);
442 new EARelockingSimpleWithAccessInOtherThread() .run(this);
443 new EARelockingRecursive() .run(this);
444 new EARelockingNestedInflated() .run(this);
445 new EARelockingNestedInflated_02() .run(this);
446 new EARelockingNestedInflated_03() .run(this);
447 new EARelockingArgEscapeLWLockedInCalleeFrame() .run(this);
448 new EARelockingArgEscapeLWLockedInCalleeFrame_2() .run(this);
449 new EARelockingArgEscapeLWLockedInCalleeFrame_3() .run(this);
450 new EARelockingArgEscapeLWLockedInCalleeFrame_4() .run(this);
451 new EAGetOwnedMonitors() .run(this);
452 new EAEntryCount() .run(this);
453 new EARelockingObjectCurrentlyWaitingOn() .run(this);
454 new EARelockingValueBased() .run(this);
455
456 // Test cases that require deoptimization even though neither
457 // locks nor allocations are eliminated at the point where
458 // escape state is changed.
459 new EADeoptFrameAfterReadLocalObject_01() .run(this);
460 new EADeoptFrameAfterReadLocalObject_01B() .run(this);
461 new EADeoptFrameAfterReadLocalObject_02() .run(this);
462 new EADeoptFrameAfterReadLocalObject_02B() .run(this);
463 new EADeoptFrameAfterReadLocalObject_02C() .run(this);
464 new EADeoptFrameAfterReadLocalObject_03() .run(this);
465
466 // PopFrame test cases
467 new EAPopFrameNotInlined() .run(this);
468 new EAPopFrameNotInlinedReallocFailure() .run(this);
469 new EAPopInlinedMethodWithScalarReplacedObjectsReallocFailure() .run(this);
470
471 // ForceEarlyReturn test cases
472 new EAForceEarlyReturnNotInlined() .run(this);
473 new EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjects() .run(this);
474 new EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjectsReallocFailure().run(this);
1859
1860 class EARelockingSimpleTarget extends EATestCaseBaseTarget {
1861
1862 public void dontinline_testMethod() {
1863 XYVal l1 = new XYVal(4, 2);
1864 synchronized (l1) {
1865 dontinline_brkpt();
1866 }
1867 }
1868 }
1869
1870 /////////////////////////////////////////////////////////////////////////////
1871
1872 /**
1873 * Test if the bias of an object O that escapes globally is revoked correctly if local objects
1874 * escape through JVMTI. O is referenced by field l0.
1875 * This tests a regression of a previous version of the implementation.
1876 */
1877 class EARelockingSimple_2 extends EATestCaseBaseDebugger {
1878
1879
1880 public void runTestCase() throws Exception {
1881 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
1882 printStack(bpe.thread());
1883 @SuppressWarnings("unused")
1884 ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "l1");
1885 }
1886 }
1887
1888 class EARelockingSimple_2Target extends EATestCaseBaseTarget {
1889
1890 public XYVal l0;
1891
1892 public void dontinline_testMethod() {
1893 l0 = new XYVal(4, 2); // GobalEscape
1894 XYVal l1 = new XYVal(4, 2);
1895 synchronized (l0) {
1896 synchronized (l1) {
1897 dontinline_brkpt();
1898 }
1899 }
1900 }
1901 }
1902
1903 /////////////////////////////////////////////////////////////////////////////
1904
1905 // The debugger reads and publishes an object with eliminated locking to an instance field.
1906 // A 2nd thread in the debuggee finds it there and changes its state using a synchronized method.
1907 // Without eager relocking the accesses are unsynchronized which can be observed.
1908 class EARelockingSimpleWithAccessInOtherThread extends EATestCaseBaseDebugger {
1909
1910 public void runTestCase() throws Exception {
1911 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
1912 printStack(bpe.thread());
1913 String l1ClassName = EARelockingSimpleWithAccessInOtherThreadTarget.SyncCounter.class.getName();
1914 ObjectReference ctr = getLocalRef(bpe.thread().frame(1), l1ClassName, "l1");
1915 setField(testCase, "sharedCounter", ctr);
1916 terminateEndlessLoop();
1917 }
1918 }
1919
1920 class EARelockingSimpleWithAccessInOtherThreadTarget extends EATestCaseBaseTarget {
1921
1922 public static class SyncCounter {
1923 private int val;
1924 public synchronized int inc() { return val++; }
1925 }
1926
1927 public volatile SyncCounter sharedCounter;
1928
1929 @Override
1930 public void setUp() {
1931 super.setUp();
1932 doLoop = true;
1933 Thread t = new Thread() {
1934 public void run() {
1935 while (doLoop) {
1936 SyncCounter ctr = sharedCounter;
1937 if (ctr != null) {
1938 ctr.inc();
1939 }
1940 }
1941 }
1942 };
1943 t.setDaemon(true);
1944 t.start();
1945 }
1946
1947 public void dontinline_testMethod() {
1948 SyncCounter l1 = new SyncCounter();
1949 synchronized (l1) { // Eliminated locking
1950 l1.inc();
1951 dontinline_brkpt(); // Debugger publishes l1 to sharedCounter.
1952 iResult = l1.inc(); // Changes by the 2nd thread will be observed if l1
1953 // was not relocked before passing it to the debugger.
1954 }
1955 }
1956
1957 @Override
1958 public int getExpectedIResult() {
1959 return 1;
1960 }
1961 }
1962
1963 /////////////////////////////////////////////////////////////////////////////
1964
1965 // Test recursive locking
1966 class EARelockingRecursiveTarget extends EATestCaseBaseTarget {
1967
1968 @Override
1969 public void setUp() {
1970 super.setUp();
1971 testMethodDepth = 2;
1972 }
1973
1974 public void dontinline_testMethod() {
1975 XYVal l1 = new XYVal(4, 2);
1976 synchronized (l1) {
1977 testMethod_inlined(l1);
1978 }
1979 }
1980
1981 public void testMethod_inlined(XYVal l2) {
1982 synchronized (l2) {
1983 dontinline_brkpt();
1984 }
2063 }
2064
2065 public void dontinline_testMethod() {
2066 @SuppressWarnings("unused")
2067 XYVal xy = new XYVal(1, 1); // scalar replaced
2068 XYVal l1 = inflatedLock; // read by debugger
2069 synchronized (l1) {
2070 testMethod_inlined(l1);
2071 }
2072 }
2073
2074 public void testMethod_inlined(XYVal l2) {
2075 synchronized (l2) { // eliminated nested locking
2076 dontinline_brkpt();
2077 }
2078 }
2079 }
2080
2081 /////////////////////////////////////////////////////////////////////////////
2082
2083 /**
2084 * Like {@link EARelockingNestedInflated_02} with the difference that the
2085 * inflation of the lock happens because of contention.
2086 */
2087 class EARelockingNestedInflated_03 extends EATestCaseBaseDebugger {
2088
2089 public void runTestCase() throws Exception {
2090 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
2091 printStack(bpe.thread());
2092 @SuppressWarnings("unused")
2093 ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
2094 }
2095 }
2096
2097 class EARelockingNestedInflated_03Target extends EATestCaseBaseTarget {
2098
2099 public XYVal lockInflatedByContention;
2100 public boolean doLockNow;
2101 public EATestCaseBaseTarget testCase;
2102
2103 @Override
2104 public void setUp() {
2105 super.setUp();
2106 testMethodDepth = 2;
2107 lockInflatedByContention = new XYVal(1, 1);
2108 testCase = this;
2109 }
2110
2111 @Override
2112 public void warmupDone() {
2113 super.warmupDone();
2114 // Use new lock. lockInflatedByContention might have been inflated because of recursion.
2115 lockInflatedByContention = new XYVal(1, 1);
2116 // Start thread that tries to enter lockInflatedByContention while the main thread owns it -> inflation
2117 new Thread(() -> {
2118 while (true) {
2119 synchronized (testCase) {
2120 try {
2121 if (doLockNow) {
2122 doLockNow = false; // reset for main thread
2123 testCase.notify();
2124 break;
2125 }
2126 testCase.wait();
2127 } catch (InterruptedException e) { /* ignored */ }
2128 }
2129 }
2130 synchronized (lockInflatedByContention) { // will block and trigger inflation
2131 msg(Thread.currentThread().getName() + ": acquired lockInflatedByContention");
2132 }
2133 }, testCaseName + ": Lock Contender (test thread)").start();
2134 }
2135
2136 public void dontinline_testMethod() {
2137 @SuppressWarnings("unused")
2138 XYVal xy = new XYVal(1, 1); // scalar replaced
2139 XYVal l1 = lockInflatedByContention; // read by debugger
2140 synchronized (l1) {
2141 testMethod_inlined(l1);
2142 }
2143 }
2144
2145 public void testMethod_inlined(XYVal l2) {
2146 synchronized (l2) { // eliminated nested locking
2147 dontinline_notifyOtherThread();
2148 dontinline_brkpt();
2149 }
2150 }
2151
2152 public void dontinline_notifyOtherThread() {
2153 if (!warmupDone) {
2154 return;
2155 }
2156 synchronized (testCase) {
2157 doLockNow = true;
2158 testCase.notify();
2159 // wait for other thread to reset doLockNow again
2160 while (doLockNow) {
2161 try {
2162 testCase.wait();
2163 } catch (InterruptedException e) { /* ignored */ }
2164 }
2165 }
2166 }
2167 }
2168
2169 /////////////////////////////////////////////////////////////////////////////
2170
2171 /**
2172 * Checks if an eliminated lock of an ArgEscape object l1 can be relocked if
2173 * l1 is locked in a callee frame.
2174 */
2175 class EARelockingArgEscapeLWLockedInCalleeFrame extends EATestCaseBaseDebugger {
2176
2177 public void runTestCase() throws Exception {
2178 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
2179 printStack(bpe.thread());
2180 @SuppressWarnings("unused")
2181 ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
2182 }
2183 }
2184
2185 class EARelockingArgEscapeLWLockedInCalleeFrameTarget extends EATestCaseBaseTarget {
2186
2187 @Override
2188 public void setUp() {
2189 super.setUp();
2190 testMethodDepth = 2;
2330 synchronized (l1) { // eliminated
2331 l1.dontinline_sync_method_no_brkpt(this); // l1 escapes
2332 // trigger bulk rebias
2333 dontinline_bulkRevokeAfterWarmup(l1.getClass());
2334 // Now the epoch of l1 does not match the epoch of its class.
2335 // This has to be considered when relocking because of JVMTI access
2336 dontinline_brkpt();
2337 }
2338 }
2339
2340
2341 @Override
2342 public boolean testFrameShouldBeDeoptimized() {
2343 // Graal does not provide debug info about arg escape objects, therefore the frame is not deoptimized
2344 return !UseJVMCICompiler && super.testFrameShouldBeDeoptimized();
2345 }
2346 }
2347
2348 /////////////////////////////////////////////////////////////////////////////
2349
2350 /**
2351 * Similar to {@link EARelockingArgEscapeLWLockedInCalleeFrame_2Target}. It does
2352 * not use recursive locking and exposed a bug in the lightweight-locking implementation.
2353 */
2354 class EARelockingArgEscapeLWLockedInCalleeFrameNoRecursive extends EATestCaseBaseDebugger {
2355
2356 public void runTestCase() throws Exception {
2357 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
2358 printStack(bpe.thread());
2359 @SuppressWarnings("unused")
2360 ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
2361 }
2362 }
2363
2364 class EARelockingArgEscapeLWLockedInCalleeFrameNoRecursiveTarget extends EATestCaseBaseTarget {
2365
2366 @Override
2367 public void setUp() {
2368 super.setUp();
2369 testMethodDepth = 2;
2370 }
2371
2372 public void dontinline_testMethod() {
2373 XYVal l1 = new XYVal(1, 1); // NoEscape, scalar replaced
2374 XYVal l2 = new XYVal(4, 2); // NoEscape, scalar replaced
2375 XYVal l3 = new XYVal(5, 3); // ArgEscape
2376 synchronized (l1) { // eliminated
2377 synchronized (l2) { // eliminated
2378 l3.dontinline_sync_method(this); // l3 escapes
2379 }
2380 }
2381 iResult = l2.x + l2.y;
2382 }
2383
2384 @Override
2385 public int getExpectedIResult() {
2386 return 6;
2387 }
2388 }
2389
2390 /////////////////////////////////////////////////////////////////////////////
2391
2392 /**
2393 * Test relocking eliminated (nested) locks of an object on which the
2394 * target thread currently waits.
2395 */
2396 class EARelockingObjectCurrentlyWaitingOn extends EATestCaseBaseDebugger {
2397
2398 public void runTestCase() throws Exception {
2399 env.vm().resume();
2400 boolean inWait = false;
2401 do {
2402 Thread.sleep(100);
2403 env.targetMainThread.suspend();
2404 printStack(env.targetMainThread);
2405 inWait = env.targetMainThread.frame(0).location().method().name().equals("wait");
2406 if (!inWait) {
2407 msg("Target not yet in java.lang.Object.wait(long).");
2408 env.targetMainThread.resume();
2409 }
2410 } while(!inWait);
2411 StackFrame testMethodFrame = env.targetMainThread.frame(4);
2465 synchronized (l0) {
2466 synchronized (l1) {
2467 testMethod_inlined(l1);
2468 }
2469 }
2470 }
2471
2472 public void testMethod_inlined(ForLocking l2) throws Exception {
2473 synchronized (l2) { // eliminated nested locking
2474 dontinline_waitWhenWarmupDone(l2);
2475 }
2476 }
2477
2478 public void dontinline_waitWhenWarmupDone(ForLocking l2) throws Exception {
2479 if (warmupDone) {
2480 l2.wait();
2481 }
2482 }
2483 }
2484
2485
2486 /////////////////////////////////////////////////////////////////////////////
2487
2488 /**
2489 * Test relocking eliminated @ValueBased object.
2490 */
2491 class EARelockingValueBased extends EATestCaseBaseDebugger {
2492
2493 public void runTestCase() throws Exception {
2494 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
2495 printStack(bpe.thread());
2496 @SuppressWarnings("unused")
2497 ObjectReference o = getLocalRef(bpe.thread().frame(1), Integer.class.getName(), "l1");
2498 }
2499 }
2500
2501 class EARelockingValueBasedTarget extends EATestCaseBaseTarget {
2502
2503 public void dontinline_testMethod() {
2504 Integer l1 = new Integer(255);
2505 synchronized (l1) {
2506 dontinline_brkpt();
2507 }
2508 }
2509 }
2510
2511 /////////////////////////////////////////////////////////////////////////////
2512 //
2513 // Test cases that require deoptimization even though neither locks
2514 // nor allocations are eliminated at the point where escape state is changed.
2515 //
2516 /////////////////////////////////////////////////////////////////////////////
2517
2518 /**
2519 * Let xy be NoEscape whose allocation cannot be eliminated (simulated by
2520 * -XX:-EliminateAllocations). The holding compiled frame has to be deoptimized when debugger
2521 * accesses xy because afterwards locking on xy is omitted.
2522 * Note: there are no EA based optimizations at the escape point.
2523 */
2524 class EADeoptFrameAfterReadLocalObject_01 extends EATestCaseBaseDebugger {
2525
2526 public void runTestCase() throws Exception {
2527 BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
2528 printStack(bpe.thread());
2529 @SuppressWarnings("unused")
2530 ObjectReference xy = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy");
|