Skip to content

Commit a5dafac

Browse files
committed
Compiler tests: remove todo comment and update tests to new TryCatch API
1 parent 6c9beb7 commit a5dafac

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/truffle/test/BytecodeDSLCompilationTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import static com.oracle.truffle.api.bytecode.test.basic_interpreter.AbstractBasicInterpreterTest.parseNode;
2828
import static com.oracle.truffle.api.bytecode.test.basic_interpreter.AbstractBasicInterpreterTest.invokeNewConfigBuilder;
2929
import static org.junit.Assert.assertEquals;
30+
import static org.junit.Assert.fail;
3031

3132
import java.util.List;
3233

@@ -60,11 +61,15 @@ public static List<Class<? extends BasicInterpreter>> getInterpreterClasses() {
6061
@Override
6162
public void before() {
6263
super.before();
63-
// TODO without eager loading, the first compilation on some tests fails because this type
64-
// is not loaded
64+
/**
65+
* Note: we force load the EarlyReturnException class because compilation bails out when it
66+
* hasn't been loaded (the {@code interceptControlFlowException} method references it
67+
* directly).
68+
*/
6569
try {
6670
Class.forName(BasicInterpreter.EarlyReturnException.class.getName());
6771
} catch (ClassNotFoundException ex) {
72+
fail("should not have failed to load EarlyReturnException class");
6873
}
6974
}
7075

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/truffle/test/BytecodeDSLPartialEvaluationTest.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,7 @@ public void testTryCatch() {
203203
BasicInterpreter root = parseNodeForPE(interpreterClass, "sum", b -> {
204204
b.beginRoot(LANGUAGE);
205205

206-
BytecodeLocal ex = b.createLocal();
207-
208-
b.beginTryCatch(ex);
206+
b.beginTryCatch();
209207

210208
b.beginThrowOperation();
211209
b.emitLoadConstant(1L);
@@ -215,7 +213,7 @@ public void testTryCatch() {
215213
b.beginAddOperation();
216214

217215
b.beginReadExceptionOperation();
218-
b.emitLoadLocal(ex);
216+
b.emitLoadException();
219217
b.endReadExceptionOperation();
220218

221219
b.emitLoadConstant(1L);
@@ -253,11 +251,9 @@ public void testTryCatch2() {
253251
BasicInterpreter root = parseNodeForPE(interpreterClass, "sum", b -> {
254252
b.beginRoot(LANGUAGE);
255253

256-
BytecodeLocal ex = b.createLocal();
257-
258-
b.beginTryCatch(ex);
254+
b.beginTryCatch();
259255

260-
b.beginTryCatch(ex);
256+
b.beginTryCatch();
261257

262258
b.beginThrowOperation();
263259
b.emitLoadConstant(1L);
@@ -266,7 +262,7 @@ public void testTryCatch2() {
266262
b.beginThrowOperation();
267263
b.beginAddOperation();
268264
b.beginReadExceptionOperation();
269-
b.emitLoadLocal(ex);
265+
b.emitLoadException();
270266
b.endReadExceptionOperation();
271267
b.emitLoadConstant(1L);
272268
b.endAddOperation();
@@ -278,7 +274,7 @@ public void testTryCatch2() {
278274
b.beginAddOperation();
279275

280276
b.beginReadExceptionOperation();
281-
b.emitLoadLocal(ex);
277+
b.emitLoadException();
282278
b.endReadExceptionOperation();
283279

284280
b.emitLoadConstant(1L);

0 commit comments

Comments
 (0)