# HG changeset patch # User Doug Simon # Date 1373031650 -7200 # Node ID b288e775e56b726e3a1963b8cf9f29f68011bb53 # Parent eeb80dcd60d850a3bc2e12be397d3ea4a18e1318 added extra test for guarded inlining diff -r eeb80dcd60d8 -r b288e775e56b graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Thu Jul 04 15:30:38 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Fri Jul 05 15:40:50 2013 +0200 @@ -127,6 +127,45 @@ fields.subClassBField.publicOverriddenMethod() + fields.subClassCField.publicOverriddenMethod(); } + public interface Attributes { + + int getLength(); + } + + public class NullAttributes implements Attributes { + + @Override + public int getLength() { + return 0; + } + + } + + public class TenAttributes implements Attributes { + + @Override + public int getLength() { + return 10; + } + + } + + public int getAttributesLength(Attributes a) { + return a.getLength(); + } + + @Test + public void testGuardedInline() { + NullAttributes nullAttributes = new NullAttributes(); + for (int i = 0; i < 10000; i++) { + getAttributesLength(nullAttributes); + } + getAttributesLength(new TenAttributes()); + + test("getAttributesLength", nullAttributes); + test("getAttributesLength", (Object) null); + } + @Test public void testClassHierarchyAnalysis() { assertInlined(getGraph("invokeLeafClassMethodSnippet", false));