# HG changeset patch # User Doug Simon # Date 1453325450 -3600 # Node ID 5538acafd12f67f729372887813a1cc1acbdd8f9 # Parent b2223a89bd229cde66133132fe30a809af7ed5bf support for jdk.internal.misc.VM (jdk9) as well as sun.misc.VM (< jdk9) diff -r b2223a89bd22 -r 5538acafd12f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompilerFactory.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompilerFactory.java Wed Jan 20 10:54:25 2016 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompilerFactory.java Wed Jan 20 22:30:50 2016 +0100 @@ -40,7 +40,6 @@ import jdk.vm.ci.runtime.JVMCICompilerFactory; import jdk.vm.ci.runtime.JVMCIRuntime; import jdk.vm.ci.services.Services; -import sun.misc.VM; import com.oracle.graal.options.GraalJarsOptionDescriptorsProvider; import com.oracle.graal.options.Option; @@ -105,7 +104,7 @@ } /** - * Parses the options in the file denoted by the {@linkplain VM#getSavedProperty(String) saved} + * Parses the options in the file denoted by the {@code VM.getSavedProperty(String) saved} * system property named {@value HotSpotGraalCompilerFactory#GRAAL_OPTIONS_FILE_PROPERTY_NAME} * if the file exists followed by the options encoded in saved system properties whose names * start with {@code "graal.option."}. Key/value pairs are parsed from the file denoted by @@ -140,7 +139,7 @@ } } - Properties savedProps = getSavedProperties(); + Properties savedProps = getSavedProperties(jdk8OrEarlier); Map optionSettings = new HashMap<>(); for (Map.Entry e : savedProps.entrySet()) { @@ -159,9 +158,11 @@ } } - private static Properties getSavedProperties() { + private static Properties getSavedProperties(boolean jdk8OrEarlier) { try { - Field savedPropsField = VM.class.getDeclaredField("savedProps"); + String vmClassName = jdk8OrEarlier ? "sun.misc.VM" : "jdk.internal.misc.VM"; + Class vmClass = Class.forName(vmClassName); + Field savedPropsField = vmClass.getDeclaredField("savedProps"); savedPropsField.setAccessible(true); return (Properties) savedPropsField.get(null); } catch (Exception e) {