Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java @ 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 | a3471785190d |
children | 7ae6a635fad0 |
comparison
equal
deleted
inserted
replaced
23339:13d0e0a9410e | 23340:22c3bdf28fff |
---|---|
167 return javaComponentType == null ? null : runtime().fromClass(javaComponentType); | 167 return javaComponentType == null ? null : runtime().fromClass(javaComponentType); |
168 } | 168 } |
169 | 169 |
170 @Override | 170 @Override |
171 public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() { | 171 public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() { |
172 if (isLeaf()) { | |
173 // No assumptions are required. | |
174 return new AssumptionResult<>(this); | |
175 } | |
172 HotSpotVMConfig config = config(); | 176 HotSpotVMConfig config = config(); |
173 if (isArray()) { | 177 if (isArray()) { |
174 ResolvedJavaType elementalType = getElementalType(); | 178 ResolvedJavaType elementalType = getElementalType(); |
175 AssumptionResult<ResolvedJavaType> elementType = elementalType.findLeafConcreteSubtype(); | 179 AssumptionResult<ResolvedJavaType> elementType = elementalType.findLeafConcreteSubtype(); |
176 if (elementType != null && elementType.getResult().equals(elementalType)) { | 180 if (elementType != null && elementType.getResult().equals(elementalType)) { |
204 newResult.add(leafConcreteSubtype); | 208 newResult.add(leafConcreteSubtype); |
205 return newResult; | 209 return newResult; |
206 } | 210 } |
207 return null; | 211 return null; |
208 } | 212 } |
209 | 213 return concreteSubtype(implementor); |
210 return new AssumptionResult<>(implementor, new LeafType(implementor), new ConcreteSubtype(this, implementor)); | |
211 } else { | 214 } else { |
212 HotSpotResolvedObjectTypeImpl type = this; | 215 HotSpotResolvedObjectTypeImpl type = this; |
213 while (type.isAbstract()) { | 216 while (type.isAbstract()) { |
214 HotSpotResolvedObjectTypeImpl subklass = type.getSubklass(); | 217 HotSpotResolvedObjectTypeImpl subklass = type.getSubklass(); |
215 if (subklass == null || UNSAFE.getAddress(subklass.getMetaspaceKlass() + config.nextSiblingOffset) != 0) { | 218 if (subklass == null || UNSAFE.getAddress(subklass.getMetaspaceKlass() + config.nextSiblingOffset) != 0) { |
219 } | 222 } |
220 if (type.isAbstract() || type.isInterface() || !type.isLeafClass()) { | 223 if (type.isAbstract() || type.isInterface() || !type.isLeafClass()) { |
221 return null; | 224 return null; |
222 } | 225 } |
223 if (this.isAbstract()) { | 226 if (this.isAbstract()) { |
224 return new AssumptionResult<>(type, new LeafType(type), new ConcreteSubtype(this, type)); | 227 return concreteSubtype(type); |
225 } else { | 228 } else { |
226 assert this.equals(type); | 229 assert this.equals(type); |
227 return new AssumptionResult<>(type, new LeafType(type)); | 230 return new AssumptionResult<>(type, new LeafType(type)); |
228 } | 231 } |
232 } | |
233 } | |
234 | |
235 private AssumptionResult<ResolvedJavaType> concreteSubtype(HotSpotResolvedObjectTypeImpl type) { | |
236 if (type.isLeaf()) { | |
237 return new AssumptionResult<>(type, new ConcreteSubtype(this, type)); | |
238 } else { | |
239 return new AssumptionResult<>(type, new LeafType(type), new ConcreteSubtype(this, type)); | |
229 } | 240 } |
230 } | 241 } |
231 | 242 |
232 /** | 243 /** |
233 * Returns if type {@code type} is a leaf class. This is the case if the | 244 * Returns if type {@code type} is a leaf class. This is the case if the |