Mercurial > hg > graal-compiler
changeset 9542:8a6bd04d9510
CheckCastNode: add test for load field vialoation
a field access must be guarded by a cast
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Fri, 03 May 2013 15:29:26 +0200 |
parents | 4bd247fc3625 |
children | f8a5f7f7d0bd |
files | graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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<StructuredGraph>() {