< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java

Print this page




  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.hotspot;
  26 
  27 import java.util.Formatter;
  28 
  29 /**
  30  * Mechanism for checking that the current Java runtime environment supports the minimum JVMCI API
  31  * required by Graal. The {@code JVMCI_VERSION_CHECK} environment variable can be used to ignore a
  32  * failed check ({@code JVMCI_VERSION_CHECK=ignore}) or print a warning (
  33  * {@code JVMCI_VERSION_CHECK=warn}) and continue. Otherwise, a failed check results in an
  34  * {@link InternalError} being raised or, if called from {@link #main(String[])}, the VM exiting
  35  * with a result code of {@code -1}
  36  *
  37  * This class only depends on the JDK so that it can be used without building Graal.
  38  */
  39 class JVMCIVersionCheck {
  40 

  41     private static final int JVMCI8_MIN_MAJOR_VERSION = 0;
  42     private static final int JVMCI8_MIN_MINOR_VERSION = 46;
  43 
  44     private static void failVersionCheck(boolean exit, String reason, Object... args) {
  45         Formatter errorMessage = new Formatter().format(reason, args);
  46         String javaHome = System.getProperty("java.home");
  47         String vmName = System.getProperty("java.vm.name");
  48         errorMessage.format("Set the JVMCI_VERSION_CHECK environment variable to \"ignore\" to suppress ");
  49         errorMessage.format("this error or to \"warn\" to emit a warning and continue execution.%n");
  50         errorMessage.format("Currently used Java home directory is %s.%n", javaHome);
  51         errorMessage.format("Currently used VM configuration is: %s%n", vmName);
  52         if (System.getProperty("java.specification.version").compareTo("1.9") < 0) {
  53             errorMessage.format("Download the latest JVMCI JDK 8 from http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html");
  54         } else {
  55             errorMessage.format("Download JDK 11 or later.");
  56         }
  57         String value = System.getenv("JVMCI_VERSION_CHECK");
  58         if ("warn".equals(value)) {
  59             System.err.println(errorMessage.toString());
  60         } else if ("ignore".equals(value)) {
  61             return;
  62         } else if (exit) {




  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.hotspot;
  26 
  27 import java.util.Formatter;
  28 
  29 /**
  30  * Mechanism for checking that the current Java runtime environment supports the minimum JVMCI API
  31  * required by Graal. The {@code JVMCI_VERSION_CHECK} environment variable can be used to ignore a
  32  * failed check ({@code JVMCI_VERSION_CHECK=ignore}) or print a warning (
  33  * {@code JVMCI_VERSION_CHECK=warn}) and continue. Otherwise, a failed check results in an
  34  * {@link InternalError} being raised or, if called from {@link #main(String[])}, the VM exiting
  35  * with a result code of {@code -1}
  36  *
  37  * This class only depends on the JDK so that it can be used without building Graal.
  38  */
  39 class JVMCIVersionCheck {
  40 
  41     // 0.55 introduces new HotSpotSpeculationLog API
  42     private static final int JVMCI8_MIN_MAJOR_VERSION = 0;
  43     private static final int JVMCI8_MIN_MINOR_VERSION = 55;
  44 
  45     private static void failVersionCheck(boolean exit, String reason, Object... args) {
  46         Formatter errorMessage = new Formatter().format(reason, args);
  47         String javaHome = System.getProperty("java.home");
  48         String vmName = System.getProperty("java.vm.name");
  49         errorMessage.format("Set the JVMCI_VERSION_CHECK environment variable to \"ignore\" to suppress ");
  50         errorMessage.format("this error or to \"warn\" to emit a warning and continue execution.%n");
  51         errorMessage.format("Currently used Java home directory is %s.%n", javaHome);
  52         errorMessage.format("Currently used VM configuration is: %s%n", vmName);
  53         if (System.getProperty("java.specification.version").compareTo("1.9") < 0) {
  54             errorMessage.format("Download the latest JVMCI JDK 8 from http://www.oracle.com/technetwork/oracle-labs/program-languages/downloads/index.html");
  55         } else {
  56             errorMessage.format("Download JDK 11 or later.");
  57         }
  58         String value = System.getenv("JVMCI_VERSION_CHECK");
  59         if ("warn".equals(value)) {
  60             System.err.println(errorMessage.toString());
  61         } else if ("ignore".equals(value)) {
  62             return;
  63         } else if (exit) {


< prev index next >