1/* 2 * Copyright (c) 2011, 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 */ 23package org.graalvm.compiler.hotspot; 24 25import java.util.Map; 26 27import org.graalvm.compiler.api.runtime.GraalRuntime; 28import org.graalvm.compiler.core.CompilationWrapper.ExceptionAction; 29import org.graalvm.compiler.core.common.CompilationIdentifier; 30import org.graalvm.compiler.debug.DebugHandlersFactory; 31import org.graalvm.compiler.debug.DiagnosticsOutputDirectory; 32import org.graalvm.compiler.debug.DebugContext; 33import org.graalvm.compiler.hotspot.meta.HotSpotProviders; 34import org.graalvm.compiler.options.OptionValues; 35import org.graalvm.compiler.replacements.SnippetCounter.Group; 36import org.graalvm.compiler.runtime.RuntimeProvider; 37 38import jdk.vm.ci.code.TargetDescription; 39import jdk.vm.ci.meta.ResolvedJavaMethod; 40 41//JaCoCo Exclude 42 43/** 44 * Configuration information for the HotSpot Graal runtime. 45 */ 46public interface HotSpotGraalRuntimeProvider extends GraalRuntime, RuntimeProvider, Group.Factory { 47 48 default TargetDescription getTarget() { 49 return getHostBackend().getTarget(); 50 } 51 52 HotSpotProviders getHostProviders(); 53 54 @Override 55 default String getName() { 56 return getClass().getSimpleName(); 57 } 58 59 @Override 60 HotSpotBackend getHostBackend(); 61 62 GraalHotSpotVMConfig getVMConfig(); 63 64 /** 65 * Opens a debug context for compiling {@code compilable}. The {@link DebugContext#close()} 66 * method should be called on the returned object once the compilation is finished. 67 * 68 * @param compilationOptions the options used to configure the compilation debug context 69 * @param compilationId a system wide unique compilation id 70 * @param compilable the input to the compilation 71 */ 72 DebugContext openDebugContext(OptionValues compilationOptions, CompilationIdentifier compilationId, Object compilable, Iterable<DebugHandlersFactory> factories); 73 74 /** 75 * Gets the option values associated with this runtime. 76 */ 77 OptionValues getOptions(); 78 79 /** 80 * Gets the option values associated with this runtime that are applicable for a given method. 81 * 82 * @param forMethod the method we are seeking for options for 83 * @return the options applicable for compiling {@code method} 84 */ 85 OptionValues getOptions(ResolvedJavaMethod forMethod); 86 87 /** 88 * Determines if the VM is currently bootstrapping the JVMCI compiler. 89 */ 90 boolean isBootstrapping(); 91 92 /** 93 * This runtime has been requested to shutdown. 94 */ 95 boolean isShutdown(); 96 97 /** 98 * Gets a directory into which diagnostics such crash reports and dumps should be written. 99 */ 100 DiagnosticsOutputDirectory getOutputDirectory(); 101 102 /** 103 * Gets the map used to count compilation problems at each {@link ExceptionAction} level. 104 */ 105 Map<ExceptionAction, Integer> getCompilationProblemsPerAction(); 106} 107