Mercurial > hg > graal-jvmci-8
diff jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java @ 23667:f60746f36f3f
Properly track HotSpotConstantPool as metadata and fix bug that cause metadata to be lost during unloading
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Mon, 06 Jun 2016 12:22:14 -0700 |
parents | 1bbd4a7c274b |
children | d995c88d9cd9 |
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java Thu Jun 02 15:25:22 2016 +0200 +++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java Mon Jun 06 12:22:14 2016 -0700 @@ -23,7 +23,8 @@ package jdk.vm.ci.hotspot; /** - * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object. + * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object that + * requires GC interaction to keep alive. * * It would preferable if this were the base class containing the pointer but that would require * mixins since most of the wrapper types have complex supertype hierarchies. @@ -31,4 +32,18 @@ interface MetaspaceWrapperObject { long getMetaspacePointer(); + + /** + * Check if this object is properly registered for metadata tracking. All classes which + * implement this interface must be registered with the + * {@link HotSpotJVMCIMetaAccessContext#add} unless they are kept alive through other means. + * Currently the only type which doesn't require explicit registration is + * {@link HotSpotResolvedObjectTypeImpl} since it's kept alive by references to the + * {@link Class}. + * + * @return true if this object is properly registered for meta data tracking. + */ + default boolean isRegistered() { + return HotSpotJVMCIRuntime.runtime().metaAccessContext.isRegistered(this); + } }