001/*
002 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package jdk.internal.jvmci.hotspot;
024
025import jdk.internal.jvmci.meta.*;
026import jdk.internal.jvmci.meta.Assumptions.*;
027
028/**
029 * Implementation of {@link JavaType} for resolved non-primitive HotSpot classes.
030 */
031public interface HotSpotResolvedObjectType extends ResolvedJavaType {
032
033    HotSpotResolvedObjectType getArrayClass();
034
035    ResolvedJavaType getComponentType();
036
037    AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype();
038
039    HotSpotResolvedObjectType getSuperclass();
040
041    HotSpotResolvedObjectType[] getInterfaces();
042
043    HotSpotResolvedObjectType getSupertype();
044
045    HotSpotResolvedObjectType findLeastCommonAncestor(ResolvedJavaType otherType);
046
047    HotSpotResolvedObjectType asExactType();
048
049    default boolean isPrimitive() {
050        return false;
051    }
052
053    default Kind getKind() {
054        return Kind.Object;
055    }
056
057    ConstantPool constantPool();
058
059    /**
060     * Gets the instance size of this type. If an instance of this type cannot be fast path
061     * allocated, then the returned value is negative (its absolute value gives the size). Must not
062     * be called if this is an array or interface type.
063     */
064    int instanceSize();
065
066    int getVtableLength();
067
068    @Override
069    AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method);
070
071    /**
072     * Performs a fast-path check that this type is resolved in the context of a given accessing
073     * class. A negative result does not mean this type is not resolved with respect to
074     * {@code accessingClass}. That can only be determined by
075     * {@linkplain HotSpotJVMCIRuntime#lookupType(String, HotSpotResolvedObjectType, boolean)
076     * re-resolving} the type.
077     */
078    boolean isDefinitelyResolvedWithRespectTo(ResolvedJavaType accessingClass);
079
080    /**
081     * Gets the metaspace Klass boxed in a {@link JavaConstant}.
082     */
083    Constant klass();
084
085    boolean isPrimaryType();
086
087    int superCheckOffset();
088
089    long prototypeMarkWord();
090
091    int layoutHelper();
092
093    HotSpotResolvedObjectType getEnclosingType();
094
095    ResolvedJavaMethod getClassInitializer();
096
097    ResolvedJavaField createField(String name, JavaType type, long offset, int modifiers);
098}