author | pliden |
Wed, 09 Oct 2019 20:12:46 +0200 | |
changeset 58522 | 17a34e111667 |
parent 58512 | 5185bc8dcbb1 |
child 58679 | 9c3209ff7550 |
permissions | -rw-r--r-- |
58512
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
1 |
/* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
2 |
* Copyright (c) 2019 SAP SE. All rights reserved. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
4 |
* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
8 |
* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
13 |
* accompanied this code). |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
14 |
* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
18 |
* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
21 |
* questions. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
22 |
*/ |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
23 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
24 |
/** |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
25 |
* @test |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
26 |
* @bug 8230677 |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
27 |
* @summary Test JVMTI's GetOwnedMonitorStackDepthInfo with scalar replaced objects and eliminated locks on stack (optimizations based on escape analysis). |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
28 |
* @comment Without RFE 8227745 escape analysis needs to be switched off to pass the test. For the implementation of RFE 8227745 it serves as a regression test. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
29 |
* @requires (vm.compMode != "Xcomp" & vm.compiler2.enabled) |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
30 |
* @library /test/lib |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
31 |
* @compile GetOwnedMonitorStackDepthInfoWithEATest.java |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
32 |
* @run main/othervm/native |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
33 |
* -agentlib:GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
34 |
* -XX:+UnlockDiagnosticVMOptions |
58522
17a34e111667
8232056: GetOwnedMonitorInfoWithEATest.java fails with ZGC: Heap too small
pliden
parents:
58512
diff
changeset
|
35 |
* -Xms128m -Xmx128m |
58512
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
36 |
* -XX:CompileCommand=dontinline,*::dontinline_* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
37 |
* -XX:+PrintCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
38 |
* -XX:+PrintInlining |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
39 |
* -XX:-TieredCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
40 |
* -Xbatch |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
41 |
* -XX:CICompilerCount=1 |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
42 |
* -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
43 |
* GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
44 |
* @run main/othervm/native |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
45 |
* -agentlib:GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
46 |
* -XX:+UnlockDiagnosticVMOptions |
58522
17a34e111667
8232056: GetOwnedMonitorInfoWithEATest.java fails with ZGC: Heap too small
pliden
parents:
58512
diff
changeset
|
47 |
* -Xms128m -Xmx128m |
58512
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
48 |
* -XX:CompileCommand=dontinline,*::dontinline_* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
49 |
* -XX:+PrintCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
50 |
* -XX:+PrintInlining |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
51 |
* -XX:-TieredCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
52 |
* -Xbatch |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
53 |
* -XX:CICompilerCount=1 |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
54 |
* -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:-EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking -XX:-UseOptoBiasInlining |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
55 |
* GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
56 |
* @run main/othervm/native |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
57 |
* -agentlib:GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
58 |
* -XX:+UnlockDiagnosticVMOptions |
58522
17a34e111667
8232056: GetOwnedMonitorInfoWithEATest.java fails with ZGC: Heap too small
pliden
parents:
58512
diff
changeset
|
59 |
* -Xms128m -Xmx128m |
58512
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
60 |
* -XX:CompileCommand=dontinline,*::dontinline_* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
61 |
* -XX:+PrintCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
62 |
* -XX:+PrintInlining |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
63 |
* -XX:-TieredCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
64 |
* -Xbatch |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
65 |
* -XX:CICompilerCount=1 |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
66 |
* -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
67 |
* GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
68 |
* @run main/othervm/native |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
69 |
* -agentlib:GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
70 |
* -XX:+UnlockDiagnosticVMOptions |
58522
17a34e111667
8232056: GetOwnedMonitorInfoWithEATest.java fails with ZGC: Heap too small
pliden
parents:
58512
diff
changeset
|
71 |
* -Xms128m -Xmx128m |
58512
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
72 |
* -XX:CompileCommand=dontinline,*::dontinline_* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
73 |
* -XX:+PrintCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
74 |
* -XX:+PrintInlining |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
75 |
* -XX:-TieredCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
76 |
* -Xbatch |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
77 |
* -XX:CICompilerCount=1 |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
78 |
* -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:+UseBiasedLocking |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
79 |
* GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
80 |
* @run main/othervm/native |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
81 |
* -agentlib:GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
82 |
* -XX:+UnlockDiagnosticVMOptions |
58522
17a34e111667
8232056: GetOwnedMonitorInfoWithEATest.java fails with ZGC: Heap too small
pliden
parents:
58512
diff
changeset
|
83 |
* -Xms128m -Xmx128m |
58512
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
84 |
* -XX:CompileCommand=dontinline,*::dontinline_* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
85 |
* -XX:+PrintCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
86 |
* -XX:+PrintInlining |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
87 |
* -XX:-TieredCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
88 |
* -Xbatch |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
89 |
* -XX:CICompilerCount=1 |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
90 |
* -XX:+DoEscapeAnalysis -XX:+EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
91 |
* GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
92 |
* @run main/othervm/native |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
93 |
* -agentlib:GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
94 |
* -XX:+UnlockDiagnosticVMOptions |
58522
17a34e111667
8232056: GetOwnedMonitorInfoWithEATest.java fails with ZGC: Heap too small
pliden
parents:
58512
diff
changeset
|
95 |
* -Xms128m -Xmx128m |
58512
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
96 |
* -XX:CompileCommand=dontinline,*::dontinline_* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
97 |
* -XX:+PrintCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
98 |
* -XX:+PrintInlining |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
99 |
* -XX:-TieredCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
100 |
* -Xbatch |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
101 |
* -XX:CICompilerCount=1 |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
102 |
* -XX:+DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
103 |
* GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
104 |
* @run main/othervm/native |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
105 |
* -agentlib:GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
106 |
* -XX:+UnlockDiagnosticVMOptions |
58522
17a34e111667
8232056: GetOwnedMonitorInfoWithEATest.java fails with ZGC: Heap too small
pliden
parents:
58512
diff
changeset
|
107 |
* -Xms128m -Xmx128m |
58512
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
108 |
* -XX:CompileCommand=dontinline,*::dontinline_* |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
109 |
* -XX:+PrintCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
110 |
* -XX:+PrintInlining |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
111 |
* -XX:-TieredCompilation |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
112 |
* -Xbatch |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
113 |
* -XX:CICompilerCount=1 |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
114 |
* -XX:-DoEscapeAnalysis -XX:-EliminateAllocations -XX:+EliminateLocks -XX:+EliminateNestedLocks -XX:-UseBiasedLocking |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
115 |
* GetOwnedMonitorStackDepthInfoWithEATest |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
116 |
*/ |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
117 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
118 |
import jdk.test.lib.Asserts; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
119 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
120 |
public class GetOwnedMonitorStackDepthInfoWithEATest { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
121 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
122 |
public static final int COMPILE_THRESHOLD = 20000; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
123 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
124 |
/** |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
125 |
* Native wrapper arround JVMTI's GetOwnedMonitorStackDepthInfo(). |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
126 |
* @param t The thread for which the owned monitors information should be retrieved. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
127 |
* @param ownedMonitors Array filled in by the call with the objects associated |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
128 |
* with the monitors owned by the given thread. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
129 |
* @param depths Per owned monitor the depth of the frame were it was locked. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
130 |
* Filled in by the call |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
131 |
* @return Number of monitors owned by the given thread. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
132 |
*/ |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
133 |
public static native int getOwnedMonitorStackDepthInfo(Thread t, Object[] ownedMonitors, int[] depths); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
134 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
135 |
public static void main(String[] args) throws Exception { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
136 |
new GetOwnedMonitorStackDepthInfoWithEATest().runTest(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
137 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
138 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
139 |
public void runTest() throws Exception { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
140 |
new TestCase_1().run(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
141 |
new TestCase_2().run(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
142 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
143 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
144 |
public static abstract class TestCaseBase implements Runnable { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
145 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
146 |
public long checkSum; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
147 |
public boolean doLoop; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
148 |
public volatile long loopCount; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
149 |
public volatile boolean targetIsInLoop; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
150 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
151 |
public void run() { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
152 |
try { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
153 |
msgHL("Executing test case " + getClass().getName()); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
154 |
warmUp(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
155 |
runTest(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
156 |
} catch (Exception e) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
157 |
Asserts.fail("Unexpected Exception", e); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
158 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
159 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
160 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
161 |
public void warmUp() { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
162 |
int callCount = COMPILE_THRESHOLD + 1000; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
163 |
doLoop = true; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
164 |
while (callCount-- > 0) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
165 |
dontinline_testMethod(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
166 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
167 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
168 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
169 |
public abstract void runTest() throws Exception; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
170 |
public abstract void dontinline_testMethod(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
171 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
172 |
public long dontinline_endlessLoop() { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
173 |
long cs = checkSum; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
174 |
while (doLoop && loopCount-- > 0) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
175 |
targetIsInLoop = true; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
176 |
checkSum += checkSum % ++cs; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
177 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
178 |
loopCount = 3; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
179 |
targetIsInLoop = false; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
180 |
return checkSum; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
181 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
182 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
183 |
public void waitUntilTargetThreadHasEnteredEndlessLoop() throws Exception { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
184 |
while(!targetIsInLoop) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
185 |
msg("Target has not yet entered the loop. Sleep 200ms."); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
186 |
try { Thread.sleep(200); } catch (InterruptedException e) { /*ignore */ } |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
187 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
188 |
msg("Target has entered the loop."); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
189 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
190 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
191 |
public void terminateEndlessLoop() throws Exception { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
192 |
msg("Terminate endless loop"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
193 |
do { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
194 |
doLoop = false; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
195 |
} while(targetIsInLoop); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
196 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
197 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
198 |
public void msg(String m) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
199 |
System.out.println(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
200 |
System.out.println("### " + m); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
201 |
System.out.println(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
202 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
203 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
204 |
public void msgHL(String m) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
205 |
System.out.println(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
206 |
System.out.println("#####################################################"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
207 |
System.out.println("### " + m); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
208 |
System.out.println("###"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
209 |
System.out.println(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
210 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
211 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
212 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
213 |
/** |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
214 |
* Starts target thread T and then queries monitor information for T using JVMTI's GetOwnedMonitorStackDepthInfo(). |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
215 |
* With escape analysis enabled the jit compiled method {@link #dontinline_testMethod()} has |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
216 |
* scalar replaced objects with eliminated (nested) locking in scope when the monitor |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
217 |
* information is retrieved. Effectively the objects escape through the JVMTI call. This works |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
218 |
* only with RFE 8227745. Without it escape analysis needs to be disabled. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
219 |
*/ |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
220 |
public static class TestCase_1 extends TestCaseBase { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
221 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
222 |
public void runTest() throws Exception { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
223 |
loopCount = 1L << 62; // endless loop |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
224 |
Thread t1 = new Thread(() -> dontinline_testMethod(), "Target Thread"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
225 |
try { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
226 |
t1.start(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
227 |
waitUntilTargetThreadHasEnteredEndlessLoop(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
228 |
int expectedMonitorCount = 1; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
229 |
int resultSize = expectedMonitorCount + 3; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
230 |
Object[] ownedMonitors = new Object[resultSize]; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
231 |
int[] depths = new int[resultSize]; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
232 |
msg("Get monitor info"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
233 |
int monitorCount = getOwnedMonitorStackDepthInfo(t1, ownedMonitors, depths); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
234 |
Asserts.assertGreaterThanOrEqual(monitorCount, 0, "getOwnedMonitorsFor() call failed"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
235 |
msg("Monitor info:"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
236 |
for (int i = 0; i < monitorCount; i++) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
237 |
System.out.println(i + ": cls=" + (ownedMonitors[i] != null ? ownedMonitors[i].getClass() : null) + " depth=" + depths[i]); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
238 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
239 |
Asserts.assertEQ(monitorCount, expectedMonitorCount, "unexpected monitor count returned by getOwnedMonitorsFor()"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
240 |
Asserts.assertNotNull(ownedMonitors[0]); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
241 |
Asserts.assertSame(ownedMonitors[0].getClass(), LockCls.class); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
242 |
Asserts.assertEQ(depths[0], 1, "unexpected depth for owned monitor at index 0"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
243 |
} finally { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
244 |
terminateEndlessLoop(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
245 |
t1.join(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
246 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
247 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
248 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
249 |
public void dontinline_testMethod() { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
250 |
LockCls l1 = new LockCls(); // to be scalar replaced |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
251 |
synchronized (l1) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
252 |
inlinedTestMethodWithNestedLocking(l1); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
253 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
254 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
255 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
256 |
public void inlinedTestMethodWithNestedLocking(LockCls l1) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
257 |
synchronized (l1) { // nested |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
258 |
dontinline_endlessLoop(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
259 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
260 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
261 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
262 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
263 |
/** |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
264 |
* Similar to {@link TestCase_1}. Additionally the target thread T has got eliminated locking |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
265 |
* for a synchronized method of a different type {@linkplain LockCls2}. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
266 |
*/ |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
267 |
public static class TestCase_2 extends TestCaseBase { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
268 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
269 |
public void runTest() throws Exception { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
270 |
loopCount = 1L << 62; // endless loop |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
271 |
Thread t1 = new Thread(() -> dontinline_testMethod(), "Target Thread"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
272 |
t1.start(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
273 |
try { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
274 |
waitUntilTargetThreadHasEnteredEndlessLoop(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
275 |
int expectedMonitorCount = 2; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
276 |
int resultSize = expectedMonitorCount + 3; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
277 |
Object[] ownedMonitors = new Object[resultSize]; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
278 |
int[] depths = new int[resultSize]; |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
279 |
msg("Get monitor info"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
280 |
int monitorCount = getOwnedMonitorStackDepthInfo(t1, ownedMonitors, depths); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
281 |
terminateEndlessLoop(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
282 |
t1.join(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
283 |
Asserts.assertGreaterThanOrEqual(monitorCount, 0, "getOwnedMonitorsFor() call failed"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
284 |
msg("Monitor info:"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
285 |
for (int i = 0; i < monitorCount; i++) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
286 |
System.out.println(i + ": cls=" + (ownedMonitors[i] != null ? ownedMonitors[i].getClass() : null) + " depth=" + depths[i]); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
287 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
288 |
Asserts.assertEQ(monitorCount, expectedMonitorCount, "unexpected monitor count returned by getOwnedMonitorsFor()"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
289 |
Asserts.assertNotNull(ownedMonitors[0]); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
290 |
Asserts.assertSame(ownedMonitors[0].getClass(), LockCls2.class); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
291 |
Asserts.assertEQ(depths[0], 1, "unexpected depth for owned monitor at index 0"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
292 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
293 |
Asserts.assertNotNull(ownedMonitors[1]); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
294 |
Asserts.assertSame(ownedMonitors[1].getClass(), LockCls.class); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
295 |
Asserts.assertEQ(depths[1], 3, "unexpected depth for owned monitor at index 1"); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
296 |
} finally { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
297 |
terminateEndlessLoop(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
298 |
t1.join(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
299 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
300 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
301 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
302 |
public void dontinline_testMethod() { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
303 |
LockCls l1 = new LockCls(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
304 |
synchronized (l1) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
305 |
inlinedTestMethodWithNestedLocking(l1); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
306 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
307 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
308 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
309 |
public void inlinedTestMethodWithNestedLocking(LockCls l1) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
310 |
synchronized (l1) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
311 |
dontinline_testMethod2(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
312 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
313 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
314 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
315 |
public void dontinline_testMethod2() { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
316 |
// Call synchronized method. Receiver of the call will be scalar replaced, |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
317 |
// and locking will be eliminated. Here we use a different type. |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
318 |
new LockCls2().inline_synchronized_testMethod(this); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
319 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
320 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
321 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
322 |
public static class LockCls { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
323 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
324 |
|
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
325 |
public static class LockCls2 { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
326 |
public synchronized void inline_synchronized_testMethod(TestCaseBase testCase) { |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
327 |
testCase.dontinline_endlessLoop(); |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
328 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
329 |
} |
5185bc8dcbb1
8230677: Should disable Escape Analysis if JVMTI capability can_get_owned_monitor_info was taken
rrich
parents:
diff
changeset
|
330 |
} |