src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/MetaspaceWrapperObject.java
branchJDK-8200758-branch
changeset 57350 bf3d37105ef9
parent 57349 c6cd128bf0cd
parent 54711 297ddf282627
child 57352 51709d9aab69
equal deleted inserted replaced
57349:c6cd128bf0cd 57350:bf3d37105ef9
     1 /*
       
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 package jdk.vm.ci.hotspot;
       
    24 
       
    25 /**
       
    26  * A tag interface indicating that this type is a wrapper around a HotSpot metaspace object that
       
    27  * requires GC interaction to keep alive.
       
    28  *
       
    29  * It would preferable if this were the base class containing the pointer but that would require
       
    30  * mixins since most of the wrapper types have complex supertype hierarchies.
       
    31  */
       
    32 interface MetaspaceWrapperObject {
       
    33 
       
    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     }
       
    49 }