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