Mercurial > hg > graal-jvmci-8
changeset 23340:22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Fri, 01 Apr 2016 10:32:24 -0700 |
parents | 13d0e0a9410e |
children | 67c84a8b19cc |
files | jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Assumptions.java jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java |
diffstat | 3 files changed, 20 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Thu Mar 31 10:21:27 2016 -0700 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java Fri Apr 01 10:32:24 2016 -0700 @@ -169,6 +169,10 @@ @Override public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() { + if (isLeaf()) { + // No assumptions are required. + return new AssumptionResult<>(this); + } HotSpotVMConfig config = config(); if (isArray()) { ResolvedJavaType elementalType = getElementalType(); @@ -206,8 +210,7 @@ } return null; } - - return new AssumptionResult<>(implementor, new LeafType(implementor), new ConcreteSubtype(this, implementor)); + return concreteSubtype(implementor); } else { HotSpotResolvedObjectTypeImpl type = this; while (type.isAbstract()) { @@ -221,7 +224,7 @@ return null; } if (this.isAbstract()) { - return new AssumptionResult<>(type, new LeafType(type), new ConcreteSubtype(this, type)); + return concreteSubtype(type); } else { assert this.equals(type); return new AssumptionResult<>(type, new LeafType(type)); @@ -229,6 +232,14 @@ } } + private AssumptionResult<ResolvedJavaType> concreteSubtype(HotSpotResolvedObjectTypeImpl type) { + if (type.isLeaf()) { + return new AssumptionResult<>(type, new ConcreteSubtype(this, type)); + } else { + return new AssumptionResult<>(type, new LeafType(type), new ConcreteSubtype(this, type)); + } + } + /** * Returns if type {@code type} is a leaf class. This is the case if the * {@code Klass::_subklass} field of the underlying class is zero.
--- a/jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Assumptions.java Thu Mar 31 10:21:27 2016 -0700 +++ b/jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Assumptions.java Fri Apr 01 10:32:24 2016 -0700 @@ -44,7 +44,10 @@ /** * A class for providing information that is only valid in association with a set of - * {@link Assumption}s. + * {@link Assumption}s. It is permissible for AssumptionResults to have no any assumptions at + * all. For instance, if {@link ResolvedJavaType#isLeaf()} returns true for a type + * {@link ResolvedJavaType#findLeafConcreteSubtype()} can return an AssumptionResult with no + * assumptions since the leaf information is statically true. * * @param <T> */ @@ -187,6 +190,7 @@ public final ResolvedJavaType context; public LeafType(ResolvedJavaType context) { + assert !context.isLeaf() : "assumption isn't required for leaf types"; this.context = context; }
--- a/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Thu Mar 31 10:21:27 2016 -0700 +++ b/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java Fri Apr 01 10:32:24 2016 -0700 @@ -295,6 +295,7 @@ } else { assertTrue(leafConcreteSubtype.getResult().equals(expected)); } + assertTrue(!type.isLeaf() || leafConcreteSubtype.isAssumptionFree()); } if (!type.isArray()) {