Skip to content

Commit fddc02e

Browse files
author
Tom Rodriguez
committed
8321225: [JVMCI] HotSpotResolvedObjectTypeImpl.isLeafClass shouldn't create strong references
Reviewed-by: thartmann, eosterlund, kvn
1 parent 640d7f3 commit fddc02e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,12 @@ private AssumptionResult<ResolvedJavaType> concreteSubtype(HotSpotResolvedObject
265265
* @return true if the type is a leaf class
266266
*/
267267
private boolean isLeafClass() {
268-
return compilerToVM().getResolvedJavaType(this, config().subklassOffset, false) == null;
268+
// In general, compilerToVM().getResolvedJavaType should always be used to read a Klass*
269+
// from HotSpot data structures but that has the side effect of creating a strong reference
270+
// to the Class which we do not want since it can cause class unloading problems. Since
271+
// this code is only checking for null vs non-null so it should be safe to perform this
272+
// check directly.
273+
return UNSAFE.getLong(this.getKlassPointer() + config().subklassOffset) == 0;
269274
}
270275

271276
/**

0 commit comments

Comments
 (0)