changeset 7099:3656236c7d27

Cleanup of Kind class: remove use of Unsafe class
author Christian Wimmer <christian.wimmer@oracle.com>
date Thu, 29 Nov 2012 12:17:02 -0800
parents e23980f4a890
children 9d0b98486483 0c59b76e6689
files graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java
diffstat 15 files changed, 123 insertions(+), 183 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Thu Nov 29 12:17:02 2012 -0800
@@ -24,8 +24,6 @@
 
 import java.lang.reflect.*;
 
-import sun.misc.*;
-
 /**
  * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example, {@link Kind#Int}
  * for {@code int} and {@link Kind#Object} for all object types. A kind has a single character short name, a Java name,
@@ -290,112 +288,6 @@
     }
 
     /**
-     * The offset from the origin of an array to the first element.
-     *
-     * @return the offset in bytes
-     */
-    public final int getArrayBaseOffset() {
-        switch (this) {
-            case Boolean:
-                return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
-            case Byte:
-                return Unsafe.ARRAY_BYTE_BASE_OFFSET;
-            case Char:
-                return Unsafe.ARRAY_CHAR_BASE_OFFSET;
-            case Short:
-                return Unsafe.ARRAY_SHORT_BASE_OFFSET;
-            case Int:
-                return Unsafe.ARRAY_INT_BASE_OFFSET;
-            case Long:
-                return Unsafe.ARRAY_LONG_BASE_OFFSET;
-            case Float:
-                return Unsafe.ARRAY_FLOAT_BASE_OFFSET;
-            case Double:
-                return Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
-            case Object:
-                return Unsafe.ARRAY_OBJECT_BASE_OFFSET;
-            default:
-                assert false : "unexpected kind: " + this;
-                return -1;
-        }
-    }
-
-    /**
-     * The scale used for the index when accessing elements of an array of this kind.
-     *
-     * @return the scale in order to convert the index into a byte offset
-     */
-    public final int getArrayIndexScale() {
-        switch (this) {
-            case Boolean:
-                return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
-            case Byte:
-                return Unsafe.ARRAY_BYTE_INDEX_SCALE;
-            case Char:
-                return Unsafe.ARRAY_CHAR_INDEX_SCALE;
-            case Short:
-                return Unsafe.ARRAY_SHORT_INDEX_SCALE;
-            case Int:
-                return Unsafe.ARRAY_INT_INDEX_SCALE;
-            case Long:
-                return Unsafe.ARRAY_LONG_INDEX_SCALE;
-            case Float:
-                return Unsafe.ARRAY_FLOAT_INDEX_SCALE;
-            case Double:
-                return Unsafe.ARRAY_DOUBLE_INDEX_SCALE;
-            case Object:
-                return Unsafe.ARRAY_OBJECT_INDEX_SCALE;
-            default:
-                assert false : "unexpected kind: " + this;
-                return -1;
-        }
-    }
-
-    private static Unsafe unsafeCache;
-
-    private static Unsafe unsafe() {
-        if (unsafeCache == null) {
-            unsafeCache = Unsafe.getUnsafe();
-        }
-        return unsafeCache;
-    }
-
-
-    /**
-     * Utility function for reading a value of this kind using an object and a displacement.
-     *
-     * @param object the object from which the value is read
-     * @param displacement the displacement within the object in bytes
-     * @return the read value encapsulated in a {@link Constant} object
-     */
-    public Constant readUnsafeConstant(Object object, long displacement) {
-        assert object != null : displacement;
-        switch (this) {
-            case Boolean:
-                return Constant.forBoolean(unsafe().getBoolean(object, displacement));
-            case Byte:
-                return Constant.forByte(unsafe().getByte(object, displacement));
-            case Char:
-                return Constant.forChar(unsafe().getChar(object, displacement));
-            case Short:
-                return Constant.forShort(unsafe().getShort(object, displacement));
-            case Int:
-                return Constant.forInt(unsafe().getInt(object, displacement));
-            case Long:
-                return Constant.forLong(unsafe().getLong(object, displacement));
-            case Float:
-                return Constant.forFloat(unsafe().getFloat(object, displacement));
-            case Double:
-                return Constant.forDouble(unsafe().getDouble(object, displacement));
-            case Object:
-                return Constant.forObject(unsafe().getObject(object, displacement));
-            default:
-                assert false : "unexpected kind: " + this;
-                return null;
-        }
-    }
-
-    /**
      * The minimum value that can be represented as a value of this kind.
      *
      * @return the minimum value
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Nov 29 12:17:02 2012 -0800
@@ -164,7 +164,7 @@
         if (GraalOptions.OptFloatingReads) {
             int mark = graph.getMark();
             new FloatingReadPhase().apply(graph);
-            new CanonicalizerPhase(target, runtime, assumptions, mark, null).apply(graph);
+            new CanonicalizerPhase(target, runtime, assumptions, mark).apply(graph);
             if (GraalOptions.OptReadElimination) {
                 new ReadEliminationPhase().apply(graph);
             }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Thu Nov 29 12:17:02 2012 -0800
@@ -29,6 +29,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.ResolvedJavaType.*;
 import com.oracle.graal.hotspot.*;
+import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.phases.*;
 
 /**
@@ -101,12 +102,12 @@
             assert Modifier.isStatic(flags);
             if (holder.isInitialized()) {
                 Constant encoding = holder.getEncoding(getKind() == Kind.Object ? Representation.StaticObjectFields : Representation.StaticPrimitiveFields);
-                return this.getKind().readUnsafeConstant(encoding.asObject(), offset);
+                return ReadNode.readUnsafeConstant(getKind(), encoding.asObject(), offset);
             }
             return null;
         } else {
             assert !Modifier.isStatic(flags);
-            return this.getKind().readUnsafeConstant(receiver.asObject(), offset);
+            return ReadNode.readUnsafeConstant(getKind(), receiver.asObject(), offset);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu Nov 29 12:17:02 2012 -0800
@@ -38,6 +38,8 @@
 import java.lang.reflect.*;
 import java.util.*;
 
+import sun.misc.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.code.CodeUtil.RefMapFormatter;
 import com.oracle.graal.api.code.CompilationResult.Call;
@@ -81,6 +83,66 @@
 
     private final Map<Descriptor, RuntimeCall> runtimeCalls = new HashMap<>();
 
+    /**
+     * The offset from the origin of an array to the first element.
+     *
+     * @return the offset in bytes
+     */
+    public static int getArrayBaseOffset(Kind kind) {
+        switch (kind) {
+            case Boolean:
+                return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
+            case Byte:
+                return Unsafe.ARRAY_BYTE_BASE_OFFSET;
+            case Char:
+                return Unsafe.ARRAY_CHAR_BASE_OFFSET;
+            case Short:
+                return Unsafe.ARRAY_SHORT_BASE_OFFSET;
+            case Int:
+                return Unsafe.ARRAY_INT_BASE_OFFSET;
+            case Long:
+                return Unsafe.ARRAY_LONG_BASE_OFFSET;
+            case Float:
+                return Unsafe.ARRAY_FLOAT_BASE_OFFSET;
+            case Double:
+                return Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
+            case Object:
+                return Unsafe.ARRAY_OBJECT_BASE_OFFSET;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
+        }
+    }
+
+    /**
+     * The scale used for the index when accessing elements of an array of this kind.
+     *
+     * @return the scale in order to convert the index into a byte offset
+     */
+    public static int getArrayIndexScale(Kind kind) {
+        switch (kind) {
+            case Boolean:
+                return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
+            case Byte:
+                return Unsafe.ARRAY_BYTE_INDEX_SCALE;
+            case Char:
+                return Unsafe.ARRAY_CHAR_INDEX_SCALE;
+            case Short:
+                return Unsafe.ARRAY_SHORT_INDEX_SCALE;
+            case Int:
+                return Unsafe.ARRAY_INT_INDEX_SCALE;
+            case Long:
+                return Unsafe.ARRAY_LONG_INDEX_SCALE;
+            case Float:
+                return Unsafe.ARRAY_FLOAT_INDEX_SCALE;
+            case Double:
+                return Unsafe.ARRAY_DOUBLE_INDEX_SCALE;
+            case Object:
+                return Unsafe.ARRAY_OBJECT_INDEX_SCALE;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
+        }
+    }
+
     protected Value ret(Kind kind) {
         if (kind == Kind.Void) {
             return ILLEGAL;
@@ -581,7 +643,7 @@
     }
 
     private static IndexedLocationNode createArrayLocation(Graph graph, Kind elementKind, ValueNode index) {
-        return IndexedLocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, elementKind.getArrayBaseOffset(), index, graph, true);
+        return IndexedLocationNode.create(LocationNode.getArrayLocation(elementKind), elementKind, getArrayBaseOffset(elementKind), index, graph, true);
     }
 
     private SafeReadNode safeReadArrayLength(ValueNode array, long leafGraphId) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java	Thu Nov 29 12:17:02 2012 -0800
@@ -27,6 +27,7 @@
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.snippets.Snippet.Fold;
@@ -154,12 +155,12 @@
 
     @Fold
     static int arrayBaseOffset(Kind elementKind) {
-        return elementKind.getArrayBaseOffset();
+        return HotSpotRuntime.getArrayBaseOffset(elementKind);
     }
 
     @Fold
     static int arrayIndexScale(Kind elementKind) {
-        return elementKind.getArrayIndexScale();
+        return HotSpotRuntime.getArrayIndexScale(elementKind);
     }
 
     @Fold
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java	Thu Nov 29 12:17:02 2012 -0800
@@ -296,7 +296,7 @@
             ResolvedJavaType arrayType = elementType.getArrayClass();
             Kind elementKind = elementType.getKind();
             final int alignment = target.wordSize;
-            final int headerSize = elementKind.getArrayBaseOffset();
+            final int headerSize = HotSpotRuntime.getArrayBaseOffset(elementKind);
             final Integer length = lengthNode.isConstant() ? Integer.valueOf(lengthNode.asConstant().asInt()) : null;
             int log2ElementSize = CodeUtil.log2(target.sizeInBytes(elementKind));
             if (!useTLAB) {
@@ -363,7 +363,7 @@
             assert elementType != null;
             ConstantNode hub = ConstantNode.forConstant(type.klass(), runtime, graph);
             Kind elementKind = elementType.getKind();
-            final int headerSize = elementKind.getArrayBaseOffset();
+            final int headerSize = HotSpotRuntime.getArrayBaseOffset(elementKind);
             Key key = new Key(elementKind == Kind.Object ? initializeObjectArray : initializePrimitiveArray).add("headerSize", headerSize).add("fillContents", initializeNode.fillContents()).add("locked", initializeNode.locked());
             ValueNode memory = initializeNode.memory();
             Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeMarkWord", type.prototypeMarkWord()).add("size", initializeNode.size()).add("length", initializeNode.length());
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java	Thu Nov 29 12:17:02 2012 -0800
@@ -44,10 +44,6 @@
             return null;
         }
         @Override
-        public boolean isImmutable(Constant objectConstant) {
-            return false;
-        }
-        @Override
         public Assumptions assumptions() {
             return null;
         }
@@ -85,7 +81,7 @@
         while (!loopBegin.isDeleted()) {
             int mark = graph.getMark();
             peel(loop);
-            new CanonicalizerPhase(null, runtime, assumptions, mark, null).apply(graph);
+            new CanonicalizerPhase(null, runtime, assumptions, mark).apply(graph);
             if (iterations++ > UNROLL_LIMIT || graph.getNodeCount() > GraalOptions.MaximumDesiredSize * 3) {
                 throw new BailoutException("FullUnroll : Graph seems to grow out of proportion");
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Thu Nov 29 12:17:02 2012 -0800
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.nodes.extended;
 
+import static com.oracle.graal.graph.FieldIntrospection.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
@@ -47,6 +48,39 @@
         return canonicalizeRead(this, tool);
     }
 
+    /**
+     * Utility function for reading a value of this kind using an object and a displacement.
+     *
+     * @param object the object from which the value is read
+     * @param displacement the displacement within the object in bytes
+     * @return the read value encapsulated in a {@link Constant} object
+     */
+    public static Constant readUnsafeConstant(Kind kind, Object object, long displacement) {
+        assert object != null;
+        switch (kind) {
+            case Boolean:
+                return Constant.forBoolean(unsafe.getBoolean(object, displacement));
+            case Byte:
+                return Constant.forByte(unsafe.getByte(object, displacement));
+            case Char:
+                return Constant.forChar(unsafe.getChar(object, displacement));
+            case Short:
+                return Constant.forShort(unsafe.getShort(object, displacement));
+            case Int:
+                return Constant.forInt(unsafe.getInt(object, displacement));
+            case Long:
+                return Constant.forLong(unsafe.getLong(object, displacement));
+            case Float:
+                return Constant.forFloat(unsafe.getFloat(object, displacement));
+            case Double:
+                return Constant.forDouble(unsafe.getDouble(object, displacement));
+            case Object:
+                return Constant.forObject(unsafe.getObject(object, displacement));
+            default:
+                throw GraalInternalError.shouldNotReachHere();
+        }
+    }
+
     public static ValueNode canonicalizeRead(Access read, CanonicalizerTool tool) {
         MetaAccessProvider runtime = tool.runtime();
         if (runtime != null && read.object() != null && read.object().isConstant() && read.object().kind() == Kind.Object) {
@@ -55,10 +89,8 @@
                 if (value != null) {
                     long displacement = read.location().displacement();
                     Kind kind = read.location().getValueKind();
-                    Constant constant = kind.readUnsafeConstant(value, displacement);
-                    if (constant != null) {
-                        return ConstantNode.forConstant(constant, runtime, read.node().graph());
-                    }
+                    Constant constant = readUnsafeConstant(kind, value, displacement);
+                    return ConstantNode.forConstant(constant, runtime, read.node().graph());
                 }
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Thu Nov 29 12:17:02 2012 -0800
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import java.lang.reflect.*;
-
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
@@ -34,7 +32,7 @@
 /**
  * The {@code LoadIndexedNode} represents a read from an element of an array.
  */
-public final class LoadIndexedNode extends AccessIndexedNode implements Canonicalizable, Node.IterableNodeType, Virtualizable {
+public final class LoadIndexedNode extends AccessIndexedNode implements Node.IterableNodeType, Virtualizable {
 
     /**
      * Creates a new LoadIndexedNode.
@@ -55,24 +53,6 @@
     }
 
     @Override
-    public ValueNode canonical(CanonicalizerTool tool) {
-        MetaAccessProvider runtime = tool.runtime();
-        if (runtime != null && index().isConstant() && array().isConstant() && !array().isNullConstant()) {
-            Constant arrayConst = array().asConstant();
-            if (tool.isImmutable(arrayConst)) {
-                int index = index().asConstant().asInt();
-                Object array = arrayConst.asObject();
-                int length = Array.getLength(array);
-                if (index >= 0 && index < length) {
-                    return ConstantNode.forConstant(elementKind().readUnsafeConstant(array,
-                                    elementKind().getArrayBaseOffset() + index * elementKind().getArrayIndexScale()), runtime, graph());
-                }
-            }
-        }
-        return this;
-    }
-
-    @Override
     public void virtualize(VirtualizerTool tool) {
         VirtualObjectNode virtualArray = tool.getVirtualState(array());
         if (virtualArray != null) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java	Thu Nov 29 12:17:02 2012 -0800
@@ -30,10 +30,4 @@
     TargetDescription target();
     Assumptions assumptions();
     MetaAccessProvider runtime();
-
-    /**
-     * Determines if a given constant is an object/array whose current
-     * fields/elements will never change.
-     */
-    boolean isImmutable(Constant objectConstant);
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Thu Nov 29 12:17:02 2012 -0800
@@ -50,7 +50,6 @@
     private final TargetDescription target;
     private final Assumptions assumptions;
     private final MetaAccessProvider runtime;
-    private final IsImmutablePredicate immutabilityPredicate;
     private final Iterable<Node> initWorkingSet;
 
     private NodeWorkList workList;
@@ -58,7 +57,7 @@
     private List<Node> snapshotTemp;
 
     public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions) {
-        this(target, runtime, assumptions, null, 0, null);
+        this(target, runtime, assumptions, null, 0);
     }
 
     /**
@@ -66,26 +65,24 @@
      * @param runtime
      * @param assumptions
      * @param workingSet the initial working set of nodes on which the canonicalizer works, should be an auto-grow node bitmap
-     * @param immutabilityPredicate
      */
-    public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, Iterable<Node> workingSet, IsImmutablePredicate immutabilityPredicate) {
-        this(target, runtime, assumptions, workingSet, 0, immutabilityPredicate);
+    public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, Iterable<Node> workingSet) {
+        this(target, runtime, assumptions, workingSet, 0);
     }
 
     /**
      * @param newNodesMark only the {@linkplain Graph#getNewNodes(int) new nodes} specified by
      *            this mark are processed otherwise all nodes in the graph are processed
      */
-    public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, int newNodesMark, IsImmutablePredicate immutabilityPredicate) {
-        this(target, runtime, assumptions, null, newNodesMark, immutabilityPredicate);
+    public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, int newNodesMark) {
+        this(target, runtime, assumptions, null, newNodesMark);
     }
 
-    private CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, Iterable<Node> workingSet, int newNodesMark, IsImmutablePredicate immutabilityPredicate) {
+    private CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, Iterable<Node> workingSet, int newNodesMark) {
         this.newNodesMark = newNodesMark;
         this.target = target;
         this.assumptions = assumptions;
         this.runtime = runtime;
-        this.immutabilityPredicate = immutabilityPredicate;
         this.initWorkingSet = workingSet;
         this.snapshotTemp = new ArrayList<>();
     }
@@ -101,18 +98,10 @@
             workList = graph.createNodeWorkList(false, MAX_ITERATION_PER_NODE);
             workList.addAll(initWorkingSet);
         }
-        tool = new Tool(workList, runtime, target, assumptions, immutabilityPredicate);
+        tool = new Tool(workList, runtime, target, assumptions);
         processWorkSet(graph);
     }
 
-    public interface IsImmutablePredicate {
-        /**
-         * Determines if a given constant is an object/array whose current
-         * fields/elements will never change.
-         */
-        boolean apply(Constant constant);
-    }
-
     private void processWorkSet(StructuredGraph graph) {
         graph.trackInputChange(new InputChangedListener() {
             @Override
@@ -288,14 +277,12 @@
         private final MetaAccessProvider runtime;
         private final TargetDescription target;
         private final Assumptions assumptions;
-        private final IsImmutablePredicate immutabilityPredicate;
 
-        public Tool(NodeWorkList nodeWorkSet, MetaAccessProvider runtime, TargetDescription target, Assumptions assumptions, IsImmutablePredicate immutabilityPredicate) {
+        public Tool(NodeWorkList nodeWorkSet, MetaAccessProvider runtime, TargetDescription target, Assumptions assumptions) {
             this.nodeWorkSet = nodeWorkSet;
             this.runtime = runtime;
             this.target = target;
             this.assumptions = assumptions;
-            this.immutabilityPredicate = immutabilityPredicate;
         }
 
         @Override
@@ -329,10 +316,5 @@
         public void addToWorkList(Node node) {
             nodeWorkSet.addAgain(node);
         }
-
-        @Override
-        public boolean isImmutable(Constant objectConstant) {
-            return immutabilityPredicate != null && immutabilityPredicate.apply(objectConstant);
-        }
     }
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Thu Nov 29 12:17:02 2012 -0800
@@ -89,7 +89,7 @@
                         Debug.dump(graph, "after %s", candidate);
                         Iterable<Node> newNodes = graph.getNewNodes(mark);
                         if (GraalOptions.OptCanonicalizer) {
-                            new CanonicalizerPhase(target, runtime, assumptions, mark, null).apply(graph);
+                            new CanonicalizerPhase(target, runtime, assumptions, mark).apply(graph);
                         }
                         metricInliningPerformed.increment();
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Thu Nov 29 12:17:02 2012 -0800
@@ -55,7 +55,7 @@
             if (canonicalizationRoots.isEmpty()) {
                 break;
             }
-            new CanonicalizerPhase(target, runtime, assumptions, canonicalizationRoots, null).apply(graph);
+            new CanonicalizerPhase(target, runtime, assumptions, canonicalizationRoots).apply(graph);
             canonicalizationRoots.clear();
         }
     }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Thu Nov 29 12:17:02 2012 -0800
@@ -129,7 +129,7 @@
 
             processBlock(schedule.getCFG().getStartBlock(), graph.createNodeBitMap(), null, schedule, processed);
             Debug.dump(graph, "Lowering iteration %d", i++);
-            new CanonicalizerPhase(null, runtime, assumptions, mark, null).apply(graph);
+            new CanonicalizerPhase(null, runtime, assumptions, mark).apply(graph);
 
             if (!containsLowerable(graph.getNewNodes(mark))) {
                 // No new lowerable nodes - done!
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java	Thu Nov 29 11:27:23 2012 -0800
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java	Thu Nov 29 12:17:02 2012 -0800
@@ -267,7 +267,7 @@
             new SnippetIntrinsificationPhase(runtime, new BoxingMethodPool(runtime), false).apply(snippetCopy);
             new WordTypeRewriterPhase(target.wordKind).apply(snippetCopy);
 
-            new CanonicalizerPhase(null, runtime, assumptions, 0, null).apply(snippetCopy);
+            new CanonicalizerPhase(null, runtime, assumptions, 0).apply(snippetCopy);
         }
 
         // Gather the template parameters
@@ -321,7 +321,7 @@
                     LoopEx loop = new LoopsData(snippetCopy).loop(loopBegin);
                     int mark = snippetCopy.getMark();
                     LoopTransformations.fullUnroll(loop, runtime, null);
-                    new CanonicalizerPhase(null, runtime, assumptions, mark, null).apply(snippetCopy);
+                    new CanonicalizerPhase(null, runtime, assumptions, mark).apply(snippetCopy);
                 }
                 FixedNode explodeLoopNext = explodeLoop.next();
                 explodeLoop.clearSuccessors();