changeset 17067:2bc092f3d574

Merge.
author Chris Seaton <chris.seaton@oracle.com>
date Mon, 08 Sep 2014 22:21:47 +0100
parents 0bcefb0f8488 (current diff) 37d6d174bc40 (diff)
children 8456194ca311
files
diffstat 27 files changed, 144 insertions(+), 144 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Mon Sep 08 22:21:47 2014 +0100
@@ -269,7 +269,7 @@
             }
             result.append("\n");
             for (Node node : schedule.getBlockToNodesMap().get(block)) {
-                if (node.isAlive() && node.recordsUsages()) {
+                if (node.isAlive()) {
                     if (!excludeVirtual || !(node instanceof VirtualObjectNode || node instanceof ProxyNode)) {
                         int id;
                         if (canonicalId.get(node) != null) {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java	Mon Sep 08 22:21:47 2014 +0100
@@ -242,7 +242,7 @@
     }
 
     private static void outputNode(Node node) {
-        TTY.print("  " + node + "    (usage count: " + (node.recordsUsages() ? node.usages().count() : "?") + ") (inputs:");
+        TTY.print("  " + node + "    (usage count: " + node.usages().count() + ") (inputs:");
         for (Node input : node.inputs()) {
             TTY.print(" " + input.toString(Verbosity.Id));
         }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Mon Sep 08 22:21:47 2014 +0100
@@ -25,6 +25,7 @@
 import static com.oracle.graal.compiler.GraalCompiler.Options.*;
 import static com.oracle.graal.compiler.MethodFilter.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
 import java.util.*;
 
@@ -167,7 +168,7 @@
             HighTierContext highTierContext = new HighTierContext(providers, assumptions, cache, graphBuilderSuite, optimisticOpts);
             if (graph.start().next() == null) {
                 graphBuilderSuite.apply(graph, highTierContext);
-                new DeadCodeEliminationPhase().apply(graph);
+                new DeadCodeEliminationPhase(OPTIONAL).apply(graph);
             } else {
                 Debug.dump(graph, "initial state");
             }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java	Mon Sep 08 22:21:47 2014 +0100
@@ -24,12 +24,14 @@
 
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.compiler.phases.HighTier.Options.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
+
 import com.oracle.graal.loop.phases.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
-import com.oracle.graal.phases.common.cfs.IterativeFlowSensitiveReductionPhase;
+import com.oracle.graal.phases.common.cfs.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.virtual.phases.ea.*;
@@ -56,7 +58,7 @@
                 appendPhase(new IterativeInliningPhase(canonicalizer));
             } else {
                 appendPhase(new InliningPhase(canonicalizer));
-                appendPhase(new DeadCodeEliminationPhase());
+                appendPhase(new DeadCodeEliminationPhase(OPTIONAL));
 
                 boolean reduceOrEliminate = FlowSensitiveReduction.getValue() || ConditionalElimination.getValue();
                 if (reduceOrEliminate && OptCanonicalizer.getValue()) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java	Mon Sep 08 22:21:47 2014 +0100
@@ -23,6 +23,7 @@
 package com.oracle.graal.compiler.phases;
 
 import static com.oracle.graal.compiler.common.GraalOptions.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.options.*;
@@ -63,6 +64,6 @@
 
         appendPhase(new UseTrappingNullChecksPhase());
 
-        appendPhase(new DeadCodeEliminationPhase());
+        appendPhase(new DeadCodeEliminationPhase(REQUIRED));
     }
 }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Mon Sep 08 22:21:47 2014 +0100
@@ -479,7 +479,7 @@
             int minCount = Integer.MAX_VALUE;
             Node minCountNode = null;
             for (Node input : node.inputs()) {
-                if (input != null && input.recordsUsages()) {
+                if (input != null) {
                     int estimate = input.getUsageCountUpperBound();
                     if (estimate == 0) {
                         return null;
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Mon Sep 08 22:21:47 2014 +0100
@@ -223,8 +223,10 @@
         return getNodeClass().getSuccessorIterable(this);
     }
 
+    /**
+     * Gets the maximum number of usages this node has had at any point in time.
+     */
     int getUsageCountUpperBound() {
-        assert recordsUsages();
         if (usage0 == null) {
             return 0;
         }
@@ -238,20 +240,10 @@
      * Gets the list of nodes that use this node (i.e., as an input).
      */
     public final NodeIterable<Node> usages() {
-        assert recordsUsages() : this;
         return new NodeUsageIterable(this);
     }
 
     /**
-     * Determines if this node records its usages (i.e. the nodes for which it is an input). All
-     * methods in {@link Node} that pertain to querying or updating usage information must not be
-     * called for a {@link Node} instance that returns false for this method.
-     */
-    public boolean recordsUsages() {
-        return true;
-    }
-
-    /**
      * Finds the index of the last non-null entry in a node array. The search assumes that all
      * non-null entries precede the first null entry in the array.
      *
@@ -291,7 +283,6 @@
      * @param node the node to add
      */
     private void addUsage(Node node) {
-        assert recordsUsages();
         incUsageModCount();
         if (usage0 == null) {
             usage0 = node;
@@ -398,7 +389,6 @@
      * @return whether or not {@code usage} was in the usage list
      */
     private boolean removeUsage(Node node) {
-        assert recordsUsages();
         assert node != null;
         // It is critical that this method maintains the invariant that
         // the usage list has no null element preceding a non-null element
@@ -449,7 +439,6 @@
     }
 
     private void clearUsages() {
-        assert recordsUsages();
         incUsageModCount();
         usage0 = null;
         usage1 = null;
@@ -502,18 +491,14 @@
         assert isAlive() && (newInput == null || newInput.isAlive()) : "adding " + newInput + " to " + this + " instead of " + oldInput;
         if (oldInput != newInput) {
             if (oldInput != null) {
-                if (oldInput.recordsUsages()) {
-                    boolean result = removeThisFromUsages(oldInput);
-                    assert assertTrue(result, "not found in usages, old input: %s", oldInput);
-                }
+                boolean result = removeThisFromUsages(oldInput);
+                assert assertTrue(result, "not found in usages, old input: %s", oldInput);
             }
             maybeNotifyInputChanged(this);
             if (newInput != null) {
-                if (newInput.recordsUsages()) {
-                    newInput.addUsage(this);
-                }
+                newInput.addUsage(this);
             }
-            if (oldInput != null && oldInput.recordsUsages() && oldInput.usages().isEmpty()) {
+            if (oldInput != null && oldInput.usages().isEmpty()) {
                 maybeNotifyZeroUsages(oldInput);
             }
         }
@@ -578,9 +563,7 @@
             assert assertTrue(result, "not found in inputs, usage: %s", usage);
             if (other != null) {
                 maybeNotifyInputChanged(usage);
-                if (other.recordsUsages()) {
-                    other.addUsage(usage);
-                }
+                other.addUsage(usage);
             }
         }
         clearUsages();
@@ -600,9 +583,7 @@
                 assert assertTrue(result, "not found in inputs, usage: %s", usage);
                 if (other != null) {
                     maybeNotifyInputChanged(usage);
-                    if (other.recordsUsages()) {
-                        other.addUsage(usage);
-                    }
+                    other.addUsage(usage);
                 }
             } else {
                 if (removeStart >= 0) {
@@ -686,11 +667,9 @@
 
     private void unregisterInputs() {
         for (Node input : inputs()) {
-            if (input.recordsUsages()) {
-                removeThisFromUsages(input);
-                if (input.usages().isEmpty()) {
-                    maybeNotifyZeroUsages(input);
-                }
+            removeThisFromUsages(input);
+            if (input.usages().isEmpty()) {
+                maybeNotifyZeroUsages(input);
             }
         }
     }
@@ -721,9 +700,7 @@
     }
 
     private boolean checkDeletion() {
-        if (recordsUsages()) {
-            assertTrue(usages().isEmpty(), "cannot delete node %s because of usages: %s", this, usages());
-        }
+        assertTrue(usages().isEmpty(), "cannot delete node %s because of usages: %s", this, usages());
         assertTrue(predecessor == null, "cannot delete node %s because of predecessor: %s", this, predecessor);
         return true;
     }
@@ -751,9 +728,7 @@
         clazz.copyInputs(this, newNode);
         if (addToGraph) {
             for (Node input : inputs()) {
-                if (input.recordsUsages()) {
-                    input.addUsage(newNode);
-                }
+                input.addUsage(newNode);
             }
         }
         return newNode;
@@ -825,23 +800,20 @@
         assertTrue(isAlive(), "cannot verify inactive nodes (id=%d)", id);
         assertTrue(graph() != null, "null graph");
         for (Node input : inputs()) {
-            assertTrue(!input.recordsUsages() || input.usages().contains(this), "missing usage in input %s", input);
+            assertTrue(input.usages().contains(this), "missing usage in input %s", input);
         }
         for (Node successor : successors()) {
             assertTrue(successor.predecessor() == this, "missing predecessor in %s (actual: %s)", successor, successor.predecessor());
             assertTrue(successor.graph() == graph(), "mismatching graph in successor %s", successor);
         }
-        if (recordsUsages()) {
-            for (Node usage : usages()) {
-                assertFalse(usage.isDeleted(), "usage %s must never be deleted", usage);
-                assertTrue(usage.inputs().contains(this), "missing input in usage %s", usage);
-                NodePosIterator iterator = usage.inputs().iterator();
-                while (iterator.hasNext()) {
-                    Position pos = iterator.nextPosition();
-                    if (pos.get(usage) == this && pos.getInputType(usage) != InputType.Unchecked) {
-                        assert isAllowedUsageType(pos.getInputType(usage)) : "invalid input of type " + pos.getInputType(usage) + " from " + usage + " to " + this + " (" + pos.getInputName(usage) +
-                                        ")";
-                    }
+        for (Node usage : usages()) {
+            assertFalse(usage.isDeleted(), "usage %s must never be deleted", usage);
+            assertTrue(usage.inputs().contains(this), "missing input in usage %s", usage);
+            NodePosIterator iterator = usage.inputs().iterator();
+            while (iterator.hasNext()) {
+                Position pos = iterator.nextPosition();
+                if (pos.get(usage) == this && pos.getInputType(usage) != InputType.Unchecked) {
+                    assert isAllowedUsageType(pos.getInputType(usage)) : "invalid input of type " + pos.getInputType(usage) + " from " + usage + " to " + this + " (" + pos.getInputName(usage) + ")";
                 }
             }
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -45,10 +45,8 @@
     @Override
     protected boolean verify(StructuredGraph graph, PhaseContext context) {
         for (ConstantNode node : getConstantNodes(graph)) {
-            if (node.recordsUsages()) {
-                if (isObject(node) && !isNullReference(node) && !isInternedString(node) && !isDirectMethodHandle(node) && !isBoundMethodHandle(node)) {
-                    throw new VerificationError("illegal object constant: " + node);
-                }
+            if (isObject(node) && !isNullReference(node) && !isInternedString(node) && !isDirectMethodHandle(node) && !isBoundMethodHandle(node)) {
+                throw new VerificationError("illegal object constant: " + node);
             }
         }
         return true;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.hotspot.phases;
 
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.debug.*;
@@ -109,6 +111,6 @@
         GraphUtil.killCFG(start);
 
         Debug.dump(graph, "OnStackReplacement result");
-        new DeadCodeEliminationPhase().apply(graph);
+        new DeadCodeEliminationPhase(OPTIONAL).apply(graph);
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java	Mon Sep 08 22:21:47 2014 +0100
@@ -100,7 +100,7 @@
             }
             ValueNode removedValue = phi.valueAt(predIndex);
             phi.removeInput(predIndex);
-            if (removedValue != null && removedValue.isAlive() && removedValue.recordsUsages() && removedValue.usages().isEmpty() && GraphUtil.isFloatingNode().apply(removedValue)) {
+            if (removedValue != null && removedValue.isAlive() && removedValue.usages().isEmpty() && GraphUtil.isFloatingNode().apply(removedValue)) {
                 GraphUtil.killWithUnusedFloatingInputs(removedValue);
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java	Mon Sep 08 22:21:47 2014 +0100
@@ -135,17 +135,13 @@
     }
 
     public static void killWithUnusedFloatingInputs(Node node) {
-        if (node.recordsUsages()) {
-            List<Node> floatingInputs = node.inputs().filter(isFloatingNode()).snapshot();
-            node.safeDelete();
+        List<Node> floatingInputs = node.inputs().filter(isFloatingNode()).snapshot();
+        node.safeDelete();
 
-            for (Node in : floatingInputs) {
-                if (in.isAlive() && (!in.recordsUsages() || in.usages().isEmpty())) {
-                    killWithUnusedFloatingInputs(in);
-                }
+        for (Node in : floatingInputs) {
+            if (in.isAlive() && in.usages().isEmpty()) {
+                killWithUnusedFloatingInputs(in);
             }
-        } else {
-            assert node.inputs().isEmpty();
         }
     }
 
@@ -358,7 +354,7 @@
     }
 
     public static boolean tryKillUnused(Node node) {
-        if (node.isAlive() && isFloatingNode().apply(node) && node.recordsUsages() && node.usages().isEmpty()) {
+        if (node.isAlive() && isFloatingNode().apply(node) && node.usages().isEmpty()) {
             killWithUnusedFloatingInputs(node);
             return true;
         }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -832,9 +832,6 @@
         }
 
         private GuardingNode searchAnchor(ValueNode value, ResolvedJavaType type) {
-            if (!value.recordsUsages()) {
-                return null;
-            }
             for (Node n : value.usages()) {
                 if (n instanceof InstanceOfNode) {
                     InstanceOfNode instanceOfNode = (InstanceOfNode) n;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.phases.common;
 
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
+
 import java.util.*;
 
 import com.oracle.graal.api.meta.*;
@@ -101,7 +103,7 @@
             }
         }
 
-        new DeadCodeEliminationPhase().apply(graph);
+        new DeadCodeEliminationPhase(OPTIONAL).apply(graph);
     }
 
     private void visitDeoptBegin(BeginNode deoptBegin, DeoptimizationAction deoptAction, DeoptimizationReason deoptReason, StructuredGraph graph) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -22,18 +22,54 @@
  */
 package com.oracle.graal.phases.common;
 
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Options.*;
+
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 
 public class DeadCodeEliminationPhase extends Phase {
 
+    public static class Options {
+        // @formatter:off
+        @Option(help = "Disable optional dead code eliminations")
+        public static final OptionValue<Boolean> ReduceDCE = new OptionValue<>(true);
+        // @formatter:on
+    }
+
     // Metrics
     private static final DebugMetric metricNodesRemoved = Debug.metric("NodesRemoved");
 
+    public enum Optionality {
+        OPTIONAL,
+        REQUIRED;
+    }
+
+    /**
+     * Creates a dead code elimination phase that will be run irrespective of
+     * {@link Options#ReduceDCE}.
+     */
+    public DeadCodeEliminationPhase() {
+        this(Optionality.REQUIRED);
+    }
+
+    /**
+     * Creates a dead code elimination phase that will be run only if it is
+     * {@linkplain Optionality#REQUIRED non-optional} or {@link Options#ReduceDCE} is false.
+     */
+    public DeadCodeEliminationPhase(Optionality optionality) {
+        this.optional = optionality == Optionality.OPTIONAL;
+    }
+
+    private final boolean optional;
+
     @Override
     public void run(StructuredGraph graph) {
+        if (optional && ReduceDCE.getValue()) {
+            return;
+        }
         NodeFlood flood = graph.createNodeFlood();
 
         flood.add(graph.start());
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowSensitiveReduction.java	Mon Sep 08 22:21:47 2014 +0100
@@ -22,24 +22,23 @@
  */
 package com.oracle.graal.phases.common.cfs;
 
+import static com.oracle.graal.api.meta.DeoptimizationAction.*;
+import static com.oracle.graal.api.meta.DeoptimizationReason.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
+
+import java.lang.reflect.*;
+
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.Node;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.FloatingNode;
-import com.oracle.graal.nodes.calc.IsNullNode;
-import com.oracle.graal.nodes.extended.LoadHubNode;
-import com.oracle.graal.nodes.extended.NullCheckNode;
+import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.compiler.common.type.IllegalStamp;
-import com.oracle.graal.nodes.type.StampTool;
-import com.oracle.graal.nodes.util.GraphUtil;
-import com.oracle.graal.phases.common.DeadCodeEliminationPhase;
-import com.oracle.graal.phases.tiers.PhaseContext;
-
-import java.lang.reflect.Modifier;
-
-import static com.oracle.graal.api.meta.DeoptimizationAction.InvalidateReprofile;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
+import com.oracle.graal.nodes.type.*;
+import com.oracle.graal.nodes.util.*;
+import com.oracle.graal.phases.common.*;
+import com.oracle.graal.phases.tiers.*;
 
 /**
  * <p>
@@ -152,7 +151,7 @@
             for (PostponedDeopt postponed : postponedDeopts) {
                 postponed.doRewrite(falseConstant);
             }
-            new DeadCodeEliminationPhase().apply(graph);
+            new DeadCodeEliminationPhase(OPTIONAL).apply(graph);
         }
         for (MethodCallTargetNode mcn : graph.getNodes().filter(MethodCallTargetNode.class)) {
             if (mcn.isAlive() && FlowUtil.lacksUsages(mcn)) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowUtil.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/cfs/FlowUtil.java	Mon Sep 08 22:21:47 2014 +0100
@@ -37,7 +37,7 @@
     }
 
     public static boolean lacksUsages(Node n) {
-        return n.recordsUsages() && n.usages().isEmpty();
+        return n.usages().isEmpty();
     }
 
     public static ResolvedJavaType widen(ResolvedJavaType a, ResolvedJavaType b) {
@@ -95,11 +95,11 @@
         } else {
             /*
              * Not comparable, two cases:
-             *
+             * 
              * Example 1: 'a' standing for j.l.Number and 'b' for j.l.String We return null for lack
              * of a value representing NullType, the right answer. Same goes when both arguments are
              * non-comparable interfaces.
-             *
+             * 
              * Example 2: 'a' standing for sun/nio/ch/DirectBuffer (an interface) and b for
              * java/nio/Buffer (an abstract class). The class always takes precedence.
              */
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java	Mon Sep 08 22:21:47 2014 +0100
@@ -22,21 +22,20 @@
  */
 package com.oracle.graal.phases.common.inlining.info.elem;
 
+import static com.oracle.graal.compiler.common.GraalOptions.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
+
 import java.util.*;
 
-import com.oracle.graal.api.meta.Constant;
-import com.oracle.graal.api.meta.ResolvedJavaMethod;
-import com.oracle.graal.compiler.common.type.Stamp;
-import com.oracle.graal.debug.Debug;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.phases.common.CanonicalizerPhase;
-import com.oracle.graal.phases.common.DeadCodeEliminationPhase;
-import com.oracle.graal.phases.common.cfs.FlowUtil;
-import com.oracle.graal.phases.common.inlining.InliningUtil;
-import com.oracle.graal.phases.tiers.HighTierContext;
-
-import static com.oracle.graal.compiler.common.GraalOptions.OptCanonicalizer;
+import com.oracle.graal.phases.common.*;
+import com.oracle.graal.phases.common.cfs.*;
+import com.oracle.graal.phases.common.inlining.*;
+import com.oracle.graal.phases.tiers.*;
 
 /**
  * <p>
@@ -245,7 +244,7 @@
             }
             assert newGraph.start().next() != null : "graph needs to be populated by the GraphBuilderSuite";
 
-            new DeadCodeEliminationPhase().apply(newGraph);
+            new DeadCodeEliminationPhase(OPTIONAL).apply(newGraph);
 
             if (OptCanonicalizer.getValue()) {
                 canonicalizer.apply(newGraph, context);
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -625,10 +625,8 @@
             cdbc.apply(cfg.getNodeToBlock().get(succ));
         }
         ensureScheduledUsages(node, strategy);
-        if (node.recordsUsages()) {
-            for (Node usage : node.usages()) {
-                blocksForUsage(node, usage, cdbc, strategy);
-            }
+        for (Node usage : node.usages()) {
+            blocksForUsage(node, usage, cdbc, strategy);
         }
 
         if (assertionEnabled()) {
@@ -820,10 +818,8 @@
     }
 
     private void ensureScheduledUsages(Node node, SchedulingStrategy strategy) {
-        if (node.recordsUsages()) {
-            for (Node usage : node.usages().filter(ScheduledNode.class)) {
-                assignBlockToNode((ScheduledNode) usage, strategy);
-            }
+        for (Node usage : node.usages().filter(ScheduledNode.class)) {
+            assignBlockToNode((ScheduledNode) usage, strategy);
         }
         // now true usages are ready
     }
@@ -1149,16 +1145,14 @@
             }
 
             visited.mark(instruction);
-            if (instruction.recordsUsages()) {
-                for (Node usage : instruction.usages()) {
-                    if (usage instanceof VirtualState) {
-                        // only fixed nodes can have VirtualState -> no need to schedule them
+            for (Node usage : instruction.usages()) {
+                if (usage instanceof VirtualState) {
+                    // only fixed nodes can have VirtualState -> no need to schedule them
+                } else {
+                    if (instruction instanceof LoopExitNode && usage instanceof ProxyNode) {
+                        // value proxies should be scheduled before the loopexit, not after
                     } else {
-                        if (instruction instanceof LoopExitNode && usage instanceof ProxyNode) {
-                            // value proxies should be scheduled before the loopexit, not after
-                        } else {
-                            addToEarliestSorting(b, (ScheduledNode) usage, sortedInstructions, visited);
-                        }
+                        addToEarliestSorting(b, (ScheduledNode) usage, sortedInstructions, visited);
                     }
                 }
             }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Mon Sep 08 22:21:47 2014 +0100
@@ -343,7 +343,7 @@
         out.println("=== Succesors ===");
         printNamedNodes(node, node.successors().iterator(), "", "\n", null);
         out.println("=== Usages ===");
-        if (node.recordsUsages() && !node.usages().isEmpty()) {
+        if (!node.usages().isEmpty()) {
             for (Node usage : node.usages()) {
                 out.print(nodeToString(usage)).print(" ");
             }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -343,8 +343,7 @@
     }
 
     public void cleanUpReturnCheckCast(Node newInstance) {
-        if (newInstance.recordsUsages() && newInstance instanceof ValueNode &&
-                        (((ValueNode) newInstance).getKind() != Kind.Object || ((ValueNode) newInstance).stamp() == StampFactory.forNodeIntrinsic())) {
+        if (newInstance instanceof ValueNode && (((ValueNode) newInstance).getKind() != Kind.Object || ((ValueNode) newInstance).stamp() == StampFactory.forNodeIntrinsic())) {
             StructuredGraph graph = (StructuredGraph) newInstance.graph();
             for (CheckCastNode checkCastNode : newInstance.usages().filter(CheckCastNode.class).snapshot()) {
                 for (Node checkCastUsage : checkCastNode.usages().snapshot()) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Mon Sep 08 22:21:47 2014 +0100
@@ -25,6 +25,7 @@
 import static com.oracle.graal.api.meta.MetaUtil.*;
 import static com.oracle.graal.compiler.GraalCompiler.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
 import java.lang.reflect.*;
 import java.util.*;
@@ -511,7 +512,7 @@
                     new CollapseFrameForSingleSideEffectPhase().apply(graph);
                     break;
             }
-            new DeadCodeEliminationPhase().apply(graph);
+            new DeadCodeEliminationPhase(REQUIRED).apply(graph);
         }
 
         /**
@@ -613,7 +614,7 @@
          */
         protected void afterInlining(StructuredGraph graph) {
             new NodeIntrinsificationPhase(providers, snippetReflection).apply(graph);
-            new DeadCodeEliminationPhase().apply(graph);
+            new DeadCodeEliminationPhase(OPTIONAL).apply(graph);
             if (OptCanonicalizer.getValue()) {
                 new CanonicalizerPhase(true).apply(graph, new PhaseContext(providers, assumptions));
             }
@@ -686,7 +687,7 @@
                     end.disableSafepoint();
                 }
 
-                new DeadCodeEliminationPhase().apply(graph);
+                new DeadCodeEliminationPhase(REQUIRED).apply(graph);
             } catch (Throwable e) {
                 throw Debug.handle(e);
             }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Mon Sep 08 22:21:47 2014 +0100
@@ -26,6 +26,7 @@
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.debug.Debug.*;
 import static com.oracle.graal.graph.util.CollectionsAccess.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 import static com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates.*;
 import static java.util.FormattableFlags.*;
 
@@ -670,7 +671,7 @@
             }
         }
 
-        new DeadCodeEliminationPhase().apply(snippetCopy);
+        new DeadCodeEliminationPhase(REQUIRED).apply(snippetCopy);
 
         assert checkAllVarargPlaceholdersAreDeleted(parameterCount, placeholders);
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java	Mon Sep 08 22:21:47 2014 +0100
@@ -243,7 +243,7 @@
         Mark beforeInvokeMark = graph.getMark();
         expandInvoke(methodCallTarget);
         for (Node arg : argumentSnapshot) {
-            if (arg != null && arg.recordsUsages()) {
+            if (arg != null) {
                 for (Node argUsage : arg.usages()) {
                     if (graph.isNew(beforeInvokeMark, argUsage) && argUsage instanceof Canonicalizable) {
                         canonicalizerUsages.add(argUsage);
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -23,6 +23,7 @@
 package com.oracle.graal.virtual.phases.ea;
 
 import static com.oracle.graal.debug.Debug.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
 import java.util.*;
 
@@ -100,7 +101,7 @@
                     Debug.dump(graph, "after " + getName() + " iteration");
                 }
 
-                new DeadCodeEliminationPhase().apply(graph);
+                new DeadCodeEliminationPhase(REQUIRED).apply(graph);
 
                 Set<Node> changedNodes = listener.getNodes();
                 for (Node node : graph.getNodes()) {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -24,6 +24,7 @@
 
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.debug.Debug.*;
+import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
 import java.util.*;
 
@@ -70,7 +71,7 @@
                 inlining.apply(graph, context);
                 progress |= inlining.getInliningCount() > 0;
 
-                new DeadCodeEliminationPhase().apply(graph);
+                new DeadCodeEliminationPhase(OPTIONAL).apply(graph);
 
                 boolean reduceOrEliminate = FlowSensitiveReduction.getValue() || ConditionalElimination.getValue();
                 if (reduceOrEliminate && OptCanonicalizer.getValue()) {
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java	Mon Sep 08 22:21:21 2014 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java	Mon Sep 08 22:21:47 2014 +0100
@@ -62,9 +62,6 @@
         InferStamps.inferStamps(graph);
 
         for (ValueNode node : graph.getNodes().filter(ValueNode.class)) {
-            if (!node.recordsUsages()) {
-                continue;
-            }
             for (Node usage : node.usages()) {
                 if (usage instanceof AccessMonitorNode) {
                     verify(!isWord(node), node, usage, "word value has no monitor");
--- a/mxtool/mx.py	Mon Sep 08 22:21:21 2014 +0100
+++ b/mxtool/mx.py	Mon Sep 08 22:21:47 2014 +0100
@@ -3114,11 +3114,12 @@
                 if config.exists():
                     os.unlink(config.path)
 
-    if args.dist:
-        for d in _dists.keys():
-            log('Removing distribution {0}...'.format(d))
-            _rmIfExists(distribution(d).path)
-            _rmIfExists(distribution(d).sourcesPath)
+    if args.java:
+        if args.dist:
+            for d in _dists.keys():
+                log('Removing distribution {0}...'.format(d))
+                _rmIfExists(distribution(d).path)
+                _rmIfExists(distribution(d).sourcesPath)
 
     if suppliedParser:
         return args