changeset 23284:8257baff2f0d

Merge
author Christian Wimmer <christian.wimmer@oracle.com>
date Fri, 08 Jan 2016 17:46:00 -0800
parents c98de39fd944 (current diff) 92fce0754cc5 (diff)
children 3b75fbfda415
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippetsOptions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippetsOptions.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPlugin.java
diffstat 27 files changed, 267 insertions(+), 279 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Fri Jan 08 17:46:00 2016 -0800
@@ -302,12 +302,15 @@
     @Option(help = "Generate SSA LIR.", type = OptionType.Debug)
     public static final OptionValue<Boolean> SSA_LIR = new OptionValue<>(true);
 
-    /**
-     * Counts the various paths taken through snippets.
-     */
-    @Option(help = "", type = OptionType.Debug)
+    @Option(help = "Enable counters for various paths in snippets.", type = OptionType.Debug)
     public static final OptionValue<Boolean> SnippetCounters = new OptionValue<>(false);
 
+    @Option(help = "Eagerly construct extra snippet info.", type = OptionType.Debug)
+    public static final OptionValue<Boolean> EagerSnippets = new OptionValue<>(false);
+
+    @Option(help = "Use a cache for snippet graphs.", type = OptionType.Debug)
+    public static final OptionValue<Boolean> UseSnippetGraphCache = new OptionValue<>(true);
+
     @Option(help = "Enable expensive assertions", type = OptionType.Debug)
     public static final OptionValue<Boolean> DetailedAsserts = new StableOptionValue<Boolean>() {
         @Override
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Fingerprint.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Fingerprint.java	Fri Jan 08 17:46:00 2016 -0800
@@ -28,18 +28,28 @@
 import java.util.List;
 import java.util.stream.Collectors;
 
+import com.oracle.graal.options.Option;
+import com.oracle.graal.options.OptionValue;
+
 /**
  * Facility for fingerprinting execution.
  */
 public class Fingerprint implements AutoCloseable {
 
-    public static final String ENABLED_PROPERTY_NAME = "jvmci.fingerprint";
+    public static class Options {
+        @Option(help = "Enables execution fingerprinting.")//
+        public static final OptionValue<Boolean> UseFingerprinting = new OptionValue<>(false);
+
+        @Option(help = "Fingerprinting event at which to execute breakpointable code.")//
+        public static final OptionValue<Integer> FingerprintingBreakpointEvent = new OptionValue<>(-1);
+    }
+
+    // public static final String ENABLED_PROPERTY_NAME = "jvmci.fingerprint";
 
     /**
-     * Determines whether fingerprinting is enabled. This is set by the
-     * {@value #ENABLED_PROPERTY_NAME} system property when this class is initialized.
+     * Determines whether fingerprinting is enabled.
      */
-    public static final boolean ENABLED = Boolean.getBoolean(ENABLED_PROPERTY_NAME);
+    public static final boolean ENABLED = Options.UseFingerprinting.getValue();
 
     private static final ThreadLocal<Fingerprint> current = ENABLED ? new ThreadLocal<>() : null;
 
@@ -100,14 +110,14 @@
         }
     }
 
-    private static final int BREAKPOINT_EVENT = Integer.getInteger(ENABLED_PROPERTY_NAME + ".breakpointEvent", -1);
+    private static final int BREAKPOINT_EVENT = Options.FingerprintingBreakpointEvent.getValue();
 
     /**
      * Submits an execution event for the purpose of recording or verifying a fingerprint. This must
      * only be called if {@link #ENABLED} is {@code true}.
      */
     public static void submit(String format, Object... args) {
-        assert ENABLED : "fingerprinting must be enabled (-D" + ENABLED_PROPERTY_NAME + "=true)";
+        assert ENABLED : "fingerprinting must be enabled (-G:+" + Options.UseFingerprinting.getName() + ")";
         Fingerprint fingerprint = current.get();
         if (fingerprint != null) {
             int eventId = fingerprint.nextEventId();
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Fri Jan 08 17:46:00 2016 -0800
@@ -55,6 +55,10 @@
         public static final OptionValue<Boolean> VerifyGraalGraphs = new OptionValue<>(true);
         @Option(help = "Perform expensive verification of graph inputs, usages, successors and predecessors", type = OptionType.Debug)//
         public static final OptionValue<Boolean> VerifyGraalGraphEdges = new OptionValue<>(false);
+        @Option(help = "Graal graph compression is performed when percent of live nodes falls below this value", type = OptionType.Debug)//
+        public static final OptionValue<Integer> GraphCompressionThreshold = new OptionValue<>(70);
+        @Option(help = "Use Unsafe to clone graph nodes thus avoiding copying fields that will be re-initialized anyway", type = OptionType.Debug)//
+        public static final OptionValue<Boolean> CloneNodesWithUnsafe = new OptionValue<>(true);
     }
 
     public final String name;
@@ -751,11 +755,7 @@
 
     static final Node PLACE_HOLDER = new PlaceHolderNode();
 
-    /**
-     * When the percent of live nodes in {@link #nodes} fall below this number, a call to
-     * {@link #maybeCompress()} will actually do compression.
-     */
-    public static final int COMPRESSION_THRESHOLD = Integer.getInteger("graal.graphCompressionThreshold", 70);
+    public static final int COMPRESSION_THRESHOLD = Options.GraphCompressionThreshold.getValue();
 
     private static final DebugMetric GraphCompressions = Debug.metric("GraphCompressions");
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Fri Jan 08 17:46:00 2016 -0800
@@ -100,7 +100,7 @@
 public abstract class Node implements Cloneable, Formattable {
 
     public static final NodeClass<?> TYPE = null;
-    public static final boolean USE_UNSAFE_TO_CLONE = Boolean.parseBoolean(System.getProperty("graal.node.useUnsafeToClone", "true"));
+    public static final boolean USE_UNSAFE_TO_CLONE = Graph.Options.CloneNodesWithUnsafe.getValue();
 
     static final int DELETED_ID_START = -1000000000;
     static final int INITIAL_ID = -1;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompilerFactory.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompilerFactory.java	Fri Jan 08 17:46:00 2016 -0800
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.hotspot;
 
+import static com.oracle.graal.options.OptionValue.PROFILE_OPTIONVALUE_PROPERTY_NAME;
 import static jdk.vm.ci.inittimer.InitTimer.timer;
 
 import java.io.File;
@@ -50,6 +51,25 @@
 
 public abstract class HotSpotGraalCompilerFactory implements JVMCICompilerFactory {
 
+    /**
+     * The name of the system property specifying a file containing extra Graal option settings.
+     */
+    private static final String GRAAL_OPTIONS_FILE_PROPERTY_NAME = "graal.options.file";
+
+    /**
+     * The prefix for system properties that correspond to {@link Option} annotated fields. A field
+     * named {@code MyOption} will have its value set from a system property with the name
+     * {@code GRAAL_OPTION_PROPERTY_PREFIX + "MyOption"}.
+     */
+    public static final String GRAAL_OPTION_PROPERTY_PREFIX = "graal.option.";
+
+    /**
+     * Gets the system property assignment that would set the current value for a given option.
+     */
+    public static String asSystemPropertySetting(OptionValue<?> value) {
+        return GRAAL_OPTION_PROPERTY_PREFIX + value.getName() + "=" + value.getValue();
+    }
+
     static {
         initializeOptions();
     }
@@ -81,10 +101,10 @@
 
     /**
      * Parses the options in the file denoted by the {@linkplain VM#getSavedProperty(String) saved}
-     * system property named {@code "graal.options.file"} 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 {@code "graal.options.file"} with
-     * {@link Properties#load(java.io.Reader)}.
+     * 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
+     * {@code "graal.options.file"} with {@link Properties#load(java.io.Reader)}.
      */
     @SuppressWarnings("try")
     private static void initializeOptions() {
@@ -92,7 +112,7 @@
             boolean jdk8OrEarlier = System.getProperty("java.specification.version").compareTo("1.9") < 0;
             GraalJarsOptionDescriptorsProvider odp = jdk8OrEarlier ? GraalJarsOptionDescriptorsProvider.create() : null;
 
-            String optionsFile = System.getProperty("graal.options.file");
+            String optionsFile = System.getProperty(GRAAL_OPTIONS_FILE_PROPERTY_NAME);
 
             if (optionsFile != null) {
                 File graalOptions = new File(optionsFile);
@@ -120,9 +140,13 @@
             Map<String, String> optionSettings = new HashMap<>();
             for (Map.Entry<Object, Object> e : savedProps.entrySet()) {
                 String name = (String) e.getKey();
-                if (name.startsWith("graal.option.")) {
-                    String value = (String) e.getValue();
-                    optionSettings.put(name.substring("graal.option.".length()), value);
+                if (name.startsWith(GRAAL_OPTION_PROPERTY_PREFIX)) {
+                    if (name.equals(GRAAL_OPTIONS_FILE_PROPERTY_NAME) || name.equals(PROFILE_OPTIONVALUE_PROPERTY_NAME)) {
+                        // Ignore well known properties that do not denote an option
+                    } else {
+                        String value = (String) e.getValue();
+                        optionSettings.put(name.substring(GRAAL_OPTION_PROPERTY_PREFIX.length()), value);
+                    }
                 }
             }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Fri Jan 08 17:46:00 2016 -0800
@@ -76,7 +76,6 @@
 import com.oracle.graal.options.StableOptionValue;
 import com.oracle.graal.replacements.InlineDuringParsingPlugin;
 import com.oracle.graal.replacements.MethodHandlePlugin;
-import com.oracle.graal.replacements.NodeIntrinsificationPlugin;
 import com.oracle.graal.replacements.NodeIntrinsificationProvider;
 import com.oracle.graal.replacements.ReplacementsImpl;
 import com.oracle.graal.replacements.StandardGraphBuilderPlugins;
@@ -102,9 +101,8 @@
 
         Plugins plugins = new Plugins(invocationPlugins);
         NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, wordTypes);
-        NodeIntrinsificationPlugin nodeIntrinsificationPlugin = new NodeIntrinsificationPlugin();
         HotSpotWordOperationPlugin wordOperationPlugin = new HotSpotWordOperationPlugin(snippetReflection, wordTypes);
-        HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin, nodeIntrinsificationPlugin);
+        HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin);
 
         plugins.appendParameterPlugin(nodePlugin);
         plugins.appendNodePlugin(nodePlugin);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNodePlugin.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNodePlugin.java	Fri Jan 08 17:46:00 2016 -0800
@@ -31,9 +31,7 @@
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.ResolvedJavaType;
 
-import com.oracle.graal.api.replacements.Fold;
 import com.oracle.graal.compiler.common.type.Stamp;
-import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.nodes.ConstantNode;
 import com.oracle.graal.nodes.ValueNode;
 import com.oracle.graal.nodes.calc.FloatingNode;
@@ -41,7 +39,6 @@
 import com.oracle.graal.nodes.graphbuilderconf.InlineInvokePlugin;
 import com.oracle.graal.nodes.graphbuilderconf.NodePlugin;
 import com.oracle.graal.nodes.graphbuilderconf.ParameterPlugin;
-import com.oracle.graal.replacements.NodeIntrinsificationPlugin;
 import com.oracle.graal.replacements.WordOperationPlugin;
 import com.oracle.graal.word.Word;
 
@@ -55,24 +52,19 @@
  * necessary because HotSpot only uses the {@link Word} type in methods that are force-inlined,
  * i.e., there are never non-inlined invokes that involve the {@link Word} type.
  * <p>
- * Handling of {@link Fold} and {@link NodeIntrinsic} annotated methods, by forwarding to the
- * {@link NodeIntrinsificationPlugin} when parsing intrinsic functions.
- * <p>
  * Constant folding of field loads.
  */
 public final class HotSpotNodePlugin implements NodePlugin, ParameterPlugin {
     protected final WordOperationPlugin wordOperationPlugin;
-    protected final NodeIntrinsificationPlugin nodeIntrinsificationPlugin;
 
-    public HotSpotNodePlugin(WordOperationPlugin wordOperationPlugin, NodeIntrinsificationPlugin nodeIntrinsificationPlugin) {
+    public HotSpotNodePlugin(WordOperationPlugin wordOperationPlugin) {
         this.wordOperationPlugin = wordOperationPlugin;
-        this.nodeIntrinsificationPlugin = nodeIntrinsificationPlugin;
     }
 
     @Override
     public boolean canChangeStackKind(GraphBuilderContext b) {
         if (b.parsingIntrinsic()) {
-            return wordOperationPlugin.canChangeStackKind(b) || nodeIntrinsificationPlugin.canChangeStackKind(b);
+            return wordOperationPlugin.canChangeStackKind(b);
         }
         return false;
     }
@@ -90,9 +82,6 @@
         if (b.parsingIntrinsic() && wordOperationPlugin.handleInvoke(b, method, args)) {
             return true;
         }
-        if (b.parsingIntrinsic() && nodeIntrinsificationPlugin.handleInvoke(b, method, args)) {
-            return true;
-        }
         return false;
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotspotSnippetsOptions.java	Fri Jan 08 17:46:00 2016 -0800
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.replacements;
+
+import com.oracle.graal.options.Option;
+import com.oracle.graal.options.OptionType;
+import com.oracle.graal.options.OptionValue;
+
+/**
+ * Options related to HotSpot snippets in this package.
+ *
+ * Note: This must be a top level class to work around for <a
+ * href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=477597">Eclipse bug 477597</a>.
+ */
+class HotspotSnippetsOptions {
+
+    // @formatter:off
+    @Option(help = "If the probability that a type check will hit one the profiled types (up to " +
+                   "TypeCheckMaxHints) is below this value, the type check will be compiled without profiling info", type = OptionType.Expert)
+    static final OptionValue<Double> TypeCheckMinProfileHitProbability = new OptionValue<>(0.5);
+
+    @Option(help = "The maximum number of profiled types that will be used when compiling a profiled type check. " +
+                    "Note that TypeCheckMinProfileHitProbability also influences whether profiling info is used in compiled type checks.", type = OptionType.Expert)
+    static final OptionValue<Integer> TypeCheckMaxHints = new OptionValue<>(2);
+
+    @Option(help = "Use a VM runtime call to load and clear the exception object from the thread at the start of a compiled exception handler.", type = OptionType.Debug)
+    static final OptionValue<Boolean> LoadExceptionObjectInVM = new OptionValue<>(false);
+
+    @Option(help = "Enable profiling of allocation sites.", type = OptionType.Debug)
+    static final OptionValue<Boolean> ProfileAllocations = new OptionValue<>(false);
+
+    @Option(help = "Enable profiling of monitor operations.", type = OptionType.Debug)
+    static final OptionValue<Boolean> ProfileMonitors = new OptionValue<>(false);
+
+    @Option(help = "Trace monitor operations on objects whose type contains this substring.", type = OptionType.Debug)
+    static final OptionValue<String> TraceMonitorsTypeFilter = new OptionValue<>(null);
+
+    @Option(help = "Trace monitor operations in methods whose fully qualified name contains this substring.", type = OptionType.Debug)
+    static final OptionValue<String> TraceMonitorsMethodFilter = new OptionValue<>(null);
+
+    @Option(help = "Emit extra code to dynamically check monitor operations are balanced.", type = OptionType.Debug)
+    static final OptionValue<Boolean> VerifyBalancedMonitors = new OptionValue<>(false);
+    //@formatter:on
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java	Fri Jan 08 17:46:00 2016 -0800
@@ -25,8 +25,8 @@
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.PRIMARY_SUPERS_LOCATION;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.SECONDARY_SUPER_CACHE_LOCATION;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.loadHubIntrinsic;
-import static com.oracle.graal.hotspot.replacements.InstanceOfSnippetsOptions.TypeCheckMaxHints;
-import static com.oracle.graal.hotspot.replacements.InstanceOfSnippetsOptions.TypeCheckMinProfileHitProbability;
+import static com.oracle.graal.hotspot.replacements.HotspotSnippetsOptions.TypeCheckMaxHints;
+import static com.oracle.graal.hotspot.replacements.HotspotSnippetsOptions.TypeCheckMinProfileHitProbability;
 import static com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.checkSecondarySubType;
 import static com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.checkUnknownSubType;
 import static com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.createHints;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippetsOptions.java	Fri Jan 08 17:45:30 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.replacements;
-
-import com.oracle.graal.options.Option;
-import com.oracle.graal.options.OptionType;
-import com.oracle.graal.options.OptionValue;
-
-/**
- * Options related to {@link InstanceOfSnippets}.
- *
- * Note: This must be a top level class to work around for <a
- * href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=477597">Eclipse bug 477597</a>.
- */
-class InstanceOfSnippetsOptions {
-
-    // @formatter:off
-    @Option(help = "If the probability that a type check will hit one the profiled types (up to " +
-                   "TypeCheckMaxHints) is below this value, the type check will be compiled without profiling info", type = OptionType.Expert)
-    static final OptionValue<Double> TypeCheckMinProfileHitProbability = new OptionValue<>(0.5);
-
-    @Option(help = "The maximum number of profiled types that will be used when compiling a profiled type check. " +
-                    "Note that TypeCheckMinProfileHitProbability also influences whether profiling info is used in compiled type checks.", type = OptionType.Expert)
-    static final OptionValue<Integer> TypeCheckMaxHints = new OptionValue<>(2);
-    // @formatter:on
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java	Fri Jan 08 17:46:00 2016 -0800
@@ -65,7 +65,7 @@
     /**
      * Alternative way to implement exception object loading.
      */
-    private static final boolean USE_C_RUNTIME = Boolean.getBoolean("graal.loadExceptionObject.useCRuntime");
+    private static final boolean USE_C_RUNTIME = HotspotSnippetsOptions.LoadExceptionObjectInVM.getValue();
 
     @Snippet
     public static Object loadException(@ConstantParameter Register threadRegister) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java	Fri Jan 08 17:46:00 2016 -0800
@@ -45,6 +45,10 @@
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.useBiasedLocking;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.verifyOop;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.wordSize;
+import static com.oracle.graal.hotspot.replacements.HotspotSnippetsOptions.ProfileMonitors;
+import static com.oracle.graal.hotspot.replacements.HotspotSnippetsOptions.TraceMonitorsMethodFilter;
+import static com.oracle.graal.hotspot.replacements.HotspotSnippetsOptions.TraceMonitorsTypeFilter;
+import static com.oracle.graal.hotspot.replacements.HotspotSnippetsOptions.VerifyBalancedMonitors;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.FREQUENT_PROBABILITY;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.VERY_FAST_PATH_PROBABILITY;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.VERY_SLOW_PATH_PROBABILITY;
@@ -96,9 +100,6 @@
 import com.oracle.graal.nodes.memory.address.OffsetAddressNode;
 import com.oracle.graal.nodes.spi.LoweringTool;
 import com.oracle.graal.nodes.type.StampTool;
-import com.oracle.graal.options.Option;
-import com.oracle.graal.options.OptionType;
-import com.oracle.graal.options.OptionValue;
 import com.oracle.graal.phases.common.inlining.InliningUtil;
 import com.oracle.graal.replacements.Log;
 import com.oracle.graal.replacements.Snippet;
@@ -129,25 +130,25 @@
  *             JavaThread*:23 epoch:2 age:4    biased_lock:1 lock:2 (biased object)
  *             size:32 ------------------------------------------>| (CMS free block)
  *             PromotedObject*:29 ---------->| promo_bits:3 ----->| (CMS promoted object)
- *
+ * 
  *  64 bits:
  *  --------
  *  unused:25 hash:31 -->| unused:1   age:4    biased_lock:1 lock:2 (normal object)
  *  JavaThread*:54 epoch:2 unused:1   age:4    biased_lock:1 lock:2 (biased object)
  *  PromotedObject*:61 --------------------->| promo_bits:3 ----->| (CMS promoted object)
  *  size:64 ----------------------------------------------------->| (CMS free block)
- *
+ * 
  *  unused:25 hash:31 -->| cms_free:1 age:4    biased_lock:1 lock:2 (COOPs && normal object)
  *  JavaThread*:54 epoch:2 cms_free:1 age:4    biased_lock:1 lock:2 (COOPs && biased object)
  *  narrowOop:32 unused:24 cms_free:1 unused:4 promo_bits:3 ----->| (COOPs && CMS promoted object)
  *  unused:21 size:35 -->| cms_free:1 unused:7 ------------------>| (COOPs && CMS free block)
- *
+ * 
  *  - hash contains the identity hash value: largest value is
  *    31 bits, see os::random().  Also, 64-bit vm's require
  *    a hash value no bigger than 32 bits because they will not
  *    properly generate a mask larger than that: see library_call.cpp
  *    and c1_CodePatterns_sparc.cpp.
- *
+ * 
  *  - the biased lock pattern is used to bias a lock toward a given
  *    thread. When this pattern is set in the low three bits, the lock
  *    is either biased toward a given thread or "anonymously" biased,
@@ -156,12 +157,12 @@
  *    be performed by that thread without using atomic operations.
  *    When a lock's bias is revoked, it reverts back to the normal
  *    locking scheme described below.
- *
+ * 
  *    Note that we are overloading the meaning of the "unlocked" state
  *    of the header. Because we steal a bit from the age we can
  *    guarantee that the bias pattern will never be seen for a truly
  *    unlocked object.
- *
+ * 
  *    Note also that the biased state contains the age bits normally
  *    contained in the object header. Large increases in scavenge
  *    times were seen when these bits were absent and an arbitrary age
@@ -172,18 +173,18 @@
  *    a very large value (currently 128 bytes (32bVM) or 256 bytes (64bVM))
  *    to make room for the age bits & the epoch bits (used in support of
  *    biased locking), and for the CMS "freeness" bit in the 64bVM (+COOPs).
- *
+ * 
  *    [JavaThread* | epoch | age | 1 | 01]       lock is biased toward given thread
  *    [0           | epoch | age | 1 | 01]       lock is anonymously biased
- *
+ * 
  *  - the two lock bits are used to describe three states: locked/unlocked and monitor.
- *
+ * 
  *    [ptr             | 00]  locked             ptr points to real header on stack
  *    [header      | 0 | 01]  unlocked           regular object header
  *    [ptr             | 10]  monitor            inflated lock (header is wapped out)
  *    [ptr             | 11]  marked             used by markSweep to mark an object
  *                                               not valid at any other time
- *
+ * 
  *    We assume that stack/thread pointers have the lowest two bits cleared.
  * </pre>
  *
@@ -192,34 +193,13 @@
  */
 public class MonitorSnippets implements Snippets {
 
-    public static class Options {
-
-        //@formatter:off
-        @Option(help = "", type = OptionType.Debug)
-        public static final OptionValue<Boolean> ProfileMonitors = new OptionValue<>(false);
-        //@formatter:on
-    }
-
     private static final boolean PROFILE_CONTEXT = false;
 
     @Fold
     static boolean doProfile() {
-        return Options.ProfileMonitors.getValue();
+        return ProfileMonitors.getValue();
     }
 
-    /**
-     * Monitor operations on objects whose type contains this substring will be traced.
-     */
-    private static final String TRACE_TYPE_FILTER = System.getProperty("graal.monitors.trace.typeFilter");
-
-    /**
-     * Monitor operations in methods whose fully qualified name contains this substring will be
-     * traced.
-     */
-    private static final String TRACE_METHOD_FILTER = System.getProperty("graal.monitors.trace.methodFilter");
-
-    public static final boolean CHECK_BALANCED_MONITORS = Boolean.getBoolean("graal.monitors.checkBalanced");
-
     @Snippet
     public static void monitorenter(Object object, KlassPointer hub, @ConstantParameter int lockDepth, @ConstantParameter Register threadRegister, @ConstantParameter Register stackPointerRegister,
                     @ConstantParameter boolean trace) {
@@ -509,8 +489,10 @@
     @NodeIntrinsic(BreakpointNode.class)
     static native void bkpt(Object object, Word mark, Word tmp, Word value);
 
+    private static final boolean VERIFY_BALANCED_MONITORS = VerifyBalancedMonitors.getValue();
+
     public static void incCounter() {
-        if (CHECK_BALANCED_MONITORS) {
+        if (VERIFY_BALANCED_MONITORS) {
             final Word counter = MonitorCounterNode.counter();
             final int count = counter.readInt(0, MONITOR_COUNTER_LOCATION);
             counter.writeInt(0, count + 1, MONITOR_COUNTER_LOCATION);
@@ -518,7 +500,7 @@
     }
 
     public static void decCounter() {
-        if (CHECK_BALANCED_MONITORS) {
+        if (VERIFY_BALANCED_MONITORS) {
             final Word counter = MonitorCounterNode.counter();
             final int count = counter.readInt(0, MONITOR_COUNTER_LOCATION);
             counter.writeInt(0, count - 1, MONITOR_COUNTER_LOCATION);
@@ -596,30 +578,32 @@
 
         public static boolean isTracingEnabledForType(ValueNode object) {
             ResolvedJavaType type = StampTool.typeOrNull(object.stamp());
-            if (TRACE_TYPE_FILTER == null) {
+            String filter = TraceMonitorsTypeFilter.getValue();
+            if (filter == null) {
                 return false;
             } else {
-                if (TRACE_TYPE_FILTER.length() == 0) {
+                if (filter.length() == 0) {
                     return true;
                 }
                 if (type == null) {
                     return false;
                 }
-                return (type.getName().contains(TRACE_TYPE_FILTER));
+                return (type.getName().contains(filter));
             }
         }
 
         public static boolean isTracingEnabledForMethod(ResolvedJavaMethod method) {
-            if (TRACE_METHOD_FILTER == null) {
+            String filter = TraceMonitorsMethodFilter.getValue();
+            if (filter == null) {
                 return false;
             } else {
-                if (TRACE_METHOD_FILTER.length() == 0) {
+                if (filter.length() == 0) {
                     return true;
                 }
                 if (method == null) {
                     return false;
                 }
-                return (method.format("%H.%n").contains(TRACE_METHOD_FILTER));
+                return (method.format("%H.%n").contains(filter));
             }
         }
 
@@ -628,7 +612,7 @@
          * return points of the graph to initialize and check the monitor counter respectively.
          */
         private void checkBalancedMonitors(StructuredGraph graph, LoweringTool tool) {
-            if (CHECK_BALANCED_MONITORS) {
+            if (VERIFY_BALANCED_MONITORS) {
                 NodeIterable<MonitorCounterNode> nodes = graph.getNodes().filter(MonitorCounterNode.class);
                 if (nodes.isEmpty()) {
                     // Only insert the nodes if this is the first monitorenter being lowered.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Fri Jan 08 17:46:00 2016 -0800
@@ -52,7 +52,6 @@
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.verifyOop;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.wordSize;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.writeTlabTop;
-import static com.oracle.graal.hotspot.replacements.NewObjectSnippetsOptions.ProfileAllocations;
 import static com.oracle.graal.nodes.PiArrayNode.piArrayCast;
 import static com.oracle.graal.nodes.PiNode.piCast;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.FAST_PATH_PROBABILITY;
@@ -156,7 +155,7 @@
 
     @Fold
     static boolean doProfile() {
-        return ProfileAllocations.getValue();
+        return HotspotSnippetsOptions.ProfileAllocations.getValue();
     }
 
     protected static void profileAllocation(String path, long size, String typeContext) {
@@ -506,7 +505,7 @@
             args.addConst("fillContents", newInstanceNode.fillContents());
             args.addConst("threadRegister", registers.getThreadRegister());
             args.addConst("constantSize", true);
-            args.addConst("typeContext", ProfileAllocations.getValue() ? type.toJavaName(false) : "");
+            args.addConst("typeContext", HotspotSnippetsOptions.ProfileAllocations.getValue() ? type.toJavaName(false) : "");
 
             SnippetTemplate template = template(args);
             Debug.log("Lowering allocateInstance in %s: node=%s, template=%s, arguments=%s", graph, newInstanceNode, template, args);
@@ -536,7 +535,7 @@
             args.addConst("fillContents", newArrayNode.fillContents());
             args.addConst("threadRegister", registers.getThreadRegister());
             args.addConst("maybeUnroll", length.isConstant());
-            args.addConst("typeContext", ProfileAllocations.getValue() ? arrayType.toJavaName(false) : "");
+            args.addConst("typeContext", HotspotSnippetsOptions.ProfileAllocations.getValue() ? arrayType.toJavaName(false) : "");
             SnippetTemplate template = template(args);
             Debug.log("Lowering allocateArray in %s: node=%s, template=%s, arguments=%s", graph, newArrayNode, template, args);
             template.instantiate(providers.getMetaAccess(), newArrayNode, DEFAULT_REPLACER, args);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippetsOptions.java	Fri Jan 08 17:45:30 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.replacements;
-
-import com.oracle.graal.options.Option;
-import com.oracle.graal.options.OptionType;
-import com.oracle.graal.options.OptionValue;
-
-/**
- * Options related to {@link NewObjectSnippets}.
- *
- * Note: This must be a top level class to work around for <a
- * href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=477597">Eclipse bug 477597</a>.
- */
-class NewObjectSnippetsOptions {
-
-    //@formatter:off
-    @Option(help = "", type = OptionType.Debug)
-    static final OptionValue<Boolean> ProfileAllocations = new OptionValue<>(false);
-    //@formatter:on
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java	Fri Jan 08 17:46:00 2016 -0800
@@ -134,7 +134,7 @@
 
     @Fold
     static boolean logging() {
-        return Boolean.getBoolean("graal.logExceptionHandlerStub");
+        return StubOptions.TraceExceptionHandlerStub.getValue();
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Fri Jan 08 17:46:00 2016 -0800
@@ -85,7 +85,7 @@
 
     @Fold
     static boolean logging() {
-        return Boolean.getBoolean("graal.logNewArrayStub");
+        return StubOptions.TraceNewArrayStub.getValue();
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Fri Jan 08 17:46:00 2016 -0800
@@ -127,7 +127,7 @@
 
     @Fold
     static boolean logging() {
-        return Boolean.getBoolean("graal.logNewInstanceStub");
+        return StubOptions.TraceNewInstanceStub.getValue();
     }
 
     /**
@@ -295,7 +295,7 @@
 
     @Fold
     static boolean forceSlowPath() {
-        return Boolean.getBoolean("graal.newInstanceStub.forceSlowPath");
+        return StubOptions.ForceUseOfNewInstanceStub.getValue();
     }
 
     public static final ForeignCallDescriptor NEW_INSTANCE_C = newDescriptor(NewInstanceStub.class, "newInstanceC", void.class, Word.class, KlassPointer.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubOptions.java	Fri Jan 08 17:46:00 2016 -0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.stubs;
+
+import com.oracle.graal.options.Option;
+import com.oracle.graal.options.OptionType;
+import com.oracle.graal.options.OptionValue;
+
+//JaCoCo Exclude
+
+/**
+ * Options related to HotSpot Graal-generated stubs.
+ *
+ * Note: This must be a top level class to work around for <a
+ * href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=477597">Eclipse bug 477597</a>.
+ */
+public class StubOptions {
+    // @formatter:off
+    @Option(help = "Trace execution of stub used to handle an exception thrown by a callee.", type = OptionType.Debug)
+    static final OptionValue<Boolean> TraceExceptionHandlerStub = new OptionValue<>(false);
+
+    @Option(help = "Trace execution of the stub that routes an exception to a handler in the calling frame.", type = OptionType.Debug)
+    static final OptionValue<Boolean> TraceUnwindStub = new OptionValue<>(false);
+
+    @Option(help = "Trace execution of slow path stub for array allocation.", type = OptionType.Debug)
+    static final OptionValue<Boolean> TraceNewArrayStub = new OptionValue<>(false);
+
+    @Option(help = "Trace execution of slow path stub for non-array object allocation.", type = OptionType.Debug)
+    static final OptionValue<Boolean> TraceNewInstanceStub = new OptionValue<>(false);
+
+    @Option(help = "Force non-array object allocation to always use the slow path.", type = OptionType.Debug)
+    static final OptionValue<Boolean> ForceUseOfNewInstanceStub = new OptionValue<>(false);
+    //@formatter:on
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java	Fri Jan 08 17:46:00 2016 -0800
@@ -97,7 +97,7 @@
 
     @Fold
     static boolean logging() {
-        return Boolean.getBoolean("graal.logUnwindExceptionToCallerStub");
+        return StubOptions.TraceUnwindStub.getValue();
     }
 
     /**
--- a/graal/com.oracle.graal.options.test/src/com/oracle/graal/options/test/TestOptionValue.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.options.test/src/com/oracle/graal/options/test/TestOptionValue.java	Fri Jan 08 17:46:00 2016 -0800
@@ -117,11 +117,11 @@
 
     @Test
     public void toStringTest() {
-        assertEquals("com.oracle.graal.options.test.TestOptionValue$Options.Mutable=original", Mutable.toString());
+        assertEquals("Mutable=original", Mutable.toString());
         try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) {
-            assertEquals("com.oracle.graal.options.test.TestOptionValue$Options.Mutable=override1", Mutable.toString());
+            assertEquals("Mutable=override1", Mutable.toString());
             try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) {
-                assertEquals("com.oracle.graal.options.test.TestOptionValue$Options.Mutable=override2", Mutable.toString());
+                assertEquals("Mutable=override2", Mutable.toString());
             }
         }
     }
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionValue.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionValue.java	Fri Jan 08 17:46:00 2016 -0800
@@ -156,10 +156,16 @@
     private OptionValue<?> next;
     private static OptionValue<?> head;
 
-    private static final boolean ShowReadsHistogram = Boolean.getBoolean("graal.showOptionValueReadsHistogram");
+    /**
+     * Name of the boolean system property governing whether to profile the number of times
+     * {@link #getValue()} is called for each {@link OptionValue}.
+     */
+    public static final String PROFILE_OPTIONVALUE_PROPERTY_NAME = "graal.profileOptionValue";
+
+    private static final boolean ProfileOptionValue = Boolean.getBoolean(PROFILE_OPTIONVALUE_PROPERTY_NAME);
 
     private static void addToHistogram(OptionValue<?> option) {
-        if (ShowReadsHistogram) {
+        if (ProfileOptionValue) {
             synchronized (OptionValue.class) {
                 option.next = head;
                 head = option;
@@ -217,7 +223,12 @@
      * {@link Object#toString()}.
      */
     public String getName() {
-        return descriptor == null ? super.toString() : (descriptor.getDeclaringClass().getName() + "." + descriptor.getName());
+        if (descriptor == null) {
+            // Trigger initialization of OptionsLoader to ensure all option values have
+            // a descriptor which is required for them to have meaningful names.
+            OptionsLoader.options.hashCode();
+        }
+        return descriptor == null ? super.toString() : descriptor.getName();
     }
 
     @Override
@@ -251,7 +262,7 @@
      * Gets the value of this option.
      */
     public T getValue() {
-        if (ShowReadsHistogram) {
+        if (ProfileOptionValue) {
             reads++;
         }
         if (!(this instanceof StableOptionValue)) {
@@ -452,11 +463,7 @@
     }
 
     static {
-        if (ShowReadsHistogram) {
-            // Trigger initialization of OptionsLoader to ensure all option values have
-            // a descriptor which is required for them to have meaningful names.
-            OptionsLoader.options.hashCode();
-
+        if (ProfileOptionValue) {
             Runtime.getRuntime().addShutdownHook(new Thread() {
                 @Override
                 public void run() {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPlugin.java	Fri Jan 08 17:45:30 2016 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.replacements;
-
-import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.meta.JavaKind;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-
-import com.oracle.graal.api.replacements.Fold;
-import com.oracle.graal.debug.MethodFilter;
-import com.oracle.graal.graph.Node.NodeIntrinsic;
-import com.oracle.graal.nodes.ValueNode;
-import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderContext;
-import com.oracle.graal.nodes.graphbuilderconf.NodePlugin;
-
-/**
- * An {@link NodePlugin} that handles methods annotated by {@link Fold} and {@link NodeIntrinsic}.
- */
-public class NodeIntrinsificationPlugin implements NodePlugin {
-
-    /**
-     * Calls in replacements to methods matching one of these filters are elided. Only void methods
-     * are considered for elision. The use of "snippets" in name of the variable and system property
-     * is purely for legacy reasons.
-     */
-    private static final MethodFilter[] MethodsElidedInSnippets = getMethodsElidedInSnippets();
-
-    private static MethodFilter[] getMethodsElidedInSnippets() {
-        String commaSeparatedPatterns = System.getProperty("graal.MethodsElidedInSnippets");
-        if (commaSeparatedPatterns != null) {
-            return MethodFilter.parse(commaSeparatedPatterns);
-        }
-        return null;
-    }
-
-    @Override
-    public boolean handleInvoke(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args) {
-        if (MethodsElidedInSnippets != null) {
-            if (MethodFilter.matches(MethodsElidedInSnippets, method)) {
-                if (method.getSignature().getReturnKind() != JavaKind.Void) {
-                    throw new JVMCIError("Cannot elide non-void method " + method.format("%H.%n(%p)"));
-                }
-                return true;
-            }
-        }
-        return false;
-    }
-}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Fri Jan 08 17:46:00 2016 -0800
@@ -24,6 +24,7 @@
 
 import static com.oracle.graal.compiler.common.GraalOptions.DeoptALot;
 import static com.oracle.graal.compiler.common.GraalOptions.OptCanonicalizer;
+import static com.oracle.graal.compiler.common.GraalOptions.UseSnippetGraphCache;
 import static com.oracle.graal.java.BytecodeParserOptions.InlineDuringParsing;
 import static com.oracle.graal.java.BytecodeParserOptions.InlineIntrinsicsDuringParsing;
 import static com.oracle.graal.nodes.graphbuilderconf.IntrinsicContext.CompilationContext.INLINE_AFTER_PARSING;
@@ -318,7 +319,6 @@
         this.snippetTemplateCache = CollectionsFactory.newMap();
     }
 
-    private static final boolean UseSnippetGraphCache = Boolean.parseBoolean(System.getProperty("graal.useSnippetGraphCache", "true"));
     private static final DebugTimer SnippetPreparationTime = Debug.timer("SnippetPreparationTime");
 
     /**
@@ -348,12 +348,12 @@
         assert method.getAnnotation(Snippet.class) != null : "Snippet must be annotated with @" + Snippet.class.getSimpleName();
         assert method.hasBytecodes() : "Snippet must not be abstract or native";
 
-        StructuredGraph graph = UseSnippetGraphCache ? graphs.get(method) : null;
+        StructuredGraph graph = UseSnippetGraphCache.getValue() ? graphs.get(method) : null;
         if (graph == null) {
             try (DebugCloseable a = SnippetPreparationTime.start()) {
                 StructuredGraph newGraph = makeGraph(method, args, recursiveEntry);
                 Debug.metric("SnippetNodeCount[%#s]", method).add(newGraph.getNodeCount());
-                if (!UseSnippetGraphCache || args != null) {
+                if (!UseSnippetGraphCache.getValue() || args != null) {
                     return newGraph;
                 }
                 graphs.putIfAbsent(method, newGraph);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Fri Jan 08 17:45:30 2016 -0800
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Fri Jan 08 17:46:00 2016 -0800
@@ -58,6 +58,7 @@
 import jdk.vm.ci.meta.Signature;
 
 import com.oracle.graal.api.replacements.SnippetReflectionProvider;
+import com.oracle.graal.compiler.common.GraalOptions;
 import com.oracle.graal.compiler.common.type.Stamp;
 import com.oracle.graal.compiler.common.type.StampFactory;
 import com.oracle.graal.debug.Debug;
@@ -109,6 +110,8 @@
 import com.oracle.graal.nodes.spi.LoweringTool;
 import com.oracle.graal.nodes.spi.MemoryProxy;
 import com.oracle.graal.nodes.util.GraphUtil;
+import com.oracle.graal.options.Option;
+import com.oracle.graal.options.OptionValue;
 import com.oracle.graal.phases.common.CanonicalizerPhase;
 import com.oracle.graal.phases.common.DeadCodeEliminationPhase;
 import com.oracle.graal.phases.common.FloatingReadPhase;
@@ -133,7 +136,6 @@
  */
 public class SnippetTemplate {
 
-    private static final boolean EAGER_SNIPPETS = Boolean.getBoolean("graal.snippets.eager");
     private boolean mayRemoveLocation = false;
 
     /**
@@ -527,15 +529,19 @@
     private static final DebugTimer SnippetTemplateCreationTime = Debug.timer("SnippetTemplateCreationTime");
     private static final DebugMetric SnippetTemplates = Debug.metric("SnippetTemplateCount");
 
-    private static final String MAX_TEMPLATES_PER_SNIPPET_PROPERTY_NAME = "graal.maxTemplatesPerSnippet";
-    private static final int MaxTemplatesPerSnippet = Integer.getInteger(MAX_TEMPLATES_PER_SNIPPET_PROPERTY_NAME, 50);
+    static class Options {
+        @Option(help = "Use a LRU cache for snippet templates.")//
+        static final OptionValue<Boolean> UseSnippetTemplateCache = new OptionValue<>(true);
+
+        @Option(help = "")//
+        static final OptionValue<Integer> MaxTemplatesPerSnippet = new OptionValue<>(50);
+    }
 
     /**
      * Base class for snippet classes. It provides a cache for {@link SnippetTemplate}s.
      */
     public abstract static class AbstractTemplates implements com.oracle.graal.api.replacements.SnippetTemplateCache {
 
-        static final boolean UseSnippetTemplateCache = Boolean.parseBoolean(System.getProperty("graal.useSnippetTemplateCache", "true"));
         protected final Providers providers;
         protected final SnippetReflectionProvider snippetReflection;
         protected final TargetDescription target;
@@ -545,8 +551,9 @@
             this.providers = providers;
             this.snippetReflection = snippetReflection;
             this.target = target;
-            if (UseSnippetTemplateCache) {
-                this.templates = Collections.synchronizedMap(new LRUCache<>(MaxTemplatesPerSnippet, MaxTemplatesPerSnippet));
+            if (Options.UseSnippetTemplateCache.getValue()) {
+                int size = Options.MaxTemplatesPerSnippet.getValue();
+                this.templates = Collections.synchronizedMap(new LRUCache<>(size, size));
             } else {
                 this.templates = null;
             }
@@ -574,7 +581,7 @@
             assert findMethod(declaringClass, methodName, method) == null : "found more than one method named " + methodName + " in " + declaringClass;
             ResolvedJavaMethod javaMethod = providers.getMetaAccess().lookupJavaMethod(method);
             providers.getReplacements().registerSnippet(javaMethod);
-            if (EAGER_SNIPPETS) {
+            if (GraalOptions.EagerSnippets.getValue()) {
                 return new EagerSnippetInfo(javaMethod, privateLocations);
             } else {
                 return new LazySnippetInfo(javaMethod, privateLocations);
@@ -586,12 +593,12 @@
          */
         @SuppressWarnings("try")
         protected SnippetTemplate template(final Arguments args) {
-            SnippetTemplate template = UseSnippetTemplateCache && args.cacheable ? templates.get(args.cacheKey) : null;
+            SnippetTemplate template = Options.UseSnippetTemplateCache.getValue() && args.cacheable ? templates.get(args.cacheKey) : null;
             if (template == null) {
                 SnippetTemplates.increment();
                 try (DebugCloseable a = SnippetTemplateCreationTime.start(); Scope s = Debug.scope("SnippetSpecialization", args.info.method)) {
                     template = new SnippetTemplate(providers, snippetReflection, args);
-                    if (UseSnippetTemplateCache && args.cacheable) {
+                    if (Options.UseSnippetTemplateCache.getValue() && args.cacheable) {
                         templates.put(args.cacheKey, template);
                     }
                 } catch (Throwable e) {
--- a/mx.graal/mx_graal_8.py	Fri Jan 08 17:45:30 2016 -0800
+++ b/mx.graal/mx_graal_8.py	Fri Jan 08 17:46:00 2016 -0800
@@ -320,7 +320,7 @@
 ]
 
 def _graal_gate_runner(args, tasks):
-    compiler_gate_runner(['graal'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument)
+    compiler_gate_runner(['graal', 'truffle'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument)
 
 mx_gate.add_gate_runner(_suite, _graal_gate_runner)
 mx_gate.add_gate_argument('--extra-vm-argument', action='append', help='add extra vm argument to gate tasks if applicable (multiple occurrences allowed)')
@@ -395,6 +395,8 @@
             mx.abort('Mixing - and = in -G: option specification: ' + arg)
         arg = '-Dgraal.option.' + arg[len('-G:+'):] + '=false'
     elif arg.startswith('-G:'):
+        if '=' not in arg:
+            mx.abort('Missing "=" in non-boolean -G: option specification: ' + arg)
         arg = '-Dgraal.option.' + arg[len('-G:'):]
     return arg
 
--- a/mx.graal/mx_graal_9.py	Fri Jan 08 17:45:30 2016 -0800
+++ b/mx.graal/mx_graal_9.py	Fri Jan 08 17:46:00 2016 -0800
@@ -294,7 +294,7 @@
 ]
 
 def _graal_gate_runner(args, tasks):
-    compiler_gate_runner(['graal'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument)
+    compiler_gate_runner(['graal', 'truffle'], graal_unit_test_runs, graal_bootstrap_tests, tasks, args.extra_vm_argument)
 
 mx_gate.add_gate_runner(_suite, _graal_gate_runner)
 mx_gate.add_gate_argument('--extra-vm-argument', action='append', help='add extra vm argument to gate tasks if applicable (multiple occurrences allowed)')
@@ -321,6 +321,8 @@
                 mx.abort('Mixing - and = in -G: option specification: ' + arg)
             arg = '-Dgraal.option.' + arg[len('-G:+'):] + '=false'
         elif arg.startswith('-G:'):
+            if '=' not in arg:
+                mx.abort('Missing "=" in non-boolean -G: option specification: ' + arg)
             arg = '-Dgraal.option.' + arg[len('-G:'):]
         return arg
     args = map(translateGOption, args)
--- a/mx.graal/suite.py	Fri Jan 08 17:45:30 2016 -0800
+++ b/mx.graal/suite.py	Fri Jan 08 17:46:00 2016 -0800
@@ -39,7 +39,7 @@
             {
                "name" : "jvmci",
                "optional" : "true",
-               "version" : "f2206f5bb62ed876e9fd031f4a5a148a0cc7b57b",
+               "version" : "9c0966b935a912e9a9af7a1bd0864151752e644c",
                "urls" : [
                     {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/graal-jvmci-8", "kind" : "hg"},
                     {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},
@@ -47,7 +47,7 @@
             },
             {
                "name" : "truffle",
-               "version" : "d725323deb6ce02dae7d727d558813160d229d16",
+               "version" : "9b9301abe3ff373075f0c067ec965ea041603e71",
                "urls" : [
                     {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/truffle", "kind" : "hg"},
                     {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"},