You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
case1: returnnewString[] { // C2 only. (Make sure the tests are correctly written)
72
+
"-XX:TieredStopAtLevel=4",
73
+
"-XX:-TieredCompilation",
74
+
"-XX:-OmitStackTraceInFastThrow",
75
+
};
76
+
case2: returnnewString[] { // interpreter only
77
+
"-Xint",
78
+
};
79
+
case3: returnnewString[] {
80
+
// Xcomp Only C1.
81
+
"-XX:TieredStopAtLevel=1",
82
+
"-XX:+TieredCompilation",
83
+
"-Xcomp",
84
+
};
85
+
case4: returnnewString[] {
86
+
// Xcomp Only C2.
87
+
"-XX:TieredStopAtLevel=4",
88
+
"-XX:-TieredCompilation",
89
+
"-XX:-OmitStackTraceInFastThrow",
90
+
"-Xcomp",
91
+
};
92
+
}
93
+
returnnull;
94
+
}
95
+
96
+
// Simple chain of getfields ending with primitive field
97
+
@Test(compLevel=C1)
98
+
publicinttest1() {
99
+
returnNamedRectangle.getP1X(newNamedRectangle());
100
+
}
101
+
102
+
@DontCompile
103
+
publicvoidtest1_verifier(booleanwarmup) {
104
+
intres = test1();
105
+
Asserts.assertEQ(res, 4);
106
+
}
107
+
108
+
// Simple chain of getfields ending with a flattened field
109
+
@Test(compLevel=C1)
110
+
publicPointtest2() {
111
+
returnNamedRectangle.getP1(newNamedRectangle());
112
+
}
113
+
114
+
@DontCompile
115
+
publicvoidtest2_verifier(booleanwarmup) {
116
+
Pointp = test2();
117
+
Asserts.assertEQ(p.x, 4);
118
+
Asserts.assertEQ(p.y, 7);
119
+
}
120
+
121
+
// Chain of getfields but the initial receiver is null
122
+
@Test(compLevel=C1)
123
+
publicNullPointerExceptiontest3() {
124
+
NullPointerExceptionnpe = null;
125
+
try {
126
+
NamedRectangle.getP1X(null);
127
+
} catch(NullPointerExceptione) {
128
+
npe = e;
129
+
}
130
+
returnnpe;
131
+
}
132
+
133
+
@DontCompile
134
+
publicvoidtest3_verifier(booleanwarmup) {
135
+
NullPointerExceptionnpe = test3();
136
+
Asserts.assertNE(npe, null);
137
+
StackTraceElementst = npe.getStackTrace()[0];
138
+
Asserts.assertEQ(st.getMethodName(), "getP1X");
139
+
Asserts.assertEQ(st.getLineNumber(), 31); // line number depends on file NamedRectangle.java
140
+
}
141
+
142
+
// Chain of getfields but one getfield in the middle of the chain trigger an illegal access
143
+
@Test(compLevel=C1)
144
+
publicIllegalAccessErrortest4() {
145
+
IllegalAccessErroriae = null;
146
+
try {
147
+
inti = NamedRectangleP.getP1X(newNamedRectangleP());
148
+
} catch(IllegalAccessErrore) {
149
+
iae = e;
150
+
}
151
+
returniae;
152
+
}
153
+
154
+
@DontCompile
155
+
publicvoidtest4_verifier(booleanwarmup) {
156
+
IllegalAccessErroriae = test4();
157
+
Asserts.assertNE(iae, null);
158
+
StackTraceElementst = iae.getStackTrace()[0];
159
+
Asserts.assertEQ(st.getMethodName(), "getP1X");
160
+
Asserts.assertEQ(st.getLineNumber(), 31); // line number depends on jcod file generated from NamedRectangle.java
161
+
Asserts.assertTrue(iae.getMessage().contains("class compiler.valhalla.inlinetypes.NamedRectangleP tried to access private field compiler.valhalla.inlinetypes.RectangleP.p1"));
162
+
}
163
+
164
+
// Chain of getfields but the last getfield trigger a NoSuchFieldError
165
+
@Test(compLevel=C1)
166
+
publicNoSuchFieldErrortest5() {
167
+
NoSuchFieldErrornsfe = null;
168
+
try {
169
+
inti = NamedRectangleN.getP1X(newNamedRectangleN());
170
+
} catch(NoSuchFieldErrore) {
171
+
nsfe = e;
172
+
}
173
+
returnnsfe;
174
+
}
175
+
176
+
@DontCompile
177
+
publicvoidtest5_verifier(booleanwarmup) {
178
+
NoSuchFieldErrornsfe = test5();
179
+
Asserts.assertNE(nsfe, null);
180
+
StackTraceElementst = nsfe.getStackTrace()[0];
181
+
Asserts.assertEQ(st.getMethodName(), "getP1X");
182
+
Asserts.assertEQ(st.getLineNumber(), 31); // line number depends on jcod file generated from NamedRectangle.java
0 commit comments