Mercurial > hg > graal-compiler
changeset 10633:b288e775e56b
added extra test for guarded inlining
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 05 Jul 2013 15:40:50 +0200 |
parents | eeb80dcd60d8 |
children | ae12060a0f7d |
files | graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java |
diffstat | 1 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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));