comparison 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
comparison
equal deleted inserted replaced
23666:3fa6348084a0 23667:f60746f36f3f
21 * questions. 21 * questions.
22 */ 22 */
23 package jdk.vm.ci.hotspot; 23 package jdk.vm.ci.hotspot;
24 24
25 /** 25 /**
26 * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object. 26 * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object that
27 * requires GC interaction to keep alive.
27 * 28 *
28 * It would preferable if this were the base class containing the pointer but that would require 29 * It would preferable if this were the base class containing the pointer but that would require
29 * mixins since most of the wrapper types have complex supertype hierarchies. 30 * mixins since most of the wrapper types have complex supertype hierarchies.
30 */ 31 */
31 interface MetaspaceWrapperObject { 32 interface MetaspaceWrapperObject {
32 33
33 long getMetaspacePointer(); 34 long getMetaspacePointer();
35
36 /**
37 * Check if this object is properly registered for metadata tracking. All classes which
38 * implement this interface must be registered with the
39 * {@link HotSpotJVMCIMetaAccessContext#add} unless they are kept alive through other means.
40 * Currently the only type which doesn't require explicit registration is
41 * {@link HotSpotResolvedObjectTypeImpl} since it's kept alive by references to the
42 * {@link Class}.
43 *
44 * @return true if this object is properly registered for meta data tracking.
45 */
46 default boolean isRegistered() {
47 return HotSpotJVMCIRuntime.runtime().metaAccessContext.isRegistered(this);
48 }
34 } 49 }