< prev index next >
src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java
Print this page
@@ -130,14 +130,24 @@
return UNSAFE.getLong(javaClass, config().klassOffset);
}
return UNSAFE.getInt(javaClass, config().klassOffset) & 0xFFFFFFFFL;
}
+ @Override
public long getMetaspacePointer() {
return getMetaspaceKlass();
}
+ /**
+ * The Klass* for this object is kept alive by the direct reference to {@link #javaClass} so no
+ * extra work is required.
+ */
+ @Override
+ public boolean isRegistered() {
+ return true;
+ }
+
@Override
public int getModifiers() {
if (isArray()) {
return (getElementalType().getModifiers() & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED)) | Modifier.FINAL | Modifier.ABSTRACT;
} else {
@@ -426,11 +436,17 @@
HotSpotResolvedObjectTypeImpl hotSpotCallerType = (HotSpotResolvedObjectTypeImpl) callerType;
return compilerToVM().resolveMethod(this, hotSpotMethod, hotSpotCallerType);
}
public HotSpotConstantPool getConstantPool() {
- if (constantPool == null) {
+ if (constantPool == null || !isArray() && UNSAFE.getAddress(getMetaspaceKlass() + config().instanceKlassConstantsOffset) != constantPool.getMetaspaceConstantPool()) {
+ /*
+ * If the pointer to the ConstantPool has changed since this was last read refresh the
+ * HotSpotConstantPool wrapper object. This ensures that uses of the constant pool are
+ * operating on the latest one and that HotSpotResolvedJavaMethodImpls will be able to
+ * use the shared copy instead of creating their own instance.
+ */
constantPool = compilerToVM().getConstantPool(this, config().instanceKlassConstantsOffset);
}
return constantPool;
}
< prev index next >