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 com.oracle.graal.hotspot;
024
025import jdk.internal.jvmci.code.*;
026import jdk.internal.jvmci.code.stack.*;
027import jdk.internal.jvmci.hotspot.*;
028import jdk.internal.jvmci.meta.*;
029
030import com.oracle.graal.api.runtime.*;
031import com.oracle.graal.hotspot.meta.*;
032import com.oracle.graal.runtime.*;
033
034//JaCoCo Exclude
035
036/**
037 * Configuration information for the HotSpot Graal runtime.
038 */
039public interface HotSpotGraalRuntimeProvider extends GraalRuntime, RuntimeProvider, StackIntrospection {
040
041    HotSpotJVMCIRuntimeProvider getJVMCIRuntime();
042
043    default HotSpotVMConfig getConfig() {
044        return getJVMCIRuntime().getConfig();
045    }
046
047    default TargetDescription getTarget() {
048        return getHostBackend().getTarget();
049    }
050
051    default CompilerToVM getCompilerToVM() {
052        return getJVMCIRuntime().getCompilerToVM();
053    }
054
055    /**
056     * Converts a name to a Java type. This method attempts to resolve {@code name} to a
057     * {@link ResolvedJavaType}.
058     *
059     * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format
060     * @param accessingType the context of resolution which must be non-null
061     * @param resolve specifies whether resolution failure results in an unresolved type being
062     *            return or a {@link LinkageError} being thrown
063     * @return a Java type for {@code name} which is guaranteed to be of type
064     *         {@link ResolvedJavaType} if {@code resolve == true}
065     * @throws LinkageError if {@code resolve == true} and the resolution failed
066     * @throws NullPointerException if {@code accessingClass} is {@code null}
067     */
068    default JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve) {
069        return getJVMCIRuntime().lookupType(name, accessingType, resolve);
070    }
071
072    HotSpotProviders getHostProviders();
073
074    default String getName() {
075        return getClass().getSimpleName();
076    }
077
078    HotSpotBackend getHostBackend();
079
080    /**
081     * Gets the Graal mirror for a {@link Class} object.
082     *
083     * @return the {@link ResolvedJavaType} corresponding to {@code javaClass}
084     */
085    ResolvedJavaType fromClass(Class<?> clazz);
086}