# HG changeset patch # User Bernhard Urban # Date 1367587766 -7200 # Node ID 8a6bd04d951015ec02782bf16949df93da986944 # Parent 4bd247fc3625796c1e4c497f0dcd90a2d5b228ab CheckCastNode: add test for load field vialoation a field access must be guarded by a cast diff -r 4bd247fc3625 -r 8a6bd04d9510 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java Fri May 03 14:57:01 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java Fri May 03 15:29:26 2013 +0200 @@ -91,6 +91,23 @@ compileSnippet("test4Snippet", 2, 2); } + public static long test5Snippet(A1 a1) { + long sum = 0; + A2 a2 = (A2) a1; + A3 a3 = (A3) a2; + sum += a2.x2; + return sum + a3.x3; + } + + @Ignore + @Test + public void test5() { + StructuredGraph graph = compileSnippet("test5Snippet", 2, 1); + for (LoadFieldNode lfn : graph.getNodes().filter(LoadFieldNode.class)) { + Assert.assertTrue(lfn.object() instanceof CheckCastNode); + } + } + private StructuredGraph compileSnippet(final String snippet, final int checkcasts, final int afterCanon) { return Debug.scope(snippet, new Callable() {