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