changeset 14521:29ccc4cbabca

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 12 Mar 2014 13:30:08 +0100
parents f84115370178 (diff) d8041d695d19 (current diff)
children 7c36ec150036
files agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java make/bsd/makefiles/gcc.make src/os/bsd/dtrace/hotspot.d src/os/bsd/dtrace/hotspot_jni.d src/os/bsd/dtrace/hs_private.d src/os/solaris/dtrace/hotspot.d src/os/solaris/dtrace/hotspot_jni.d src/os/solaris/dtrace/hs_private.d src/share/vm/code/nmethod.cpp src/share/vm/code/nmethod.hpp src/share/vm/opto/node.cpp src/share/vm/runtime/deoptimization.cpp src/share/vm/utilities/dtrace_usdt2_disabled.hpp
diffstat 125 files changed, 733 insertions(+), 888 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG.md	Tue Mar 11 18:45:59 2014 -0700
+++ b/CHANGELOG.md	Wed Mar 12 13:30:08 2014 +0100
@@ -3,7 +3,8 @@
 ## `tip`
 ### Graal
 * New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive).
-* ...
+* New (tested) invariant that equality comparisons for JavaType/JavaMethod/JavaField values use .equals() instead of '=='.
+* Made graph caching compilation-local.
 
 ### Truffle
 * ...
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java	Wed Mar 12 13:30:08 2014 +0100
@@ -67,10 +67,10 @@
      * 
      * @return sorted list of blocks
      */
-    public static List<Block> computeLinearScanOrder(int blockCount, Block startBlock, NodesToDoubles nodeProbabilities) {
-        List<Block> order = new ArrayList<>();
+    public static <T extends AbstractBlock<T>> List<T> computeLinearScanOrder(int blockCount, T startBlock, NodesToDoubles nodeProbabilities) {
+        List<T> order = new ArrayList<>();
         BitSet visitedBlocks = new BitSet(blockCount);
-        PriorityQueue<Block> worklist = initializeWorklist(startBlock, visitedBlocks, nodeProbabilities);
+        PriorityQueue<T> worklist = initializeWorklist(startBlock, visitedBlocks, nodeProbabilities);
         computeLinearScanOrder(order, worklist, visitedBlocks, nodeProbabilities);
         assert checkOrder(order, blockCount);
         return order;
@@ -81,10 +81,10 @@
      * 
      * @return sorted list of blocks
      */
-    public static List<Block> computeCodeEmittingOrder(int blockCount, Block startBlock, NodesToDoubles nodeProbabilities) {
-        List<Block> order = new ArrayList<>();
+    public static <T extends AbstractBlock<T>> List<T> computeCodeEmittingOrder(int blockCount, T startBlock, NodesToDoubles nodeProbabilities) {
+        List<T> order = new ArrayList<>();
         BitSet visitedBlocks = new BitSet(blockCount);
-        PriorityQueue<Block> worklist = initializeWorklist(startBlock, visitedBlocks, nodeProbabilities);
+        PriorityQueue<T> worklist = initializeWorklist(startBlock, visitedBlocks, nodeProbabilities);
         computeCodeEmittingOrder(order, worklist, visitedBlocks, nodeProbabilities);
         assert checkOrder(order, blockCount);
         return order;
@@ -93,9 +93,9 @@
     /**
      * Iteratively adds paths to the code emission block order.
      */
-    private static void computeCodeEmittingOrder(List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
+    private static <T extends AbstractBlock<T>> void computeCodeEmittingOrder(List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
         while (!worklist.isEmpty()) {
-            Block nextImportantPath = worklist.poll();
+            T nextImportantPath = worklist.poll();
             addPathToCodeEmittingOrder(nextImportantPath, order, worklist, visitedBlocks, nodeProbabilities);
         }
     }
@@ -103,9 +103,9 @@
     /**
      * Iteratively adds paths to the linear scan block order.
      */
-    private static void computeLinearScanOrder(List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
+    private static <T extends AbstractBlock<T>> void computeLinearScanOrder(List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
         while (!worklist.isEmpty()) {
-            Block nextImportantPath = worklist.poll();
+            T nextImportantPath = worklist.poll();
             addPathToLinearScanOrder(nextImportantPath, order, worklist, visitedBlocks, nodeProbabilities);
         }
     }
@@ -113,8 +113,8 @@
     /**
      * Initializes the priority queue used for the work list of blocks and adds the start block.
      */
-    private static PriorityQueue<Block> initializeWorklist(Block startBlock, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
-        PriorityQueue<Block> result = new PriorityQueue<>(INITIAL_WORKLIST_CAPACITY, new BlockOrderComparator(nodeProbabilities));
+    private static <T extends AbstractBlock<T>> PriorityQueue<T> initializeWorklist(T startBlock, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
+        PriorityQueue<T> result = new PriorityQueue<>(INITIAL_WORKLIST_CAPACITY, new BlockOrderComparator<T>(nodeProbabilities));
         result.add(startBlock);
         visitedBlocks.set(startBlock.getId());
         return result;
@@ -123,17 +123,17 @@
     /**
      * Add a linear path to the linear scan order greedily following the most likely successor.
      */
-    private static void addPathToLinearScanOrder(Block block, List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
+    private static <T extends AbstractBlock<T>> void addPathToLinearScanOrder(T block, List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
         block.setLinearScanNumber(order.size());
         order.add(block);
-        Block mostLikelySuccessor = findAndMarkMostLikelySuccessor(block, visitedBlocks, nodeProbabilities);
+        T mostLikelySuccessor = findAndMarkMostLikelySuccessor(block, visitedBlocks, nodeProbabilities);
         enqueueSuccessors(block, worklist, visitedBlocks);
         if (mostLikelySuccessor != null) {
             if (!mostLikelySuccessor.isLoopHeader() && mostLikelySuccessor.getPredecessorCount() > 1) {
                 // We are at a merge. Check probabilities of predecessors that are not yet
                 // scheduled.
                 double unscheduledSum = 0.0;
-                for (Block pred : mostLikelySuccessor.getPredecessors()) {
+                for (T pred : mostLikelySuccessor.getPredecessors()) {
                     if (pred.getLinearScanNumber() == -1) {
                         unscheduledSum += nodeProbabilities.get(pred.getBeginNode());
                     }
@@ -152,8 +152,9 @@
     /**
      * Add a linear path to the code emission order greedily following the most likely successor.
      */
-    private static void addPathToCodeEmittingOrder(Block initialBlock, List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
-        Block block = initialBlock;
+    @SuppressWarnings("unchecked")
+    private static <T extends AbstractBlock<T>> void addPathToCodeEmittingOrder(T initialBlock, List<T> order, PriorityQueue<T> worklist, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
+        T block = initialBlock;
         while (block != null) {
             // Skip loop headers if there is only a single loop end block to
             // make the backward jump be a conditional jump.
@@ -171,7 +172,7 @@
 
                 // This is the only loop end of a skipped loop header.
                 // Add the header immediately afterwards.
-                addBlock(loop.header, order);
+                addBlock((T) loop.header, order);
 
                 // Make sure the loop successors of the loop header are aligned
                 // as they are the target
@@ -183,7 +184,7 @@
                 }
             }
 
-            Block mostLikelySuccessor = findAndMarkMostLikelySuccessor(block, visitedBlocks, nodeProbabilities);
+            T mostLikelySuccessor = findAndMarkMostLikelySuccessor(block, visitedBlocks, nodeProbabilities);
             enqueueSuccessors(block, worklist, visitedBlocks);
             block = mostLikelySuccessor;
         }
@@ -192,7 +193,7 @@
     /**
      * Adds a block to the ordering.
      */
-    private static void addBlock(Block header, List<Block> order) {
+    private static <T extends AbstractBlock<T>> void addBlock(T header, List<T> order) {
         assert !order.contains(header) : "Cannot insert block twice";
         order.add(header);
     }
@@ -200,9 +201,9 @@
     /**
      * Find the highest likely unvisited successor block of a given block.
      */
-    private static Block findAndMarkMostLikelySuccessor(Block block, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
-        Block result = null;
-        for (Block successor : block.getSuccessors()) {
+    private static <T extends AbstractBlock<T>> T findAndMarkMostLikelySuccessor(T block, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) {
+        T result = null;
+        for (T successor : block.getSuccessors()) {
             assert nodeProbabilities.get(successor.getBeginNode()) >= 0.0 : "Probabilities must be positive";
             if (!visitedBlocks.get(successor.getId()) && successor.getLoopDepth() >= block.getLoopDepth() &&
                             (result == null || nodeProbabilities.get(successor.getBeginNode()) >= nodeProbabilities.get(result.getBeginNode()))) {
@@ -218,8 +219,8 @@
     /**
      * Add successor blocks into the given work list if they are not already marked as visited.
      */
-    private static void enqueueSuccessors(Block block, PriorityQueue<Block> worklist, BitSet visitedBlocks) {
-        for (Block successor : block.getSuccessors()) {
+    private static <T extends AbstractBlock<T>> void enqueueSuccessors(T block, PriorityQueue<T> worklist, BitSet visitedBlocks) {
+        for (T successor : block.getSuccessors()) {
             if (!visitedBlocks.get(successor.getId())) {
                 visitedBlocks.set(successor.getId());
                 worklist.add(successor);
@@ -231,14 +232,14 @@
      * Skip the loop header block if the loop consists of more than one block and it has only a
      * single loop end block.
      */
-    private static boolean skipLoopHeader(Block block) {
+    private static boolean skipLoopHeader(AbstractBlock<?> block) {
         return (block.isLoopHeader() && !block.isLoopEnd() && block.getLoop().loopBegin().loopEnds().count() == 1);
     }
 
     /**
      * Checks that the ordering contains the expected number of blocks.
      */
-    private static boolean checkOrder(List<Block> order, int expectedBlockCount) {
+    private static boolean checkOrder(List<? extends AbstractBlock<?>> order, int expectedBlockCount) {
         assert order.size() == expectedBlockCount : String.format("Number of blocks in ordering (%d) does not match expected block count (%d)", order.size(), expectedBlockCount);
         return true;
     }
@@ -246,7 +247,7 @@
     /**
      * Comparator for sorting blocks based on loop depth and probability.
      */
-    private static class BlockOrderComparator implements Comparator<Block> {
+    private static class BlockOrderComparator<T extends AbstractBlock<T>> implements Comparator<T> {
 
         private final NodesToDoubles probabilities;
 
@@ -255,7 +256,7 @@
         }
 
         @Override
-        public int compare(Block a, Block b) {
+        public int compare(T a, T b) {
             // Loop blocks before any loop exit block.
             int diff = b.getLoopDepth() - a.getLoopDepth();
             if (diff != 0) {
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java	Wed Mar 12 13:30:08 2014 +0100
@@ -64,7 +64,7 @@
         public boolean equals(Object obj) {
             if (obj instanceof NoFinalizableSubclass) {
                 NoFinalizableSubclass other = (NoFinalizableSubclass) obj;
-                return other.receiverType == receiverType;
+                return other.receiverType.equals(receiverType);
             }
             return false;
         }
@@ -112,7 +112,7 @@
         public boolean equals(Object obj) {
             if (obj instanceof ConcreteSubtype) {
                 ConcreteSubtype other = (ConcreteSubtype) obj;
-                return other.context == context && other.subtype == subtype;
+                return other.context.equals(context) && other.subtype.equals(subtype);
             }
             return false;
         }
@@ -166,7 +166,7 @@
         public boolean equals(Object obj) {
             if (obj instanceof ConcreteMethod) {
                 ConcreteMethod other = (ConcreteMethod) obj;
-                return other.method == method && other.context == context && other.impl == impl;
+                return other.method.equals(method) && other.context.equals(context) && other.impl.equals(impl);
             }
             return false;
         }
@@ -197,9 +197,9 @@
 
         @Override
         public boolean equals(Object obj) {
-            if (obj instanceof ConcreteMethod) {
-                ConcreteMethod other = (ConcreteMethod) obj;
-                return other.method == method;
+            if (obj instanceof MethodContents) {
+                MethodContents other = (MethodContents) obj;
+                return other.method.equals(method);
             }
             return false;
         }
@@ -387,7 +387,7 @@
             }
         }
 
-        out.printf("%d assumptions:\n", nonNullList.size());
+        out.printf("%d assumptions:%n", nonNullList.size());
         for (Assumption a : nonNullList) {
             out.println(a.toString());
         }
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java	Wed Mar 12 13:30:08 2014 +0100
@@ -464,13 +464,6 @@
 
     private Assumptions assumptions;
 
-    /**
-     * The leafGraphIds will contain the StructuredGraph.graphId()s of the graphs that were
-     * incorporated into this compilation. These ids are later on used by the runtime system to
-     * evict graphs from the graph cache when deoptimizations occur.
-     */
-    private long[] leafGraphIds;
-
     public CompilationResult() {
         this(null);
     }
@@ -515,14 +508,6 @@
         return assumptions;
     }
 
-    public void setLeafGraphIds(long[] leafGraphIds) {
-        this.leafGraphIds = leafGraphIds;
-    }
-
-    public long[] getLeafGraphIds() {
-        return leafGraphIds;
-    }
-
     /**
      * Sets the frame size in bytes. Does not include the return address pushed onto the stack, if
      * any.
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java	Wed Mar 12 13:30:08 2014 +0100
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.api.code;
 
-import java.io.*;
-
 /**
  * Represents the debugging information for a particular point of execution. This information
  * includes:
@@ -35,9 +33,7 @@
  * <li>a map from the registers (in the caller's frame) to the slots where they are saved in the
  * current frame</li>
  */
-public class DebugInfo implements Serializable {
-
-    private static final long serialVersionUID = -6047206624915812516L;
+public class DebugInfo {
 
     private final BytecodePosition bytecodePosition;
     private final ReferenceMap referenceMap;
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Wed Mar 12 13:30:08 2014 +0100
@@ -22,16 +22,12 @@
  */
 package com.oracle.graal.api.code;
 
-import java.io.*;
-
 import com.oracle.graal.api.meta.*;
 
 /**
  * Represents a target machine register.
  */
-public final class Register implements Comparable<Register>, Serializable {
-
-    private static final long serialVersionUID = -7213269157816016300L;
+public final class Register implements Comparable<Register> {
 
     public static final RegisterCategory SPECIAL = new RegisterCategory("SPECIAL");
 
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Wed Mar 12 13:30:08 2014 +0100
@@ -87,7 +87,7 @@
                         }
                     } else {
                         ResolvedJavaField[] fields = vo.type.getInstanceFields(true);
-                        assert fields.length == vo.values.length : vo.type + ", fields=" + Arrays.toString(fields) + ", values=" + vo.values;
+                        assert fields.length == vo.values.length : vo.type + ", fields=" + Arrays.toString(fields) + ", values=" + Arrays.toString(vo.values);
                         for (int i = 0; i < vo.values.length; i++) {
                             if (i != 0) {
                                 buf.append(',');
@@ -185,11 +185,11 @@
         }
         if (o instanceof VirtualObject) {
             VirtualObject l = (VirtualObject) o;
-            if (l.type != type || l.values.length != values.length) {
+            if (!l.type.equals(type) || l.values.length != values.length) {
                 return false;
             }
             for (int i = 0; i < values.length; i++) {
-                if (values[i] != l.values[i]) {
+                if (!Objects.equals(values[i], l.values[i])) {
                     return false;
                 }
             }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractJavaProfile.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractJavaProfile.java	Wed Mar 12 13:30:08 2014 +0100
@@ -43,7 +43,7 @@
 
     public AbstractJavaProfile(double notRecordedProbability, T[] pitems) {
         this.pitems = pitems;
-        assert notRecordedProbability != Double.NaN;
+        assert !Double.isNaN(notRecordedProbability);
         this.notRecordedProbability = notRecordedProbability;
         assert isSorted();
     }
@@ -124,28 +124,26 @@
     }
 
     @Override
-    public boolean equals(Object other) {
-        if (other == this) {
+    public boolean equals(Object obj) {
+        if (obj == this) {
             return true;
         }
-        if (getClass() == other.getClass()) {
-            AbstractJavaProfile javaTypeProfile = (AbstractJavaProfile) other;
-            if (javaTypeProfile.notRecordedProbability != notRecordedProbability) {
+        if (!(obj instanceof AbstractJavaProfile)) {
+            return false;
+        }
+        AbstractJavaProfile that = (AbstractJavaProfile) obj;
+        if (that.notRecordedProbability != notRecordedProbability) {
+            return false;
+        }
+        if (that.pitems.length != pitems.length) {
+            return false;
+        }
+        for (int i = 0; i < pitems.length; ++i) {
+            if (!pitems[i].equals(that.pitems[i])) {
                 return false;
             }
-            if (javaTypeProfile.pitems.length != pitems.length) {
-                return false;
-            }
-
-            for (int i = 0; i < pitems.length; ++i) {
-                if (!pitems[i].equals(javaTypeProfile.pitems[i])) {
-                    return false;
-                }
-            }
-
-            return true;
         }
-        return false;
+        return true;
     }
 
     @Override
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Wed Mar 12 13:30:08 2014 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.api.meta;
 
+import java.util.*;
+
 /**
  * Represents an exception handler within the bytecodes.
  */
@@ -97,14 +99,14 @@
 
     @Override
     public boolean equals(Object obj) {
+        if (!(obj instanceof ExceptionHandler)) {
+            return false;
+        }
         ExceptionHandler that = (ExceptionHandler) obj;
         if (this.startBCI != that.startBCI || this.endBCI != that.endBCI || this.handlerBCI != that.handlerBCI || this.catchTypeCPI != that.catchTypeCPI) {
             return false;
         }
-        if (this.catchType == null || that.catchType == null) {
-            return this.catchType == that.catchType;
-        }
-        return this.catchType.equals(that.catchType);
+        return Objects.equals(this.catchType, that.catchType);
     }
 
     @Override
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Wed Mar 12 13:30:08 2014 +0100
@@ -185,6 +185,9 @@
      */
     boolean canBeInlined();
 
+    /**
+     * Returns {@code true} if the inlining of this method should be forced.
+     */
     boolean shouldBeInlined();
 
     /**
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Wed Mar 12 13:30:08 2014 +0100
@@ -87,8 +87,8 @@
     @Override
     public boolean equals(Object obj) {
         if (obj instanceof Value) {
-            Value other = (Value) obj;
-            return kind.equals(other.kind) && platformKind.equals(platformKind);
+            Value that = (Value) obj;
+            return kind.equals(that.kind) && platformKind.equals(that.platformKind);
         }
         return false;
     }
--- a/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java	Wed Mar 12 13:30:08 2014 +0100
@@ -698,9 +698,6 @@
     @Override
     public void jmp(Label l) {
         String str = nameOf(l);
-        if (l.equals("?")) {
-            Thread.dumpStack();
-        }
         bra(str);
     }
 
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Wed Mar 12 13:30:08 2014 +0100
@@ -89,7 +89,7 @@
 
     public AMD64LIRGenerator(StructuredGraph graph, Providers providers, FrameMap frameMap, CallingConvention cc, LIR lir) {
         super(graph, providers, frameMap, cc, lir);
-        lir.spillMoveFactory = new AMD64SpillMoveFactory();
+        lir.setSpillMoveFactory(new AMD64SpillMoveFactory());
     }
 
     @Override
--- a/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java	Wed Mar 12 13:30:08 2014 +0100
@@ -78,7 +78,7 @@
 
     public HSAILLIRGenerator(StructuredGraph graph, Providers providers, FrameMap frameMap, CallingConvention cc, LIR lir) {
         super(graph, providers, frameMap, cc, lir);
-        lir.spillMoveFactory = new HSAILSpillMoveFactory();
+        lir.setSpillMoveFactory(new HSAILSpillMoveFactory());
     }
 
     @Override
--- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java	Wed Mar 12 13:30:08 2014 +0100
@@ -91,7 +91,7 @@
 
     public PTXLIRGenerator(StructuredGraph graph, Providers providers, FrameMap frameMap, CallingConvention cc, LIR lir) {
         super(graph, providers, frameMap, cc, lir);
-        lir.spillMoveFactory = new PTXSpillMoveFactory();
+        lir.setSpillMoveFactory(new PTXSpillMoveFactory());
         int callVariables = cc.getArgumentCount() + (cc.getReturn().equals(Value.ILLEGAL) ? 0 : 1);
         lir.setFirstVariableNumber(callVariables);
         nextPredRegNum = 0;
@@ -135,7 +135,7 @@
     }
 
     @Override
-    public void emitPrologue() {
+    public void emitPrologue(StructuredGraph graph) {
         // Need to emit .param directives based on incoming arguments and return value
         CallingConvention incomingArguments = cc;
         Object returnObject = incomingArguments.getReturn();
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Wed Mar 12 13:30:08 2014 +0100
@@ -80,7 +80,7 @@
 
     public SPARCLIRGenerator(StructuredGraph graph, Providers providers, FrameMap frameMap, CallingConvention cc, LIR lir) {
         super(graph, providers, frameMap, cc, lir);
-        lir.spillMoveFactory = new SPARCSpillMoveFactory();
+        lir.setSpillMoveFactory(new SPARCSpillMoveFactory());
     }
 
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Wed Mar 12 13:30:08 2014 +0100
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2014, 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.compiler.test;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.zip.*;
+
+import org.junit.*;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.debug.*;
+import com.oracle.graal.debug.internal.*;
+import com.oracle.graal.java.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.phases.*;
+import com.oracle.graal.phases.VerifyPhase.VerificationError;
+import com.oracle.graal.phases.tiers.*;
+import com.oracle.graal.phases.util.*;
+import com.oracle.graal.phases.verify.*;
+import com.oracle.graal.runtime.*;
+
+/**
+ * Checks that all classes in graal.jar (which must be on the class path) comply with global
+ * invariants such as using {@link Object#equals(Object)} to compare certain types instead of
+ * identity comparisons.
+ */
+public class CheckGraalInvariants {
+
+    @Test
+    public void test() {
+        RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
+        Providers providers = rt.getHostBackend().getProviders();
+        MetaAccessProvider metaAccess = providers.getMetaAccess();
+
+        PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
+        graphBuilderSuite.appendPhase(new GraphBuilderPhase(GraphBuilderConfiguration.getEagerDefault()));
+        HighTierContext context = new HighTierContext(providers, new Assumptions(false), null, graphBuilderSuite, OptimisticOptimizations.NONE);
+
+        Assume.assumeTrue(VerifyPhase.class.desiredAssertionStatus());
+
+        String bootclasspath = System.getProperty("sun.boot.class.path");
+        Assert.assertNotNull("Cannot find value of boot class path", bootclasspath);
+
+        bootclasspath.split(File.pathSeparator);
+
+        String graalJar = null;
+        for (String e : bootclasspath.split(File.pathSeparator)) {
+            if (e.endsWith("graal.jar")) {
+                graalJar = e;
+                break;
+            }
+        }
+        Assert.assertNotNull("Could not find graal.jar on boot class path: " + bootclasspath, graalJar);
+
+        final List<String> classNames = new ArrayList<>();
+        try {
+            final ZipFile zipFile = new ZipFile(new File(graalJar));
+            for (final Enumeration<? extends ZipEntry> e = zipFile.entries(); e.hasMoreElements();) {
+                final ZipEntry zipEntry = e.nextElement();
+                String name = zipEntry.getName();
+                if (name.endsWith(".class")) {
+                    String className = name.substring(0, name.length() - ".class".length()).replace('/', '.');
+                    classNames.add(className);
+                }
+            }
+        } catch (IOException e) {
+            Assert.fail(e.toString());
+        }
+
+        // Allows a subset of methods to be checked through use of a system property
+        String property = System.getProperty(CheckGraalInvariants.class.getName() + ".filters");
+        String[] filters = property == null ? null : property.split(",");
+
+        List<String> errors = new ArrayList<>();
+        for (String className : classNames) {
+            try {
+                Class<?> c = Class.forName(className, false, CheckGraalInvariants.class.getClassLoader());
+                for (Method m : c.getDeclaredMethods()) {
+                    if (Modifier.isNative(m.getModifiers()) || Modifier.isAbstract(m.getModifiers())) {
+                        // ignore
+                    } else {
+                        String methodName = className + "." + m.getName();
+                        if (matches(filters, methodName)) {
+                            StructuredGraph graph = new StructuredGraph(metaAccess.lookupJavaMethod(m));
+                            DebugConfig debugConfig = DebugScope.getConfig();
+                            DebugConfig noInterceptConfig = new DelegatingDebugConfig(debugConfig) {
+                                @Override
+                                public RuntimeException interceptException(Throwable e) {
+                                    return null;
+                                }
+                            };
+                            try (DebugConfigScope s = Debug.setConfig(noInterceptConfig)) {
+                                graphBuilderSuite.apply(graph, context);
+                                checkGraph(context, graph);
+                            } catch (VerificationError e) {
+                                errors.add(e.getMessage());
+                            } catch (LinkageError e) {
+                                // suppress linkages errors resulting from eager resolution
+                            } catch (Throwable e) {
+                                StringWriter sw = new StringWriter();
+                                e.printStackTrace(new PrintWriter(sw));
+                                errors.add(String.format("Error while checking %s:%n%s", methodName, sw));
+                            }
+                        }
+                    }
+                }
+
+            } catch (ClassNotFoundException e) {
+                e.printStackTrace();
+            }
+        }
+        if (!errors.isEmpty()) {
+            StringBuilder msg = new StringBuilder();
+            String nl = String.format("%n");
+            for (String e : errors) {
+                if (msg.length() != 0) {
+                    msg.append(nl);
+                }
+                msg.append(e);
+            }
+            Assert.fail(msg.toString());
+        }
+    }
+
+    /**
+     * Checks the invariants for a single graph.
+     */
+    private static void checkGraph(HighTierContext context, StructuredGraph graph) {
+        new VerifyUsageWithEquals(Value.class).apply(graph, context);
+        new VerifyUsageWithEquals(Register.class).apply(graph, context);
+        new VerifyUsageWithEquals(JavaType.class).apply(graph, context);
+        new VerifyUsageWithEquals(JavaMethod.class).apply(graph, context);
+        new VerifyUsageWithEquals(JavaField.class).apply(graph, context);
+    }
+
+    private static boolean matches(String[] filters, String s) {
+        if (filters == null || filters.length == 0) {
+            return true;
+        }
+        for (String filter : filters) {
+            if (s.contains(filter)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Wed Mar 12 13:30:08 2014 +0100
@@ -661,8 +661,8 @@
 
     protected CompilationResult compile(ResolvedJavaMethod method, final StructuredGraph graph) {
         CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false);
-        return compileGraph(graph, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph),
-                        getSpeculationLog(), getSuites(), true, new CompilationResult(), CompilationResultBuilderFactory.Default);
+        return compileGraph(graph, null, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL,
+                        getProfilingInfo(graph), getSpeculationLog(), getSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default);
     }
 
     protected SpeculationLog getSpeculationLog() {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Wed Mar 12 13:30:08 2014 +0100
@@ -62,8 +62,8 @@
         final Method method = getMethod("testMethod");
         final StructuredGraph graph = parse(method);
         CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false);
-        final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(),
-                        OptimisticOptimizations.ALL, getProfilingInfo(graph), null, getSuites(), true, new CompilationResult(), CompilationResultBuilderFactory.Default);
+        final CompilationResult cr = compileGraph(graph, null, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(),
+                        OptimisticOptimizations.ALL, getProfilingInfo(graph), null, getSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default);
         for (Infopoint sp : cr.getInfopoints()) {
             assertNotNull(sp.reason);
             if (sp instanceof Call) {
@@ -85,8 +85,8 @@
         assertTrue(graphLineSPs > 0);
         CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false);
         PhaseSuite<HighTierContext> graphBuilderSuite = getCustomGraphBuilderSuite(GraphBuilderConfiguration.getEagerInfopointDefault());
-        final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL,
-                        getProfilingInfo(graph), getSpeculationLog(), getSuites(), true, new CompilationResult(), CompilationResultBuilderFactory.Default);
+        final CompilationResult cr = compileGraph(graph, null, cc, graph.method(), getProviders(), getBackend(), getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL,
+                        getProfilingInfo(graph), getSpeculationLog(), getSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default);
         int lineSPs = 0;
         for (Infopoint sp : cr.getInfopoints()) {
             assertNotNull(sp.reason);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java	Wed Mar 12 13:30:08 2014 +0100
@@ -120,7 +120,7 @@
         }
 
         CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false);
-        LIRGenerator lirGen = GraalCompiler.emitLIR(getBackend(), getBackend().getTarget(), schedule, graph, cc);
+        LIRGenerator lirGen = GraalCompiler.emitLIR(getBackend(), getBackend().getTarget(), schedule, graph, null, cc);
         return new RegisterStats(lirGen.lir);
     }
 }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Wed Mar 12 13:30:08 2014 +0100
@@ -30,9 +30,9 @@
 
 import com.oracle.graal.alloc.*;
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.*;
+import com.oracle.graal.api.code.CompilationResult.DataPatch;
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.ProfilingInfo.*;
+import com.oracle.graal.api.meta.ProfilingInfo.TriState;
 import com.oracle.graal.compiler.alloc.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.target.*;
@@ -43,7 +43,6 @@
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
-import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
@@ -131,15 +130,13 @@
      * @param installedCodeOwner the method the compiled code will be
      *            {@linkplain InstalledCode#getMethod() associated} with once installed. This
      *            argument can be null.
-     * @param withScope specifies if a {@link DebugScope} with the name {@code "GraalCompiler"}
-     *            should be used for the compilation
      * @return the result of the compilation
      */
-    public static <T extends CompilationResult> T compileGraph(StructuredGraph graph, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend,
-                    TargetDescription target, GraphCache cache, PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo,
-                    SpeculationLog speculationLog, Suites suites, boolean withScope, T compilationResult, CompilationResultBuilderFactory factory) {
+    public static <T extends CompilationResult> T compileGraph(StructuredGraph graph, Object stub, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend,
+                    TargetDescription target, Map<ResolvedJavaMethod, StructuredGraph> cache, PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts,
+                    ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites, T compilationResult, CompilationResultBuilderFactory factory) {
         assert !graph.isFrozen();
-        try (Scope s0 = withScope ? Debug.scope("GraalCompiler", graph, providers.getCodeCache()) : null) {
+        try (Scope s0 = Debug.scope("GraalCompiler", graph, providers.getCodeCache())) {
             Assumptions assumptions = new Assumptions(OptAssumptions.getValue());
             SchedulePhase schedule = null;
             try (Scope s = Debug.scope("FrontEnd"); TimerCloseable a = FrontEnd.start()) {
@@ -149,9 +146,9 @@
             }
             try (TimerCloseable a = BackEnd.start()) {
                 LIRGenerator lirGen = null;
-                lirGen = emitLIR(backend, target, schedule, graph, cc);
+                lirGen = emitLIR(backend, target, schedule, graph, stub, cc);
                 try (Scope s = Debug.scope("CodeGen", lirGen)) {
-                    emitCode(backend, getLeafGraphIdArray(graph), assumptions, lirGen, compilationResult, installedCodeOwner, factory);
+                    emitCode(backend, assumptions, lirGen, compilationResult, installedCodeOwner, factory);
                 } catch (Throwable e) {
                     throw Debug.handle(e);
                 }
@@ -172,21 +169,11 @@
         }
     }
 
-    private static long[] getLeafGraphIdArray(StructuredGraph graph) {
-        long[] leafGraphIdArray = new long[graph.getLeafGraphIds().size() + 1];
-        int i = 0;
-        leafGraphIdArray[i++] = graph.graphId();
-        for (long id : graph.getLeafGraphIds()) {
-            leafGraphIdArray[i++] = id;
-        }
-        return leafGraphIdArray;
-    }
-
     /**
      * Builds the graph, optimizes it.
      */
-    public static SchedulePhase emitHIR(Providers providers, TargetDescription target, StructuredGraph graph, Assumptions assumptions, GraphCache cache, PhaseSuite<HighTierContext> graphBuilderSuite,
-                    OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites) {
+    public static SchedulePhase emitHIR(Providers providers, TargetDescription target, StructuredGraph graph, Assumptions assumptions, Map<ResolvedJavaMethod, StructuredGraph> cache,
+                    PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites) {
 
         if (speculationLog != null) {
             speculationLog.collectFailedSpeculations();
@@ -223,18 +210,18 @@
 
     }
 
-    private static void emitBlock(LIRGenerator lirGen, Block b) {
+    private static void emitBlock(LIRGenerator lirGen, Block b, StructuredGraph graph, BlockMap<List<ScheduledNode>> blockMap) {
         if (lirGen.lir.lir(b) == null) {
             for (Block pred : b.getPredecessors()) {
                 if (!b.isLoopHeader() || !pred.isLoopEnd()) {
-                    emitBlock(lirGen, pred);
+                    emitBlock(lirGen, pred, graph, blockMap);
                 }
             }
-            lirGen.doBlock(b);
+            lirGen.doBlock(b, graph, blockMap);
         }
     }
 
-    public static LIRGenerator emitLIR(Backend backend, TargetDescription target, SchedulePhase schedule, StructuredGraph graph, CallingConvention cc) {
+    public static LIRGenerator emitLIR(Backend backend, TargetDescription target, SchedulePhase schedule, StructuredGraph graph, Object stub, CallingConvention cc) {
         Block[] blocks = schedule.getCFG().getBlocks();
         Block startBlock = schedule.getCFG().getStartBlock();
         assert startBlock != null;
@@ -247,7 +234,7 @@
                 List<Block> codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blocks.length, startBlock, nodeProbabilities);
                 List<Block> linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.length, startBlock, nodeProbabilities);
 
-                lir = new LIR(schedule.getCFG(), schedule.getBlockToNodesMap(), linearScanOrder, codeEmittingOrder);
+                lir = new LIR(schedule.getCFG(), linearScanOrder, codeEmittingOrder);
                 Debug.dump(lir, "After linear scan order");
             } catch (Throwable e) {
                 throw Debug.handle(e);
@@ -257,11 +244,11 @@
         }
         try (Scope ds = Debug.scope("BackEnd", lir)) {
             FrameMap frameMap = backend.newFrameMap();
-            LIRGenerator lirGen = backend.newLIRGenerator(graph, frameMap, cc, lir);
+            LIRGenerator lirGen = backend.newLIRGenerator(graph, stub, frameMap, cc, lir);
 
             try (Scope s = Debug.scope("LIRGen", lirGen)) {
                 for (Block b : lir.linearScanOrder()) {
-                    emitBlock(lirGen, b);
+                    emitBlock(lirGen, b, graph, schedule.getBlockToNodesMap());
                 }
                 lirGen.beforeRegisterAllocation();
 
@@ -282,7 +269,7 @@
                 EdgeMoveOptimizer.optimize(lir);
                 ControlFlowOptimizer.optimize(lir);
                 if (lirGen.canEliminateRedundantMoves()) {
-                    RedundantMoveElimination.optimize(lir, frameMap, lirGen.getGraph().method());
+                    RedundantMoveElimination.optimize(lir, frameMap);
                 }
                 NullCheckOptimizer.optimize(lir, target.implicitNullCheckLimit);
 
@@ -296,7 +283,7 @@
         }
     }
 
-    public static void emitCode(Backend backend, long[] leafGraphIds, Assumptions assumptions, LIRGenerator lirGen, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner,
+    public static void emitCode(Backend backend, Assumptions assumptions, LIRGenerator lirGen, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner,
                     CompilationResultBuilderFactory factory) {
         CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGen, compilationResult, factory);
         backend.emitCode(crb, lirGen.lir, installedCodeOwner);
@@ -304,7 +291,6 @@
         if (!assumptions.isEmpty()) {
             compilationResult.setAssumptions(assumptions);
         }
-        compilationResult.setLeafGraphIds(leafGraphIds);
 
         if (Debug.isMeterEnabled()) {
             List<DataPatch> ldp = compilationResult.getDataReferences();
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Wed Mar 12 13:30:08 2014 +0100
@@ -104,7 +104,7 @@
     /**
      * List of blocks in linear-scan order. This is only correct as long as the CFG does not change.
      */
-    final List<Block> sortedBlocks;
+    final List<? extends AbstractBlock<?>> sortedBlocks;
 
     /**
      * Map from {@linkplain #operandNumber(Value) operand numbers} to intervals.
@@ -139,7 +139,7 @@
      * containing the instruction. Entries should be retrieved with {@link #blockForId(int)} as the
      * id is not simply an index into this array.
      */
-    Block[] opIdToBlockMap;
+    AbstractBlock<?>[] opIdToBlockMap;
 
     /**
      * Bit set for each variable that is contained in each loop.
@@ -168,16 +168,16 @@
         this.registers = target.arch.getRegisters();
         this.firstVariableNumber = registers.length;
         this.variables = new ArrayList<>(ir.numVariables() * 3 / 2);
-        this.blockData = new BlockMap<>(ir.cfg);
+        this.blockData = new BlockMap<>(ir.getControlFlowGraph());
     }
 
-    public int getFirstLirInstructionId(Block block) {
+    public int getFirstLirInstructionId(AbstractBlock<?> block) {
         int result = ir.lir(block).get(0).id();
         assert result >= 0;
         return result;
     }
 
-    public int getLastLirInstructionId(Block block) {
+    public int getLastLirInstructionId(AbstractBlock<?> block) {
         List<LIRInstruction> instructions = ir.lir(block);
         int result = instructions.get(instructions.size() - 1).id();
         assert result >= 0;
@@ -321,7 +321,7 @@
         return sortedBlocks.size();
     }
 
-    Block blockAt(int index) {
+    AbstractBlock<?> blockAt(int index) {
         return sortedBlocks.get(index);
     }
 
@@ -335,7 +335,7 @@
     }
 
     int numLoops() {
-        return ir.cfg.getLoops().length;
+        return ir.getControlFlowGraph().getLoops().length;
     }
 
     boolean isIntervalInLoop(int interval, int loop) {
@@ -393,7 +393,7 @@
      * @param opId an instruction {@linkplain LIRInstruction#id id}
      * @return the block containing the instruction denoted by {@code opId}
      */
-    Block blockForId(int opId) {
+    AbstractBlock<?> blockForId(int opId) {
         assert opIdToBlockMap.length > 0 && opId >= 0 && opId <= maxOpId() + 1 : "opId out of range";
         return opIdToBlockMap[opIdToIndex(opId)];
     }
@@ -516,7 +516,7 @@
         }
 
         LIRInsertionBuffer insertionBuffer = new LIRInsertionBuffer();
-        for (Block block : sortedBlocks) {
+        for (AbstractBlock<?> block : sortedBlocks) {
             List<LIRInstruction> instructions = ir.lir(block);
             int numInst = instructions.size();
 
@@ -562,7 +562,7 @@
                             assert isRegister(fromLocation) : "from operand must be a register but is: " + fromLocation + " toLocation=" + toLocation + " spillState=" + interval.spillState();
                             assert isStackSlot(toLocation) : "to operand must be a stack slot";
 
-                            insertionBuffer.append(j + 1, ir.spillMoveFactory.createMove(toLocation, fromLocation));
+                            insertionBuffer.append(j + 1, ir.getSpillMoveFactory().createMove(toLocation, fromLocation));
 
                             Debug.log("inserting move after definition of interval %d to stack slot %s at opId %d", interval.operandNumber, interval.spillSlot(), opId);
                         }
@@ -623,7 +623,7 @@
 
         // Assign IDs to LIR nodes and build a mapping, lirOps, from ID to LIRInstruction node.
         int numInstructions = 0;
-        for (Block block : sortedBlocks) {
+        for (AbstractBlock<?> block : sortedBlocks) {
             numInstructions += ir.lir(block).size();
         }
 
@@ -633,7 +633,7 @@
 
         int opId = 0;
         int index = 0;
-        for (Block block : sortedBlocks) {
+        for (AbstractBlock<?> block : sortedBlocks) {
             blockData.put(block, new BlockData());
 
             List<LIRInstruction> instructions = ir.lir(block);
@@ -675,7 +675,7 @@
         intervalInLoop = new BitMap2D(operandSize(), numLoops());
 
         // iterate all blocks
-        for (final Block block : sortedBlocks) {
+        for (final AbstractBlock<?> block : sortedBlocks) {
             Indent indent = Debug.logAndIndent("compute local live sets for block %d", block.getId());
 
             final BitSet liveGen = new BitSet(liveSize);
@@ -779,13 +779,13 @@
         }
     }
 
-    private void verifyInput(Block block, BitSet liveKill, Value operand) {
+    private void verifyInput(AbstractBlock<?> block, BitSet liveKill, Value operand) {
         // fixed intervals are never live at block boundaries, so
         // they need not be processed in live sets.
         // this is checked by these assertions to be sure about it.
         // the entry block may have incoming
         // values in registers, which is ok.
-        if (isRegister(operand) && block != ir.cfg.getStartBlock()) {
+        if (isRegister(operand) && block != ir.getControlFlowGraph().getStartBlock()) {
             if (isProcessed(operand)) {
                 assert liveKill.get(operandNumber(operand)) : "using fixed register that is not defined in this block";
             }
@@ -813,7 +813,7 @@
 
             // iterate all blocks in reverse order
             for (int i = numBlocks - 1; i >= 0; i--) {
-                Block block = blockAt(i);
+                AbstractBlock<?> block = blockAt(i);
                 BlockData blockSets = blockData.get(block);
 
                 changeOccurredInBlock = false;
@@ -824,7 +824,7 @@
                     // block has successors
                     if (n > 0) {
                         liveOut.clear();
-                        for (Block successor : block.getSuccessors()) {
+                        for (AbstractBlock<?> successor : block.getSuccessors()) {
                             liveOut.or(blockData.get(successor).liveIn);
                         }
                     } else {
@@ -869,7 +869,7 @@
         }
 
         // check that the liveIn set of the first block is empty
-        Block startBlock = ir.cfg.getStartBlock();
+        Block startBlock = ir.getControlFlowGraph().getStartBlock();
         if (blockData.get(startBlock).liveIn.cardinality() != 0) {
             if (DetailedAsserts.getValue()) {
                 reportFailure(numBlocks);
@@ -897,27 +897,11 @@
         return null;
     }
 
-    private static StructuredGraph getGraphFromDebugContext() {
-        LIRGenerator gen = getLIRGeneratorFromDebugContext();
-        if (gen != null) {
-            return gen.getGraph();
-        }
-        return null;
-    }
-
-    private static ResolvedJavaMethod getMethodFromDebugContext() {
-        StructuredGraph graph = getGraphFromDebugContext();
-        if (graph != null) {
-            return graph.method();
-        }
-        return null;
-    }
-
     private void reportFailure(int numBlocks) {
         try (Scope s = Debug.forceLog()) {
-            Indent indent = Debug.logAndIndent("report failure, graph: %s", getGraphFromDebugContext());
+            Indent indent = Debug.logAndIndent("report failure");
 
-            BitSet startBlockLiveIn = blockData.get(ir.cfg.getStartBlock()).liveIn;
+            BitSet startBlockLiveIn = blockData.get(ir.getControlFlowGraph().getStartBlock()).liveIn;
             try (Indent indent2 = Debug.logAndIndent("Error: liveIn set of first block must be empty (when this fails, variables are used before they are defined):")) {
                 for (int operandNum = startBlockLiveIn.nextSetBit(0); operandNum >= 0; operandNum = startBlockLiveIn.nextSetBit(operandNum + 1)) {
                     Value operand = operandFor(operandNum);
@@ -930,9 +914,9 @@
                 Value operand = operandFor(operandNum);
                 final Indent indent2 = Debug.logAndIndent("---- Detailed information for var %d; operand=%s; node=%s ----", operandNum, operand, getValueForOperandFromDebugContext(operand));
 
-                Deque<Block> definedIn = new ArrayDeque<>();
-                HashSet<Block> usedIn = new HashSet<>();
-                for (Block block : sortedBlocks) {
+                Deque<AbstractBlock<?>> definedIn = new ArrayDeque<>();
+                HashSet<AbstractBlock<?>> usedIn = new HashSet<>();
+                for (AbstractBlock<?> block : sortedBlocks) {
                     if (blockData.get(block).liveGen.get(operandNum)) {
                         usedIn.add(block);
                         try (Indent indent3 = Debug.logAndIndent("used in block B%d", block.getId())) {
@@ -963,9 +947,9 @@
                 int[] hitCount = new int[numBlocks];
 
                 while (!definedIn.isEmpty()) {
-                    Block block = definedIn.removeFirst();
+                    AbstractBlock<?> block = definedIn.removeFirst();
                     usedIn.remove(block);
-                    for (Block successor : block.getSuccessors()) {
+                    for (AbstractBlock<?> successor : block.getSuccessors()) {
                         if (successor.isLoopHeader()) {
                             if (!block.isLoopEnd()) {
                                 definedIn.add(successor);
@@ -978,7 +962,7 @@
                     }
                 }
                 try (Indent indent3 = Debug.logAndIndent("**** offending usages are in: ")) {
-                    for (Block block : usedIn) {
+                    for (AbstractBlock<?> block : usedIn) {
                         Debug.log("B%d", block.getId());
                     }
                 }
@@ -991,7 +975,7 @@
     private void verifyLiveness() {
         // check that fixed intervals are not live at block boundaries
         // (live set must be empty at fixed intervals)
-        for (Block block : sortedBlocks) {
+        for (AbstractBlock<?> block : sortedBlocks) {
             for (int j = 0; j <= maxRegisterNumber(); j++) {
                 assert !blockData.get(block).liveIn.get(j) : "liveIn  set of fixed register must be empty";
                 assert !blockData.get(block).liveOut.get(j) : "liveOut set of fixed register must be empty";
@@ -1174,7 +1158,7 @@
         // iterate all blocks in reverse order
         for (int i = blockCount() - 1; i >= 0; i--) {
 
-            Block block = blockAt(i);
+            AbstractBlock<?> block = blockAt(i);
             Indent indent2 = Debug.logAndIndent("handle block %d", block.getId());
 
             List<LIRInstruction> instructions = ir.lir(block);
@@ -1479,14 +1463,14 @@
         throw new BailoutException("LinearScan: interval is null");
     }
 
-    Interval intervalAtBlockBegin(Block block, Value operand) {
+    Interval intervalAtBlockBegin(AbstractBlock<?> block, Value operand) {
         assert isVariable(operand) : "register number out of bounds";
         assert intervalFor(operand) != null : "no interval found";
 
         return splitChildAtOpId(intervalFor(operand), getFirstLirInstructionId(block), LIRInstruction.OperandMode.DEF);
     }
 
-    Interval intervalAtBlockEnd(Block block, Value operand) {
+    Interval intervalAtBlockEnd(AbstractBlock<?> block, Value operand) {
         assert isVariable(operand) : "register number out of bounds";
         assert intervalFor(operand) != null : "no interval found";
 
@@ -1500,7 +1484,7 @@
         return splitChildAtOpId(intervalFor(operand), opId, LIRInstruction.OperandMode.USE);
     }
 
-    void resolveCollectMappings(Block fromBlock, Block toBlock, MoveResolver moveResolver) {
+    void resolveCollectMappings(AbstractBlock<?> fromBlock, AbstractBlock<?> toBlock, MoveResolver moveResolver) {
         assert moveResolver.checkEmpty();
 
         int numOperands = operandSize();
@@ -1522,7 +1506,7 @@
         }
     }
 
-    void resolveFindInsertPos(Block fromBlock, Block toBlock, MoveResolver moveResolver) {
+    void resolveFindInsertPos(AbstractBlock<?> fromBlock, AbstractBlock<?> toBlock, MoveResolver moveResolver) {
         if (fromBlock.getSuccessorCount() <= 1) {
             Debug.log("inserting moves at end of fromBlock B%d", fromBlock.getId());
 
@@ -1545,7 +1529,7 @@
                 // successor edges, blocks which are reached by switch statements
                 // may have be more than one predecessor but it will be guaranteed
                 // that all predecessors will be the same.
-                for (Block predecessor : toBlock.getPredecessors()) {
+                for (AbstractBlock<?> predecessor : toBlock.getPredecessors()) {
                     assert fromBlock == predecessor : "all critical edges must be broken";
                 }
             }
@@ -1566,7 +1550,7 @@
         BitSet blockCompleted = new BitSet(numBlocks);
         BitSet alreadyResolved = new BitSet(numBlocks);
 
-        for (Block block : sortedBlocks) {
+        for (AbstractBlock<?> block : sortedBlocks) {
 
             // check if block has only one predecessor and only one successor
             if (block.getPredecessorCount() == 1 && block.getSuccessorCount() == 1) {
@@ -1576,8 +1560,8 @@
 
                 // check if block is empty (only label and branch)
                 if (instructions.size() == 2) {
-                    Block pred = block.getFirstPredecessor();
-                    Block sux = block.getFirstSuccessor();
+                    AbstractBlock<?> pred = block.getPredecessors().iterator().next();
+                    AbstractBlock<?> sux = block.getSuccessors().iterator().next();
 
                     // prevent optimization of two consecutive blocks
                     if (!blockCompleted.get(pred.getLinearScanNumber()) && !blockCompleted.get(sux.getLinearScanNumber())) {
@@ -1597,12 +1581,12 @@
             }
         }
 
-        for (Block fromBlock : sortedBlocks) {
+        for (AbstractBlock<?> fromBlock : sortedBlocks) {
             if (!blockCompleted.get(fromBlock.getLinearScanNumber())) {
                 alreadyResolved.clear();
                 alreadyResolved.or(blockCompleted);
 
-                for (Block toBlock : fromBlock.getSuccessors()) {
+                for (AbstractBlock<?> toBlock : fromBlock.getSuccessors()) {
 
                     // check for duplicate edges between the same blocks (can happen with switch
                     // blocks)
@@ -1646,7 +1630,7 @@
 
         if (opId != -1) {
             if (DetailedAsserts.getValue()) {
-                Block block = blockForId(opId);
+                AbstractBlock<?> block = blockForId(opId);
                 if (block.getSuccessorCount() <= 1 && opId == getLastLirInstructionId(block)) {
                     // check if spill moves could have been appended at the end of this block, but
                     // before the branch instruction. So the split child information for this branch
@@ -1760,7 +1744,7 @@
             public Value doValue(Value operand) {
                 int tempOpId = op.id();
                 OperandMode mode = OperandMode.USE;
-                Block block = blockForId(tempOpId);
+                AbstractBlock<?> block = blockForId(tempOpId);
                 if (block.getSuccessorCount() == 1 && tempOpId == getLastLirInstructionId(block)) {
                     // generating debug information for the last instruction of a block.
                     // if this instruction is a branch, spill moves are inserted before this branch
@@ -1771,7 +1755,7 @@
                     final LIRInstruction instr = ir.lir(block).get(ir.lir(block).size() - 1);
                     if (instr instanceof StandardOp.JumpOp) {
                         if (blockData.get(block).liveOut.get(operandNumber(operand))) {
-                            tempOpId = getFirstLirInstructionId(block.getFirstSuccessor());
+                            tempOpId = getFirstLirInstructionId(block.getSuccessors().iterator().next());
                             mode = OperandMode.DEF;
                         }
                     }
@@ -1860,7 +1844,7 @@
     private void assignLocations() {
         IntervalWalker iw = initIntervalWalker(IS_STACK_INTERVAL);
         try (Indent indent = Debug.logAndIndent("assign locations")) {
-            for (Block block : sortedBlocks) {
+            for (AbstractBlock<?> block : sortedBlocks) {
                 try (Indent indent2 = Debug.logAndIndent("assign locations in block B%d", block.getId())) {
                     assignLocations(ir.lir(block), iw);
                 }
@@ -1873,7 +1857,7 @@
         /*
          * This is the point to enable debug logging for the whole register allocation.
          */
-        Indent indent = Debug.logAndIndent("LinearScan allocate %s", getMethodFromDebugContext());
+        Indent indent = Debug.logAndIndent("LinearScan allocate");
 
         try (Scope s = Debug.scope("LifetimeAnalysis")) {
             numberInstructions();
@@ -1937,7 +1921,7 @@
 
                 try (Indent indent2 = Debug.logAndIndent("Basic Blocks")) {
                     for (int i = 0; i < blockCount(); i++) {
-                        Block block = blockAt(i);
+                        AbstractBlock<?> block = blockAt(i);
                         Debug.log("B%d [%d, %d, %s] ", block.getId(), getFirstLirInstructionId(block), getLastLirInstructionId(block), block.getLoop());
                     }
                 }
@@ -2075,7 +2059,7 @@
             otherIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1);
             IntervalWalker iw = new IntervalWalker(this, fixedIntervals, otherIntervals);
 
-            for (Block block : sortedBlocks) {
+            for (AbstractBlock<?> block : sortedBlocks) {
                 List<LIRInstruction> instructions = ir.lir(block);
 
                 for (int j = 0; j < instructions.size(); j++) {
@@ -2113,7 +2097,7 @@
 
     void verifyConstants() {
         try (Indent indent = Debug.logAndIndent("verifying that unpinned constants are not alive across block boundaries")) {
-            for (Block block : sortedBlocks) {
+            for (AbstractBlock<?> block : sortedBlocks) {
                 BitSet liveAtEdge = blockData.get(block).liveIn;
 
                 // visit all operands where the liveAtEdge bit is set
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Wed Mar 12 13:30:08 2014 +0100
@@ -25,6 +25,7 @@
 import static com.oracle.graal.api.code.CodeUtil.*;
 import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
+
 import java.util.*;
 
 import com.oracle.graal.api.code.*;
@@ -57,11 +58,11 @@
         return allocator.blockCount();
     }
 
-    Block blockAt(int idx) {
+    AbstractBlock<?> blockAt(int idx) {
         return allocator.blockAt(idx);
     }
 
-    Block blockOfOpWithId(int opId) {
+    AbstractBlock<?> blockOfOpWithId(int opId) {
         return allocator.blockForId(opId);
     }
 
@@ -235,7 +236,7 @@
         // optimized away later in assignRegNums
 
         int opId = (operandId + 1) & ~1;
-        Block opBlock = allocator.blockForId(opId);
+        AbstractBlock<?> opBlock = allocator.blockForId(opId);
         assert opId > 0 && allocator.blockForId(opId - 2) == opBlock : "cannot insert move at block boundary";
 
         // calculate index of instruction inside instruction list of current block
@@ -259,7 +260,7 @@
         moveResolver.addMapping(srcIt, dstIt);
     }
 
-    int findOptimalSplitPos(Block minBlock, Block maxBlock, int maxSplitPos) {
+    int findOptimalSplitPos(AbstractBlock<?> minBlock, AbstractBlock<?> maxBlock, int maxSplitPos) {
         int fromBlockNr = minBlock.getLinearScanNumber();
         int toBlockNr = maxBlock.getLinearScanNumber();
 
@@ -276,7 +277,7 @@
 
         int minLoopDepth = maxBlock.getLoopDepth();
         for (int i = toBlockNr - 1; i >= fromBlockNr; i--) {
-            Block cur = blockAt(i);
+            AbstractBlock<?> cur = blockAt(i);
 
             if (cur.getLoopDepth() < minLoopDepth) {
                 // block with lower loop-depth found . split at the end of this block
@@ -304,13 +305,13 @@
             // beginning of a block, then minSplitPos is also a possible split position.
             // Use the block before as minBlock, because then minBlock.lastLirInstructionId() + 2 ==
             // minSplitPos
-            Block minBlock = allocator.blockForId(minSplitPos - 1);
+            AbstractBlock<?> minBlock = allocator.blockForId(minSplitPos - 1);
 
             // reason for using maxSplitPos - 1: otherwise there would be an assert on failure
             // when an interval ends at the end of the last block of the method
             // (in this case, maxSplitPos == allocator().maxLirOpId() + 2, and there is no
             // block at this opId)
-            Block maxBlock = allocator.blockForId(maxSplitPos - 1);
+            AbstractBlock<?> maxBlock = allocator.blockForId(maxSplitPos - 1);
 
             assert minBlock.getLinearScanNumber() <= maxBlock.getLinearScanNumber() : "invalid order";
             if (minBlock == maxBlock) {
@@ -348,7 +349,7 @@
                             // Desired result: uses tagged as shouldHaveRegister inside a loop cause
                             // a reloading
                             // of the interval (normally, only mustHaveRegister causes a reloading)
-                            Block loopBlock = allocator.blockForId(loopEndPos);
+                            AbstractBlock<?> loopBlock = allocator.blockForId(loopEndPos);
 
                             Debug.log("interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), loopBlock.getId());
                             assert loopBlock != minBlock : "loopBlock and minBlock must be different because block boundary is needed between";
@@ -412,8 +413,8 @@
 
             Debug.log("splitting at position %d", optimalSplitPos);
 
-            assert allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 1) : "split pos must be odd when not on block boundary";
-            assert !allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 0) : "split pos must be even on block boundary";
+            assert allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 1) : "split pos must be odd when not on block boundary";
+            assert !allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 0) : "split pos must be even on block boundary";
 
             Interval splitPart = interval.split(optimalSplitPos, allocator);
 
@@ -492,8 +493,8 @@
             }
 
             try (Indent indent2 = Debug.logAndIndent("splitting at position %d", optimalSplitPos)) {
-                assert allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 1) : "split pos must be odd when not on block boundary";
-                assert !allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 0) : "split pos must be even on block boundary";
+                assert allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 1) : "split pos must be odd when not on block boundary";
+                assert !allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 0) : "split pos must be even on block boundary";
 
                 Interval spilledPart = interval.split(optimalSplitPos, allocator);
                 allocator.assignSpillSlot(spilledPart);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java	Wed Mar 12 13:30:08 2014 +0100
@@ -202,7 +202,7 @@
         AllocatableValue fromOpr = fromInterval.operand;
         AllocatableValue toOpr = toInterval.operand;
 
-        insertionBuffer.append(insertIdx, allocator.ir.spillMoveFactory.createMove(toOpr, fromOpr));
+        insertionBuffer.append(insertIdx, allocator.ir.getSpillMoveFactory().createMove(toOpr, fromOpr));
 
         Debug.log("insert move from %s to %s at %d", fromInterval, toInterval, insertIdx);
     }
@@ -212,7 +212,7 @@
         assert insertIdx != -1 : "must setup insert position first";
 
         AllocatableValue toOpr = toInterval.operand;
-        insertionBuffer.append(insertIdx, allocator.ir.spillMoveFactory.createMove(toOpr, fromOpr));
+        insertionBuffer.append(insertIdx, allocator.ir.getSpillMoveFactory().createMove(toOpr, fromOpr));
 
         Debug.log("insert move from value %s to %s at %d", fromOpr, toInterval, insertIdx);
     }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java	Wed Mar 12 13:30:08 2014 +0100
@@ -23,6 +23,7 @@
 package com.oracle.graal.compiler.alloc;
 
 import static com.oracle.graal.api.code.ValueUtil.*;
+
 import java.util.*;
 
 import com.oracle.graal.api.code.*;
@@ -39,7 +40,7 @@
 final class RegisterVerifier {
 
     LinearScan allocator;
-    List<Block> workList; // all blocks that must be processed
+    List<AbstractBlock<?>> workList; // all blocks that must be processed
     ArrayMap<Interval[]> savedStates; // saved information of previous check
 
     // simplified access to methods of LinearScan
@@ -53,15 +54,15 @@
     }
 
     // accessors
-    Interval[] stateForBlock(Block block) {
+    Interval[] stateForBlock(AbstractBlock<?> block) {
         return savedStates.get(block.getId());
     }
 
-    void setStateForBlock(Block block, Interval[] savedState) {
+    void setStateForBlock(AbstractBlock<?> block, Interval[] savedState) {
         savedStates.put(block.getId(), savedState);
     }
 
-    void addToWorkList(Block block) {
+    void addToWorkList(AbstractBlock<?> block) {
         if (!workList.contains(block)) {
             workList.add(block);
         }
@@ -74,7 +75,7 @@
 
     }
 
-    void verify(Block start) {
+    void verify(AbstractBlock<?> start) {
         // setup input registers (method arguments) for first block
         Interval[] inputState = new Interval[stateSize()];
         setStateForBlock(start, inputState);
@@ -82,14 +83,14 @@
 
         // main loop for verification
         do {
-            Block block = workList.get(0);
+            AbstractBlock<?> block = workList.get(0);
             workList.remove(0);
 
             processBlock(block);
         } while (!workList.isEmpty());
     }
 
-    private void processBlock(Block block) {
+    private void processBlock(AbstractBlock<?> block) {
         try (Indent indent = Debug.logAndIndent("processBlock B%d", block.getId())) {
             // must copy state because it is modified
             Interval[] inputState = copy(stateForBlock(block));
@@ -108,13 +109,13 @@
             processOperations(allocator.ir.lir(block), inputState);
 
             // iterate all successors
-            for (Block succ : block.getSuccessors()) {
+            for (AbstractBlock<?> succ : block.getSuccessors()) {
                 processSuccessor(succ, inputState);
             }
         }
     }
 
-    private void processSuccessor(Block block, Interval[] inputState) {
+    private void processSuccessor(AbstractBlock<?> block, Interval[] inputState) {
         Interval[] savedState = stateForBlock(block);
 
         if (savedState != null) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Wed Mar 12 13:30:08 2014 +0100
@@ -56,9 +56,6 @@
         FrameState current = topState;
         do {
             for (EscapeObjectState state : current.virtualObjectMappings()) {
-                if (objectStates == null) {
-                    objectStates = new IdentityHashMap<>();
-                }
                 if (!objectStates.containsKey(state.object())) {
                     if (!(state instanceof MaterializedObjectState) || ((MaterializedObjectState) state).materializedValue() != state.object()) {
                         objectStates.put(state.object(), state);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Wed Mar 12 13:30:08 2014 +0100
@@ -72,7 +72,6 @@
     public final NodeMap<Value> nodeOperands;
     public final LIR lir;
 
-    protected final StructuredGraph graph;
     private final Providers providers;
     protected final CallingConvention cc;
 
@@ -172,7 +171,6 @@
     public abstract boolean canStoreConstant(Constant c, boolean isCompressed);
 
     public LIRGenerator(StructuredGraph graph, Providers providers, FrameMap frameMap, CallingConvention cc, LIR lir) {
-        this.graph = graph;
         this.providers = providers;
         this.frameMap = frameMap;
         this.cc = cc;
@@ -220,10 +218,6 @@
         return providers.getForeignCalls();
     }
 
-    public StructuredGraph getGraph() {
-        return graph;
-    }
-
     /**
      * Determines whether the code being generated makes at least one foreign call.
      */
@@ -347,7 +341,7 @@
     }
 
     public LabelRef getLIRBlock(FixedNode b) {
-        Block result = lir.cfg.blockFor(b);
+        Block result = lir.getControlFlowGraph().blockFor(b);
         int suxIndex = currentBlock.getSuccessors().indexOf(result);
         assert suxIndex != -1 : "Block not in successor list of current block";
 
@@ -415,7 +409,7 @@
         lir.lir(currentBlock).add(op);
     }
 
-    public void doBlock(Block block) {
+    public void doBlock(Block block, StructuredGraph graph, BlockMap<List<ScheduledNode>> blockMap) {
         if (printIRWithLIR) {
             TTY.print(block.toString());
         }
@@ -432,14 +426,14 @@
             TTY.println("BEGIN Generating LIR for block B" + block.getId());
         }
 
-        if (block == lir.cfg.getStartBlock()) {
+        if (block == lir.getControlFlowGraph().getStartBlock()) {
             assert block.getPredecessorCount() == 0;
-            emitPrologue();
+            emitPrologue(graph);
         } else {
             assert block.getPredecessorCount() > 0;
         }
 
-        List<ScheduledNode> nodes = lir.nodesFor(block);
+        List<ScheduledNode> nodes = blockMap.get(block);
         for (int i = 0; i < nodes.size(); i++) {
             Node instr = nodes.get(i);
             if (traceLevel >= 3) {
@@ -528,7 +522,7 @@
         }
     }
 
-    protected void emitPrologue() {
+    protected void emitPrologue(StructuredGraph graph) {
         CallingConvention incomingArguments = cc;
 
         Value[] params = new Value[incomingArguments.getArgumentCount()];
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Wed Mar 12 13:30:08 2014 +0100
@@ -65,7 +65,7 @@
 
     public abstract FrameMap newFrameMap();
 
-    public abstract LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir);
+    public abstract LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir);
 
     /**
      * Creates the assembler used to emit the machine code.
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramAsciiPrinter.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramAsciiPrinter.java	Wed Mar 12 13:30:08 2014 +0100
@@ -62,7 +62,7 @@
     public void print(DebugHistogram histogram) {
         List<CountedValue> list = histogram.getValues();
         if (list.isEmpty()) {
-            os.printf("%s is empty.\n", histogram.getName());
+            os.printf("%s is empty.%n", histogram.getName());
             return;
         }
 
@@ -73,7 +73,7 @@
         }
 
         // Print header.
-        os.printf("%s has %d unique elements and %d total elements:\n", histogram.getName(), list.size(), total);
+        os.printf("%s has %d unique elements and %d total elements:%n", histogram.getName(), list.size(), total);
 
         int max = list.get(0).getCount();
         final int lineSize = nameSize + NumberSize + barSize + 10;
@@ -96,6 +96,6 @@
     private static void printLine(PrintStream printStream, char c, int lineSize) {
         char[] charArr = new char[lineSize];
         Arrays.fill(charArr, c);
-        printStream.printf("%s\n", new String(charArr));
+        printStream.printf("%s%n", new String(charArr));
     }
 }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Wed Mar 12 13:30:08 2014 +0100
@@ -535,18 +535,22 @@
     }
 
     private void maybeNotifyChanged(Node usage) {
-        assert graph == null || !graph.isFrozen();
-        NodeChangedListener listener = graph.inputChangedListener;
-        if (listener != null) {
-            listener.nodeChanged(usage);
+        if (graph != null) {
+            assert !graph.isFrozen();
+            NodeChangedListener listener = graph.inputChangedListener;
+            if (listener != null) {
+                listener.nodeChanged(usage);
+            }
         }
     }
 
     private void maybeNotifyZeroInputs(Node oldInput) {
-        assert graph == null || !graph.isFrozen();
-        NodeChangedListener listener = graph.usagesDroppedToZeroListener;
-        if (listener != null) {
-            listener.nodeChanged(oldInput);
+        if (graph != null) {
+            assert !graph.isFrozen();
+            NodeChangedListener listener = graph.usagesDroppedToZeroListener;
+            if (listener != null) {
+                listener.nodeChanged(oldInput);
+            }
         }
     }
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Wed Mar 12 13:30:08 2014 +0100
@@ -970,8 +970,8 @@
         int index = startIndex;
         while (index < inputOffsets.length) {
             NodeList<Node> list = getNodeList(node, inputOffsets[index]);
+            assert list != null : clazz;
             putNodeList(node, inputOffsets[index], updateInputListCopy(list, node, duplicationReplacement));
-            assert list != null : clazz;
             index++;
         }
     }
@@ -980,8 +980,8 @@
         int index = startIndex;
         while (index < successorOffsets.length) {
             NodeList<Node> list = getNodeList(node, successorOffsets[index]);
+            assert list != null : clazz;
             putNodeList(node, successorOffsets[index], updateSuccListCopy(list, node, duplicationReplacement));
-            assert list != null : clazz;
             index++;
         }
     }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Wed Mar 12 13:30:08 2014 +0100
@@ -72,8 +72,8 @@
     }
 
     @Override
-    public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) {
-        return new AMD64HotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), frameMap, cc, lir);
+    public LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir) {
+        return new AMD64HotSpotLIRGenerator(graph, stub, getProviders(), getRuntime().getConfig(), frameMap, cc, lir);
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Wed Mar 12 13:30:08 2014 +0100
@@ -71,10 +71,13 @@
 
     private final HotSpotVMConfig config;
 
-    protected AMD64HotSpotLIRGenerator(StructuredGraph graph, HotSpotProviders providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) {
+    private final Object stub;
+
+    protected AMD64HotSpotLIRGenerator(StructuredGraph graph, Object stub, HotSpotProviders providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) {
         super(graph, providers, frameMap, cc, lir);
         assert config.basicLockSize == 8;
         this.config = config;
+        this.stub = stub;
     }
 
     @Override
@@ -154,7 +157,7 @@
     }
 
     @Override
-    protected void emitPrologue() {
+    protected void emitPrologue(StructuredGraph graph) {
 
         CallingConvention incomingArguments = cc;
 
@@ -205,7 +208,7 @@
     @Override
     protected boolean needOnlyOopMaps() {
         // Stubs only need oop maps
-        return graph.start() instanceof StubStartNode;
+        return stub != null;
     }
 
     /**
@@ -233,22 +236,18 @@
     }
 
     Stub getStub() {
-        if (graph.start() instanceof StubStartNode) {
-            return ((StubStartNode) graph.start()).getStub();
-        }
-        return null;
+        return (Stub) stub;
     }
 
     @Override
     public Variable emitForeignCall(ForeignCallLinkage linkage, DeoptimizingNode info, Value... args) {
-        Stub stub = getStub();
         boolean destroysRegisters = linkage.destroysRegisters();
 
         AMD64SaveRegistersOp save = null;
         StackSlot[] savedRegisterLocations = null;
         if (destroysRegisters) {
-            if (stub != null) {
-                if (stub.preservesRegisters()) {
+            if (getStub() != null) {
+                if (getStub().preservesRegisters()) {
                     Register[] savedRegisters = frameMap.registerConfig.getAllocatableRegisters();
                     savedRegisterLocations = new StackSlot[savedRegisters.length];
                     for (int i = 0; i < savedRegisters.length; i++) {
@@ -275,8 +274,8 @@
         }
 
         if (destroysRegisters) {
-            if (stub != null) {
-                if (stub.preservesRegisters()) {
+            if (getStub() != null) {
+                if (getStub().preservesRegisters()) {
                     assert !calleeSaveInfo.containsKey(currentRuntimeCallInfo);
                     calleeSaveInfo.put(currentRuntimeCallInfo, save);
 
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java	Wed Mar 12 13:30:08 2014 +0100
@@ -82,13 +82,13 @@
         NodeIterable<MethodCallTargetNode> calls = graph.getNodes(MethodCallTargetNode.class);
         assert calls.count() == 1;
         ResolvedJavaMethod lambdaMethod = calls.first().targetMethod();
-        assert lambdaMethod.getName().startsWith("lambda$");
         Debug.log("target ... " + lambdaMethod);
 
         if (lambdaMethod == null) {
             Debug.log("Did not find call in accept()");
             return null;
         }
+        assert lambdaMethod.getName().startsWith("lambda$");
 
         ExternalCompilationResult hsailCode = backend.compileKernel(lambdaMethod, true);
         return backend.installKernel(lambdaMethod, hsailCode);
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotBackend.java	Wed Mar 12 13:30:08 2014 +0100
@@ -132,8 +132,8 @@
         graphBuilderSuite.appendPhase(new NonNullParametersPhase());
         CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false);
         Suites suites = providers.getSuites().getDefaultSuites();
-        ExternalCompilationResult hsailCode = compileGraph(graph, cc, method, providers, this, this.getTarget(), null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph), null,
-                        suites, true, new ExternalCompilationResult(), CompilationResultBuilderFactory.Default);
+        ExternalCompilationResult hsailCode = compileGraph(graph, null, cc, method, providers, this, this.getTarget(), null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph),
+                        null, suites, new ExternalCompilationResult(), CompilationResultBuilderFactory.Default);
 
         if (makeBinary) {
             if (!deviceInitialized) {
@@ -188,7 +188,7 @@
     }
 
     @Override
-    public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) {
+    public LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir) {
         return new HSAILHotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), frameMap, cc, lir);
     }
 
--- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java	Wed Mar 12 13:30:08 2014 +0100
@@ -184,7 +184,7 @@
 
             private boolean canOffloadToGPU(ResolvedJavaMethod method) {
                 HotSpotVMConfig config = getRuntime().getConfig();
-                return config.gpuOffload && method.getName().contains("lambda$") & method.isSynthetic();
+                return config.gpuOffload && method.getName().contains("lambda$") && method.isSynthetic();
             }
         };
     }
@@ -204,8 +204,8 @@
         PhaseSuite<HighTierContext> graphBuilderSuite = providers.getSuites().getDefaultGraphBuilderSuite();
         graphBuilderSuite.appendPhase(new NonNullParametersPhase());
         Suites suites = providers.getSuites().getDefaultSuites();
-        ExternalCompilationResult ptxCode = compileGraph(graph, cc, method, providers, this, this.getTarget(), null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph), null,
-                        suites, true, new ExternalCompilationResult(), CompilationResultBuilderFactory.Default);
+        ExternalCompilationResult ptxCode = compileGraph(graph, null, cc, method, providers, this, this.getTarget(), null, graphBuilderSuite, OptimisticOptimizations.NONE, getProfilingInfo(graph),
+                        null, suites, new ExternalCompilationResult(), CompilationResultBuilderFactory.Default);
         if (makeBinary) {
             try (Scope ds = Debug.scope("GeneratingKernelBinary")) {
                 assert ptxCode.getTargetCode() != null;
@@ -372,7 +372,7 @@
     }
 
     @Override
-    public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) {
+    public LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir) {
         return new PTXHotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), frameMap, cc, lir);
     }
 
@@ -392,7 +392,7 @@
         asm.emitString("");
 
         // Get the start block
-        Block startBlock = lir.cfg.getStartBlock();
+        Block startBlock = lir.getControlFlowGraph().getStartBlock();
         // Keep a list of ParameterOp instructions to delete from the
         // list of instructions in the block.
         ArrayList<LIRInstruction> deleteOps = new ArrayList<>();
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java	Wed Mar 12 13:30:08 2014 +0100
@@ -72,8 +72,8 @@
     }
 
     @Override
-    public LIRGenerator newLIRGenerator(StructuredGraph graph, FrameMap frameMap, CallingConvention cc, LIR lir) {
-        return new SPARCHotSpotLIRGenerator(graph, getProviders(), getRuntime().getConfig(), frameMap, cc, lir);
+    public LIRGenerator newLIRGenerator(StructuredGraph graph, Object stub, FrameMap frameMap, CallingConvention cc, LIR lir) {
+        return new SPARCHotSpotLIRGenerator(graph, stub, getProviders(), getRuntime().getConfig(), frameMap, cc, lir);
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Wed Mar 12 13:30:08 2014 +0100
@@ -51,10 +51,12 @@
 public class SPARCHotSpotLIRGenerator extends SPARCLIRGenerator implements HotSpotLIRGenerator {
 
     private final HotSpotVMConfig config;
+    private final Object stub;
 
-    public SPARCHotSpotLIRGenerator(StructuredGraph graph, HotSpotProviders providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) {
+    public SPARCHotSpotLIRGenerator(StructuredGraph graph, Object stub, HotSpotProviders providers, HotSpotVMConfig config, FrameMap frameMap, CallingConvention cc, LIR lir) {
         super(graph, providers, frameMap, cc, lir);
         this.config = config;
+        this.stub = stub;
     }
 
     @Override
@@ -84,23 +86,19 @@
     @Override
     protected boolean needOnlyOopMaps() {
         // Stubs only need oop maps
-        return graph.start() instanceof StubStartNode;
+        return stub != null;
     }
 
     Stub getStub() {
-        if (graph.start() instanceof StubStartNode) {
-            return ((StubStartNode) graph.start()).getStub();
-        }
-        return null;
+        return (Stub) stub;
     }
 
     @Override
     public Variable emitForeignCall(ForeignCallLinkage linkage, DeoptimizingNode info, Value... args) {
-        Stub stub = getStub();
         Variable result;
 
         if (linkage.canDeoptimize()) {
-            assert info != null || stub != null;
+            assert info != null || getStub() != null;
             HotSpotRegistersProvider registers = getProviders().getRegisters();
             Register thread = registers.getThreadRegister();
             Register stackPointer = registers.getStackPointerRegister();
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java	Wed Mar 12 13:30:08 2014 +0100
@@ -204,8 +204,8 @@
             CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false);
             // create suites everytime, as we modify options for the compiler
             final Suites suitesLocal = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getSuites().createSuites();
-            final CompilationResult compResult = compileGraph(graph, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(),
-                            OptimisticOptimizations.ALL, getProfilingInfo(graph), getSpeculationLog(), suitesLocal, true, new CompilationResult(), CompilationResultBuilderFactory.Default);
+            final CompilationResult compResult = compileGraph(graph, null, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(),
+                            OptimisticOptimizations.ALL, getProfilingInfo(graph), getSpeculationLog(), suitesLocal, new CompilationResult(), CompilationResultBuilderFactory.Default);
             addMethod(method, compResult);
         }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Wed Mar 12 13:30:08 2014 +0100
@@ -32,6 +32,7 @@
 
 import java.io.*;
 import java.lang.reflect.*;
+import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
@@ -130,9 +131,6 @@
         try {
             runCompilation(true);
         } finally {
-            if (method.currentTask() == this) {
-                method.setCurrentTask(null);
-            }
             withinEnqueue.set(Boolean.TRUE);
             status.set(CompilationStatus.Finished);
             synchronized (this) {
@@ -237,9 +235,9 @@
             TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method);
             long start = System.currentTimeMillis();
             try (Scope s = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) {
-                GraphCache graphCache = backend.getRuntime().getGraphCache();
-                if (graphCache != null) {
-                    graphCache.removeStaleGraphs();
+                Map<ResolvedJavaMethod, StructuredGraph> graphCache = null;
+                if (GraalOptions.CacheGraphs.getValue()) {
+                    graphCache = new HashMap<>();
                 }
 
                 HotSpotProviders providers = backend.getProviders();
@@ -263,8 +261,8 @@
                 Suites suites = getSuites(providers);
                 ProfilingInfo profilingInfo = getProfilingInfo();
                 OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo);
-                result = compileGraph(graph, cc, method, providers, backend, backend.getTarget(), graphCache, getGraphBuilderSuite(providers), optimisticOpts, profilingInfo,
-                                method.getSpeculationLog(), suites, true, new CompilationResult(), CompilationResultBuilderFactory.Default);
+                result = compileGraph(graph, null, cc, method, providers, backend, backend.getTarget(), graphCache, getGraphBuilderSuite(providers), optimisticOpts, profilingInfo,
+                                method.getSpeculationLog(), suites, new CompilationResult(), CompilationResultBuilderFactory.Default);
                 result.setId(getId());
                 result.setEntryBCI(entryBCI);
             } catch (Throwable e) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Wed Mar 12 13:30:08 2014 +0100
@@ -41,7 +41,6 @@
 import com.oracle.graal.hotspot.logging.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.options.*;
-import com.oracle.graal.phases.*;
 import com.oracle.graal.runtime.*;
 
 //JaCoCo Exclude
@@ -196,8 +195,6 @@
     protected/* final */CompilerToVM compilerToVm;
     protected/* final */VMToCompiler vmToCompiler;
 
-    private volatile HotSpotGraphCache cache;
-
     protected final HotSpotVMConfig config;
     private final HotSpotBackend hostBackend;
 
@@ -254,10 +251,6 @@
             }
             registerBackend(factory.createBackend(this, hostBackend));
         }
-
-        if (GraalOptions.CacheGraphs.getValue()) {
-            cache = new HotSpotGraphCache(compilerToVm);
-        }
     }
 
     private HotSpotBackend registerBackend(HotSpotBackend backend) {
@@ -314,10 +307,6 @@
         return hostBackend.getTarget();
     }
 
-    public HotSpotGraphCache getGraphCache() {
-        return cache;
-    }
-
     public CompilerToVM getCompilerToVM() {
         return compilerToVm;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Wed Mar 12 13:30:08 2014 +0100
@@ -60,8 +60,19 @@
     }
 
     HotSpotVMConfig(CompilerToVM compilerToVm) {
+        /** These fields are set in {@link CompilerToVM#initializeConfiguration}. */
+        gHotSpotVMStructs = 0;
+        gHotSpotVMTypes = 0;
+        gHotSpotVMIntConstants = 0;
+        gHotSpotVMLongConstants = 0;
+
         compilerToVm.initializeConfiguration(this);
 
+        assert gHotSpotVMStructs != 0;
+        assert gHotSpotVMTypes != 0;
+        assert gHotSpotVMIntConstants != 0;
+        assert gHotSpotVMLongConstants != 0;
+
         // Fill the VM fields hash map.
         HashMap<String, VMFields.Field> vmFields = new HashMap<>();
         for (VMFields.Field e : new VMFields(gHotSpotVMStructs)) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Wed Mar 12 13:30:08 2014 +0100
@@ -59,7 +59,7 @@
      * Determines if a given metaspace Method can be inlined. A method may not be inlinable for a
      * number of reasons such as:
      * <ul>
-     * <li>a CompileOracle directive may prevent inlining or compilation of this methods</li>
+     * <li>a CompileOracle directive may prevent inlining or compilation of methods</li>
      * <li>the method may have a bytecode breakpoint set</li>
      * <li>the method may have other bytecode features that require special handling by the VM</li>
      * </ul>
@@ -275,8 +275,6 @@
 
     Object executeCompiledMethodVarargs(Object[] args, HotSpotInstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException;
 
-    long[] getDeoptedLeafGraphIds();
-
     long[] getLineNumberTable(long metaspaceMethod);
 
     long getLocalVariableTableStart(long metaspaceMethod);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Wed Mar 12 13:30:08 2014 +0100
@@ -125,9 +125,6 @@
     public native Object executeCompiledMethodVarargs(Object[] args, HotSpotInstalledCode hotspotInstalledCode);
 
     @Override
-    public native long[] getDeoptedLeafGraphIds();
-
-    @Override
     public native long[] getLineNumberTable(long metaspaceMethod);
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Wed Mar 12 13:30:08 2014 +0100
@@ -330,9 +330,6 @@
             TTY.println(" in %d ms (compiled %d methods)", System.currentTimeMillis() - startTime, compileQueue.getCompletedTaskCount());
         }
 
-        if (runtime.getGraphCache() != null) {
-            runtime.getGraphCache().clear();
-        }
         System.gc();
         phaseTransition("bootstrap2");
     }
@@ -584,7 +581,6 @@
                 CompilationTask task = new CompilationTask(backend, method, entryBCI, block);
 
                 try {
-                    method.setCurrentTask(task);
                     compileQueue.execute(task);
                     if (block) {
                         task.block();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java	Wed Mar 12 13:30:08 2014 +0100
@@ -134,8 +134,8 @@
     public static final LocationIdentity[] NO_LOCATIONS = {};
 
     public HotSpotForeignCallLinkage lookupForeignCall(ForeignCallDescriptor descriptor) {
+        assert foreignCalls != null : descriptor;
         HotSpotForeignCallLinkage callTarget = foreignCalls.get(descriptor);
-        assert foreignCalls != null : descriptor;
         callTarget.finalizeAddress(runtime.getHostBackend());
         return callTarget;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java	Tue Mar 11 18:45:59 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-/*
- * Copyright (c) 2012, 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.meta;
-
-import static com.oracle.graal.phases.GraalOptions.*;
-
-import java.io.*;
-import java.lang.ref.*;
-import java.util.*;
-import java.util.Map.Entry;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.bridge.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.spi.*;
-
-/**
- * This class implements the graph caching system for the HotSpot platform.
- * 
- * This implementation does not use a map to store the actual cached graphs. The problem is that
- * such maps keep the graph, and therefore the {@link ResolvedJavaMethod} referenced from the graph,
- * alive. For some applications and benchmarks this is a problem, e.g., the DaCapoScala "scalatest"
- * benchmark will quickly run out of perm gen because of this.
- * 
- * This cannot be solved with a {@code WeakHashMap<ResolvedJavaMethod, Graph>}, since the values
- * within the map will keep the keys alive. In order for this to work we would require a weak map in
- * which the "strongness" of the value references depends upon the reachability of the keys.
- * 
- * Therefore the graph cache is implemented in such a way that it stores its cache entries within
- * the {@link ResolvedJavaMethod}. It uses the {@link ResolvedJavaMethod#getCompilerStorage()} map
- * with the HotSpotGraphCache instance as key. The cached graph will be kept alive as long as the
- * {@link ResolvedJavaMethod} is alive, but does not prevent the method, and therefore the class,
- * from being unloaded.
- * 
- * The {@link #cachedGraphIds} map is used to find the graphs that should be removed because of
- * deoptimization, and to enforce the graph cache size restriction.
- */
-public class HotSpotGraphCache implements GraphCache {
-
-    private static final PrintStream out = System.out;
-
-    private volatile long hitCounter;
-    private volatile long missCounter;
-    private volatile long removeHitCounter;
-    private volatile long removeCounter;
-    private volatile long putCounter;
-
-    /**
-     * An ordered hash map for looking up the methods corresponding to a specific graph id. It
-     * enforces the maximum graph cache size by removing the oldest (in insertion-order) element if
-     * the cache gets too big.
-     */
-    private final class LRUCache extends LinkedHashMap<Long, WeakReference<ResolvedJavaMethod>> {
-
-        private static final long serialVersionUID = -3973307040793397840L;
-
-        public LRUCache() {
-            super(GraphCacheSize.getValue() * 2, 0.75f, false);
-        }
-
-        @Override
-        protected boolean removeEldestEntry(Entry<Long, WeakReference<ResolvedJavaMethod>> eldest) {
-            if (size() > GraphCacheSize.getValue()) {
-                ResolvedJavaMethod method = eldest.getValue().get();
-                if (method != null) {
-                    StructuredGraph cachedGraph = (StructuredGraph) method.getCompilerStorage().get(HotSpotGraphCache.this);
-                    if (cachedGraph != null && cachedGraph.graphId() == eldest.getKey()) {
-                        method.getCompilerStorage().remove(HotSpotGraphCache.this);
-                    }
-                }
-                return true;
-            } else {
-                return false;
-            }
-        }
-    }
-
-    private final Map<Long, WeakReference<ResolvedJavaMethod>> cachedGraphIds = Collections.synchronizedMap(new LRUCache());
-
-    public HotSpotGraphCache(CompilerToVM compilerToVM) {
-        this.compilerToVM = compilerToVM;
-        if (PrintGraphCache.getValue()) {
-            Runtime.getRuntime().addShutdownHook(new Thread() {
-
-                @Override
-                public void run() {
-                    out.println("put: " + putCounter);
-                    out.println("get hit: " + hitCounter);
-                    out.println("get miss: " + missCounter);
-                    out.println("remove hit: " + removeHitCounter);
-                    out.println("remove miss: " + (removeCounter - removeHitCounter));
-                }
-            });
-        }
-    }
-
-    @Override
-    public StructuredGraph get(ResolvedJavaMethod method) {
-        StructuredGraph result = (StructuredGraph) method.getCompilerStorage().get(this);
-
-        if (PrintGraphCache.getValue()) {
-            if (result == null) {
-                missCounter++;
-            } else {
-                hitCounter++;
-            }
-        }
-        return result;
-    }
-
-    @Override
-    public boolean put(StructuredGraph graph, boolean hasMatureProfilingInfo) {
-        assert graph.method() != null;
-        if (hasMatureProfilingInfo) {
-            cachedGraphIds.put(graph.graphId(), new WeakReference<>(graph.method()));
-            graph.method().getCompilerStorage().put(this, graph);
-
-            if (PrintGraphCache.getValue()) {
-                putCounter++;
-            }
-            return true;
-        }
-        return false;
-    }
-
-    public void clear() {
-        synchronized (cachedGraphIds) {
-            for (WeakReference<ResolvedJavaMethod> ref : cachedGraphIds.values()) {
-                ResolvedJavaMethod method = ref.get();
-                if (method != null) {
-                    method.getCompilerStorage().remove(this);
-                }
-            }
-            cachedGraphIds.clear();
-            hitCounter = 0;
-            missCounter = 0;
-            removeHitCounter = 0;
-            removeCounter = 0;
-            putCounter = 0;
-        }
-    }
-
-    public void removeGraphs(long[] deoptedGraphs) {
-        for (long graphId : deoptedGraphs) {
-            WeakReference<ResolvedJavaMethod> ref = cachedGraphIds.get(graphId);
-            ResolvedJavaMethod method = ref == null ? null : ref.get();
-            if (method != null) {
-                StructuredGraph cachedGraph = (StructuredGraph) method.getCompilerStorage().get(this);
-                if (cachedGraph != null && cachedGraph.graphId() == graphId) {
-                    method.getCompilerStorage().remove(this);
-                    if (PrintGraphCache.getValue()) {
-                        removeHitCounter++;
-                    }
-                }
-            }
-            if (PrintGraphCache.getValue()) {
-                removeCounter++;
-            }
-        }
-    }
-
-    private final CompilerToVM compilerToVM;
-
-    public void removeStaleGraphs() {
-        long[] deoptedGraphs = compilerToVM.getDeoptedLeafGraphIds();
-        if (deoptedGraphs != null) {
-            if (deoptedGraphs.length == 0) {
-                clear();
-            } else {
-                removeGraphs(deoptedGraphs);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java	Wed Mar 12 13:30:08 2014 +0100
@@ -120,8 +120,7 @@
             HotSpotResolvedObjectType resolved = (HotSpotResolvedObjectType) holder;
             return resolved.createField(name, type, offset, modifiers);
         } else {
-            // TODO this cast will not succeed
-            return (ResolvedJavaField) new HotSpotUnresolvedField(holder, name, type);
+            throw GraalInternalError.shouldNotReachHere("unresolved field " + reflectionField);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java	Wed Mar 12 13:30:08 2014 +0100
@@ -84,7 +84,7 @@
 
     @Override
     public String toString() {
-        return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b, name=]", method, getCodeBlob(), isDefault, name);
+        return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b, name=%s]", method, getCodeBlob(), isDefault, name);
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Wed Mar 12 13:30:08 2014 +0100
@@ -68,6 +68,23 @@
     }
 
     @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || !(obj instanceof HotSpotUnresolvedField)) {
+            return false;
+        }
+        HotSpotResolvedJavaField that = (HotSpotResolvedJavaField) obj;
+        return this.holder.equals(that.holder) && this.name.equals(that.name) && this.type.equals(that.type);
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
     public int getModifiers() {
         return modifiers & getReflectionFieldModifiers();
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Wed Mar 12 13:30:08 2014 +0100
@@ -62,7 +62,6 @@
     private Map<Object, Object> compilerStorage;
     private HotSpotMethodData methodData;
     private byte[] code;
-    private CompilationTask currentTask;
     private SpeculationLog speculationLog;
 
     /**
@@ -128,6 +127,20 @@
         return unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset);
     }
 
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof HotSpotResolvedJavaMethod) {
+            HotSpotResolvedJavaMethod that = (HotSpotResolvedJavaMethod) obj;
+            return that.metaspaceMethod == metaspaceMethod;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return (int) metaspaceMethod;
+    }
+
     /**
      * Returns this method's constant method flags ({@code ConstMethod::_flags}).
      * 
@@ -600,14 +613,6 @@
         return unsafe.getInt(metaspaceMethod + config.methodVtableIndexOffset);
     }
 
-    public void setCurrentTask(CompilationTask task) {
-        currentTask = task;
-    }
-
-    public CompilationTask currentTask() {
-        return currentTask;
-    }
-
     public SpeculationLog getSpeculationLog() {
         if (speculationLog == null) {
             speculationLog = new SpeculationLog();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Wed Mar 12 13:30:08 2014 +0100
@@ -44,4 +44,19 @@
     }
 
     public abstract Class<?> mirror();
+
+    @Override
+    public final boolean equals(Object obj) {
+        if (!(obj instanceof HotSpotResolvedJavaType)) {
+            return false;
+        }
+        HotSpotResolvedJavaType that = (HotSpotResolvedJavaType) obj;
+        return this.mirror().equals(that.mirror());
+    }
+
+    @Override
+    public final int hashCode() {
+        return getName().hashCode();
+    }
+
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Wed Mar 12 13:30:08 2014 +0100
@@ -593,7 +593,7 @@
         }
         if (!includeSuperclasses) {
             int myFieldsStart = 0;
-            while (myFieldsStart < instanceFields.length && instanceFields[myFieldsStart].getDeclaringClass() != this) {
+            while (myFieldsStart < instanceFields.length && !instanceFields[myFieldsStart].getDeclaringClass().equals(this)) {
                 myFieldsStart++;
             }
             if (myFieldsStart == 0) {
@@ -763,20 +763,6 @@
     }
 
     @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof HotSpotResolvedObjectType)) {
-            return false;
-        }
-        HotSpotResolvedObjectType that = (HotSpotResolvedObjectType) obj;
-        return this.mirror() == that.mirror();
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-
-    @Override
     public String toString() {
         String simpleName;
         if (isArray() || isInterface()) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java	Wed Mar 12 13:30:08 2014 +0100
@@ -70,7 +70,10 @@
 
     @Override
     public ResolvedJavaType getArrayClass() {
-        Class javaArrayMirror = kind == Kind.Void ? null : Array.newInstance(mirror(), 0).getClass();
+        if (kind == Kind.Void) {
+            return null;
+        }
+        Class<?> javaArrayMirror = Array.newInstance(mirror(), 0).getClass();
         return HotSpotResolvedObjectType.fromClass(javaArrayMirror);
     }
 
@@ -151,7 +154,7 @@
     @Override
     public boolean isAssignableFrom(ResolvedJavaType other) {
         assert other != null;
-        return other == this;
+        return other.equals(this);
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/HotSpotNativeFunctionInterface.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nfi/HotSpotNativeFunctionInterface.java	Wed Mar 12 13:30:08 2014 +0100
@@ -157,8 +157,8 @@
         Suites suites = providers.getSuites().createSuites();
         PhaseSuite<HighTierContext> phaseSuite = backend.getSuites().getDefaultGraphBuilderSuite().copy();
         CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, g.method(), false);
-        CompilationResult compResult = GraalCompiler.compileGraph(g, cc, g.method(), providers, backend, backend.getTarget(), null, phaseSuite, OptimisticOptimizations.ALL,
-                        DefaultProfilingInfo.get(TriState.UNKNOWN), null, suites, true, new CompilationResult(), CompilationResultBuilderFactory.Default);
+        CompilationResult compResult = GraalCompiler.compileGraph(g, null, cc, g.method(), providers, backend, backend.getTarget(), null, phaseSuite, OptimisticOptimizations.ALL,
+                        DefaultProfilingInfo.get(TriState.UNKNOWN), null, suites, new CompilationResult(), CompilationResultBuilderFactory.Default);
         InstalledCode installedCode;
         try (Scope s = Debug.scope("CodeInstall", providers.getCodeCache(), g.method())) {
             installedCode = providers.getCodeCache().addMethod(g.method(), compResult, null);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Wed Mar 12 13:30:08 2014 +0100
@@ -42,7 +42,9 @@
     protected boolean verify(StructuredGraph graph, PhaseContext context) {
         for (ConstantNode node : getConstantNodes(graph)) {
             if (node.recordsUsages() || !node.gatherUsages(graph).isEmpty()) {
-                assert !isObject(node) || isNullReference(node) || isInternedString(node) : "illegal object constant: " + node;
+                if (isObject(node) && !isNullReference(node) && !isInternedString(node)) {
+                    throw new VerificationError("illegal object constant: " + node);
+                }
             }
         }
         return true;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Wed Mar 12 13:30:08 2014 +0100
@@ -101,7 +101,7 @@
                  */
                 proxy.replaceAndDelete(graph.unique(new OSRLocalNode(i, proxy.stamp().unrestricted())));
             } else {
-                assert value instanceof OSRLocalNode;
+                assert value == null || value instanceof OSRLocalNode;
             }
         }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java	Wed Mar 12 13:30:08 2014 +0100
@@ -186,7 +186,6 @@
         boolean isObjectResult = linkage.getOutgoingCallingConvention().getReturn().getKind() == Kind.Object;
 
         StructuredGraph graph = new StructuredGraph(toString(), null);
-        graph.replaceFixed(graph.start(), graph.add(new StubStartNode(this)));
 
         GraphKit kit = new GraphKit(graph, providers);
         ParameterNode[] params = createParameters(kit, args);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Wed Mar 12 13:30:08 2014 +0100
@@ -145,8 +145,8 @@
                 CodeCacheProvider codeCache = providers.getCodeCache();
                 // The stub itself needs the incoming calling convention.
                 CallingConvention incomingCc = linkage.getIncomingCallingConvention();
-                final CompilationResult compResult = compileGraph(graph, incomingCc, getInstalledCodeOwner(), providers, backend, codeCache.getTarget(), null,
-                                providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), null, providers.getSuites().getDefaultSuites(), true,
+                final CompilationResult compResult = compileGraph(graph, Stub.this, incomingCc, getInstalledCodeOwner(), providers, backend, codeCache.getTarget(), null,
+                                providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), null, providers.getSuites().getDefaultSuites(),
                                 new CompilationResult(), CompilationResultBuilderFactory.Default);
 
                 assert destroyedRegisters != null;
--- a/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.java.decompiler.test/src/com/oracle/graal/java/decompiler/test/TestUtil.java	Wed Mar 12 13:30:08 2014 +0100
@@ -49,7 +49,7 @@
         new GraphBuilderPhase.Instance(metaAccess, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph);
         PhaseSuite<HighTierContext> graphBuilderSuite = suitesProvider.getDefaultGraphBuilderSuite();
         CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false);
-        compileGraph(graph, cc, method, providers, backend, providers.getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), null, suites, true,
+        compileGraph(graph, null, cc, method, providers, backend, providers.getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), null, suites,
                         new CompilationResult(), CompilationResultBuilderFactory.Default);
     }
 }
--- a/graal/com.oracle.graal.java.decompiler/src/com/oracle/graal/java/decompiler/Decompiler.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.java.decompiler/src/com/oracle/graal/java/decompiler/Decompiler.java	Wed Mar 12 13:30:08 2014 +0100
@@ -25,6 +25,7 @@
 import java.io.*;
 import java.util.*;
 
+import com.oracle.graal.graph.*;
 import com.oracle.graal.java.decompiler.block.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
@@ -55,9 +56,9 @@
                 schedule = new SchedulePhase();
                 schedule.apply(graph);
             } catch (Throwable t) {
+                throw new GraalInternalError(t);
             }
         }
-
         cfg = schedule.getCFG();
     }
 
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java	Wed Mar 12 13:30:08 2014 +0100
@@ -141,7 +141,7 @@
                             desc = constant.toString();
                         }
                         if (!multiline) {
-                            desc.replaceAll("\\n", "");
+                            desc = desc.replaceAll("\\n", "");
                         }
                         buf.append(String.format("#%-10d // %s", cpi, desc));
                         break;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Wed Mar 12 13:30:08 2014 +0100
@@ -146,7 +146,7 @@
     }
 
     public boolean isCompatibleWith(FrameStateBuilder other) {
-        assert method == other.method && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method";
+        assert method.equals(other.method) && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method";
         assert lockedObjects.length == monitorIds.length && other.lockedObjects.length == other.monitorIds.length : "mismatch between lockedObjects and monitorIds";
 
         if (stackSize() != other.stackSize()) {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java	Wed Mar 12 13:30:08 2014 +0100
@@ -100,7 +100,7 @@
             }
         } else if (boxingTypes.contains(holder)) {
             return method.getName().equals("valueOf");
-        } else if (method.getDeclaringClass() == metaAccess.lookupJavaType(Class.class)) {
+        } else if (method.getDeclaringClass().equals(metaAccess.lookupJavaType(Class.class))) {
             return method.getName().equals("desiredAssertionStatus");
         } else if (method.getDeclaringClass().equals(declaringClass)) {
             return (method.getName().equals("$jacocoInit"));
@@ -113,7 +113,7 @@
         for (ValueNode node : graph.getNodes().filter(ValueNode.class)) {
             if (node instanceof StoreFieldNode) {
                 ResolvedJavaField field = ((StoreFieldNode) node).field();
-                verify(field.getDeclaringClass() == declaringClass, node, "store to field " + format("%H.%n", field));
+                verify(field.getDeclaringClass().equals(declaringClass), node, "store to field " + format("%H.%n", field));
                 verify(isStatic(field.getModifiers()), node, "store to field " + format("%H.%n", field));
                 if (optionValueType.isAssignableFrom((ResolvedJavaType) field.getType())) {
                     verify(isFinal(field.getModifiers()), node, "option field " + format("%H.%n", field) + " not final");
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java	Wed Mar 12 13:30:08 2014 +0100
@@ -27,7 +27,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.LIRInstruction.StateProcedure;
 import com.oracle.graal.lir.StandardOp.BlockEndOp;
-import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 
 /**
@@ -36,13 +35,7 @@
  */
 public class LIR {
 
-    public final ControlFlowGraph cfg;
-
-    /**
-     * The nodes for the blocks. TODO: This should go away, we want all nodes connected with a
-     * next-pointer.
-     */
-    private final BlockMap<List<ScheduledNode>> blockToNodesMap;
+    private final ControlFlowGraph cfg;
 
     /**
      * The linear-scan ordered list of blocks.
@@ -58,9 +51,9 @@
 
     private int numVariables;
 
-    public SpillMoveFactory spillMoveFactory;
+    private SpillMoveFactory spillMoveFactory;
 
-    public final BlockMap<List<LIRInstruction>> lirInstructions;
+    private final BlockMap<List<LIRInstruction>> lirInstructions;
 
     public interface SpillMoveFactory {
 
@@ -72,19 +65,15 @@
     /**
      * Creates a new LIR instance for the specified compilation.
      */
-    public LIR(ControlFlowGraph cfg, BlockMap<List<ScheduledNode>> blockToNodesMap, List<Block> linearScanOrder, List<Block> codeEmittingOrder) {
+    public LIR(ControlFlowGraph cfg, List<Block> linearScanOrder, List<Block> codeEmittingOrder) {
         this.cfg = cfg;
-        this.blockToNodesMap = blockToNodesMap;
         this.codeEmittingOrder = codeEmittingOrder;
         this.linearScanOrder = linearScanOrder;
         this.lirInstructions = new BlockMap<>(cfg);
     }
 
-    /**
-     * Gets the nodes in a given block.
-     */
-    public List<ScheduledNode> nodesFor(Block block) {
-        return blockToNodesMap.get(block);
+    public ControlFlowGraph getControlFlowGraph() {
+        return cfg;
     }
 
     /**
@@ -101,7 +90,11 @@
         return false;
     }
 
-    public List<LIRInstruction> lir(Block block) {
+    public SpillMoveFactory getSpillMoveFactory() {
+        return spillMoveFactory;
+    }
+
+    public List<LIRInstruction> lir(AbstractBlock<?> block) {
         return lirInstructions.get(block);
     }
 
@@ -214,4 +207,8 @@
         }
         return true;
     }
+
+    public void setSpillMoveFactory(SpillMoveFactory spillMoveFactory) {
+        this.spillMoveFactory = spillMoveFactory;
+    }
 }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java	Wed Mar 12 13:30:08 2014 +0100
@@ -38,9 +38,9 @@
  */
 public final class RedundantMoveElimination {
 
-    public static void optimize(LIR lir, FrameMap frameMap, ResolvedJavaMethod method) {
+    public static void optimize(LIR lir, FrameMap frameMap) {
         RedundantMoveElimination redundantMoveElimination = new RedundantMoveElimination();
-        redundantMoveElimination.doOptimize(lir, frameMap, method);
+        redundantMoveElimination.doOptimize(lir, frameMap);
     }
 
     /**
@@ -100,9 +100,9 @@
     /**
      * The main method doing the elimination of redundant moves.
      */
-    private void doOptimize(LIR lir, FrameMap frameMap, ResolvedJavaMethod method) {
+    private void doOptimize(LIR lir, FrameMap frameMap) {
 
-        try (Indent indent = Debug.logAndIndent("eliminate redundant moves in %s", method)) {
+        try (Indent indent = Debug.logAndIndent("eliminate redundant moves")) {
 
             callerSaveRegs = frameMap.registerConfig.getCallerSaveRegisters();
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Wed Mar 12 13:30:08 2014 +0100
@@ -71,8 +71,6 @@
 
     private static final AtomicLong uniqueGraphIds = new AtomicLong();
 
-    private final Set<Long> leafGraphIds = new HashSet<>(4);
-
     private StartNode start;
     private final ResolvedJavaMethod method;
     private final long graphId;
@@ -162,14 +160,6 @@
         this.start = start;
     }
 
-    /**
-     * @return the {@link Set} that contains the {@link #graphId()} of all graphs that were
-     *         incorporated into this one (e.g. by inlining).
-     */
-    public Set<Long> getLeafGraphIds() {
-        return leafGraphIds;
-    }
-
     @Override
     public StructuredGraph copy() {
         return copy(name);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.nodes;
 
+import java.util.*;
+
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
@@ -102,7 +104,7 @@
                 Debug.log("Profile useless, there is enough static type information available.");
                 return object;
             }
-            if (type == lastCheckedType) {
+            if (Objects.equals(type, lastCheckedType)) {
                 // We have already incorporate the knowledge about this type => abort.
                 return this;
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -54,7 +54,7 @@
      * @param y the instruction that produces the second input to this instruction
      */
     public CompareNode(ValueNode x, ValueNode y) {
-        assert (x == null && y == null) || x.kind() == y.kind();
+        assert x != null && y != null && x.kind() == y.kind();
         this.x = x;
         this.y = y;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -53,7 +53,7 @@
      * @param y the instruction that produces the second input to this instruction
      */
     public IntegerTestNode(ValueNode x, ValueNode y) {
-        assert (x == null && y == null) || x.stamp().isCompatible(y.stamp());
+        assert x != null && y != null && x.stamp().isCompatible(y.stamp());
         this.x = x;
         this.y = y;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -117,7 +117,7 @@
             } else if (!xIdentity && !yIdentity) {
                 // both are virtual without identity: check contents
                 assert stateX.getVirtualObject().entryCount() == 1 && stateY.getVirtualObject().entryCount() == 1;
-                assert stateX.getVirtualObject().type() == stateY.getVirtualObject().type();
+                assert stateX.getVirtualObject().type().equals(stateY.getVirtualObject().type());
                 assert stateX.getVirtualObject().entryKind(0).getStackKind() == Kind.Int || stateX.getVirtualObject().entryKind(0) == Kind.Long;
                 IntegerEqualsNode equals = new IntegerEqualsNode(stateX.getEntry(0), stateY.getEntry(0));
                 tool.addNode(equals);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/AbstractBlock.java	Wed Mar 12 13:30:08 2014 +0100
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 2014, 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.nodes.cfg;
+
+import com.oracle.graal.nodes.*;
+
+public interface AbstractBlock<T extends AbstractBlock<?>> {
+
+    int getId();
+
+    AbstractBeginNode getBeginNode();
+
+    Loop getLoop();
+
+    int getLoopDepth();
+
+    boolean isLoopHeader();
+
+    boolean isLoopEnd();
+
+    boolean isExceptionEntry();
+
+    Iterable<T> getPredecessors();
+
+    int getPredecessorCount();
+
+    Iterable<T> getSuccessors();
+
+    int getSuccessorCount();
+
+    int getLinearScanNumber();
+
+    void setLinearScanNumber(int linearScanNumber);
+
+    boolean isAligned();
+
+    void setAlign(boolean align);
+}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java	Wed Mar 12 13:30:08 2014 +0100
@@ -27,7 +27,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 
-public final class Block {
+public final class Block implements AbstractBlock<Block> {
 
     protected final AbstractBeginNode beginNode;
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java	Wed Mar 12 13:30:08 2014 +0100
@@ -31,11 +31,11 @@
         data = (T[]) new Object[cfg.getBlocks().length];
     }
 
-    public T get(Block block) {
+    public T get(AbstractBlock<?> block) {
         return data[block.getId()];
     }
 
-    public void put(Block block, T value) {
+    public void put(AbstractBlock<?> block, T value) {
         data[block.getId()] = value;
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -76,7 +76,7 @@
         }
         if (tool.canonicalizeReads()) {
             if (metaAccess != null && object != null && object.isConstant()) {
-                if ((location.getLocationIdentity() == LocationIdentity.FINAL_LOCATION || location.getLocationIdentity() == LocationIdentity.ARRAY_LENGTH_LOCATION) &
+                if ((location.getLocationIdentity() == LocationIdentity.FINAL_LOCATION || location.getLocationIdentity() == LocationIdentity.ARRAY_LENGTH_LOCATION) &&
                                 location instanceof ConstantLocationNode) {
                     long displacement = ((ConstantLocationNode) location).getDisplacement();
                     Kind kind = location.getValueKind();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -60,7 +60,7 @@
         if (state != null && state.getState() == EscapeState.Virtual) {
             ResolvedJavaType objectType = state.getVirtualObject().type();
             ResolvedJavaType expectedType = tool.getMetaAccessProvider().lookupJavaType(boxingKind.toBoxedJavaClass());
-            if (objectType == expectedType) {
+            if (objectType.equals(expectedType)) {
                 tool.replaceWithValue(state.getEntry(0));
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -165,7 +165,7 @@
         }
         if (tool.assumptions() != null && tool.assumptions().useOptimisticAssumptions()) {
             ResolvedJavaType exactType = type.findUniqueConcreteSubtype();
-            if (exactType != null && exactType != type) {
+            if (exactType != null && !exactType.equals(type)) {
                 // Propagate more precise type information to usages of the checkcast.
                 tool.assumptions().recordConcreteSubtype(type, exactType);
                 return graph().add(new CheckCastNode(exactType, object, profile, forStoreCheck));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -165,7 +165,7 @@
 
     public static MethodCallTargetNode find(StructuredGraph graph, ResolvedJavaMethod method) {
         for (MethodCallTargetNode target : graph.getNodes(MethodCallTargetNode.class)) {
-            if (target.targetMethod == method) {
+            if (target.targetMethod.equals(method)) {
                 return target;
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/GraphCache.java	Tue Mar 11 18:45:59 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2012, 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.nodes.spi;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.nodes.*;
-
-/**
- * A cache for graphs associated with {@linkplain StructuredGraph#method() methods}.
- */
-public interface GraphCache {
-
-    /**
-     * Requests that a graph be added to this cache.
-     * 
-     * @param hasMatureProfilingInfo indicates that the caller has
-     *            {@linkplain ProfilingInfo#isMature() mature} profiling info for the method
-     *            associated with the graph
-     * @return true if {@code graph} was added to this cache, false otherwise
-     */
-    boolean put(StructuredGraph graph, boolean hasMatureProfilingInfo);
-
-    /**
-     * Gets the graph from this cache associated with a given method.
-     * 
-     * @param method a method for which a cached graph is requested
-     * @return the graph cached for {@code method} or null if it does not exist
-     */
-    StructuredGraph get(ResolvedJavaMethod method);
-
-    /**
-     * The cache will remove graphs it considers stale. For example, graphs associated with
-     * installed code that has subsequently be deoptimized might be considered stale.
-     */
-    void removeStaleGraphs();
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java	Wed Mar 12 13:30:08 2014 +0100
@@ -119,14 +119,14 @@
             meetAlwaysNull = other.alwaysNull;
         } else {
             meetType = meetTypes(type(), other.type());
-            meetExactType = meetType == type && meetType == other.type && exactType && other.exactType;
+            meetExactType = Objects.equals(meetType, type) && Objects.equals(meetType, other.type) && exactType && other.exactType;
             meetNonNull = nonNull && other.nonNull;
             meetAlwaysNull = false;
         }
 
-        if (meetType == type && meetExactType == exactType && meetNonNull == nonNull && meetAlwaysNull == alwaysNull) {
+        if (Objects.equals(meetType, type) && meetExactType == exactType && meetNonNull == nonNull && meetAlwaysNull == alwaysNull) {
             return this;
-        } else if (meetType == other.type && meetExactType == other.exactType && meetNonNull == other.nonNull && meetAlwaysNull == other.alwaysNull) {
+        } else if (Objects.equals(meetType, other.type) && meetExactType == other.exactType && meetNonNull == other.nonNull && meetAlwaysNull == other.alwaysNull) {
             return other;
         } else {
             return new ObjectStamp(meetType, meetExactType, meetNonNull, meetAlwaysNull);
@@ -186,7 +186,7 @@
         boolean joinAlwaysNull = alwaysNull || other.alwaysNull;
         boolean joinNonNull = nonNull || other.nonNull;
         boolean joinExactType = exactType || other.exactType;
-        if (type == other.type) {
+        if (Objects.equals(type, other.type)) {
             joinType = type;
         } else if (type == null && other.type == null) {
             joinType = null;
@@ -230,9 +230,9 @@
         } else if (joinExactType && !isConcreteType(joinType)) {
             return StampFactory.illegal(Kind.Object);
         }
-        if (joinType == type && joinExactType == exactType && joinNonNull == nonNull && joinAlwaysNull == alwaysNull) {
+        if (Objects.equals(joinType, type) && joinExactType == exactType && joinNonNull == nonNull && joinAlwaysNull == alwaysNull) {
             return this;
-        } else if (joinType == other.type && joinExactType == other.exactType && joinNonNull == other.nonNull && joinAlwaysNull == other.alwaysNull) {
+        } else if (Objects.equals(joinType, other.type) && joinExactType == other.exactType && joinNonNull == other.nonNull && joinAlwaysNull == other.alwaysNull) {
             return other;
         } else {
             return new ObjectStamp(joinType, joinExactType, joinNonNull, joinAlwaysNull);
@@ -244,7 +244,7 @@
     }
 
     private static ResolvedJavaType meetTypes(ResolvedJavaType a, ResolvedJavaType b) {
-        if (a == b) {
+        if (Objects.equals(a, b)) {
             return a;
         } else if (a == null || b == null) {
             return null;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java	Wed Mar 12 13:30:08 2014 +0100
@@ -240,7 +240,7 @@
         assert type.getKind() == Kind.Object;
         ResolvedJavaType exact = type.asExactType();
         if (exact != null) {
-            assert !exactType || type == exact;
+            assert !exactType || type.equals(exact);
             return new ObjectStamp(exact, true, nonNull, false);
         } else {
             return new ObjectStamp(type, exactType, nonNull, false);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -77,7 +77,7 @@
     public int fieldIndex(ResolvedJavaField field) {
         // on average fields.length == ~6, so a linear search is fast enough
         for (int i = 0; i < fields.length; i++) {
-            if (fields[i] == field) {
+            if (fields[i].equals(field)) {
                 return i;
             }
         }
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java	Wed Mar 12 13:30:08 2014 +0100
@@ -172,7 +172,7 @@
                 String declaringClass = option.declaringClass;
                 Name fieldName = option.field.getSimpleName();
                 String comma = i == info.options.size() - 1 ? "" : ",";
-                out.printf("            new %s(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s\n", desc, name, type, help, declaringClass, fieldName, optionValue, comma);
+                out.printf("            new %s(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s%n", desc, name, type, help, declaringClass, fieldName, optionValue, comma);
                 i++;
             }
             out.println("        );");
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Wed Mar 12 13:30:08 2014 +0100
@@ -66,7 +66,7 @@
         new ConditionalElimination(graph.start(), new State()).apply();
     }
 
-    public static class State extends MergeableState<State> {
+    public static class State extends MergeableState<State> implements Cloneable {
 
         private IdentityHashMap<ValueNode, ResolvedJavaType> knownTypes;
         private HashSet<ValueNode> knownNonNull;
@@ -253,7 +253,7 @@
             ResolvedJavaType knownType = getNodeType(original);
             ResolvedJavaType newType = tighten(type, knownType);
 
-            if (newType != knownType) {
+            if (!newType.equals(knownType)) {
                 knownTypes.put(original, newType);
                 metricTypeRegistered.increment();
             }
@@ -271,7 +271,7 @@
     public static ResolvedJavaType widen(ResolvedJavaType a, ResolvedJavaType b) {
         if (a == null || b == null) {
             return null;
-        } else if (a == b) {
+        } else if (a.equals(b)) {
             return a;
         } else {
             return a.findLeastCommonAncestor(b);
@@ -283,7 +283,7 @@
             return b;
         } else if (b == null) {
             return a;
-        } else if (a == b) {
+        } else if (a.equals(b)) {
             return a;
         } else if (a.isAssignableFrom(b)) {
             return b;
@@ -623,7 +623,7 @@
                     ValueNode receiver = callTarget.receiver();
                     if (receiver != null && (callTarget.invokeKind() == InvokeKind.Interface || callTarget.invokeKind() == InvokeKind.Virtual)) {
                         ResolvedJavaType type = state.getNodeType(receiver);
-                        if (type != ObjectStamp.typeOrNull(receiver)) {
+                        if (!Objects.equals(type, ObjectStamp.typeOrNull(receiver))) {
                             ResolvedJavaMethod method = type.resolveMethod(callTarget.targetMethod());
                             if (method != null) {
                                 if (Modifier.isFinal(method.getModifiers()) || Modifier.isFinal(type.getModifiers())) {
@@ -645,7 +645,7 @@
             for (Node n : value.usages()) {
                 if (n instanceof InstanceOfNode) {
                     InstanceOfNode instanceOfNode = (InstanceOfNode) n;
-                    if (instanceOfNode.type() == type && state.trueConditions.containsKey(instanceOfNode)) {
+                    if (instanceOfNode.type().equals(type) && state.trueConditions.containsKey(instanceOfNode)) {
                         ValueNode v = state.trueConditions.get(instanceOfNode);
                         if (v instanceof GuardingNode) {
                             return (GuardingNode) v;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Wed Mar 12 13:30:08 2014 +0100
@@ -281,7 +281,7 @@
     }
 
     private static StructuredGraph getCachedGraph(ResolvedJavaMethod method, HighTierContext context) {
-        if (CacheGraphs.getValue() && context.getGraphCache() != null) {
+        if (context.getGraphCache() != null) {
             StructuredGraph cachedGraph = context.getGraphCache().get(method);
             if (cachedGraph != null) {
                 return cachedGraph;
@@ -304,8 +304,8 @@
             canonicalizer.apply(newGraph, context);
         }
 
-        if (CacheGraphs.getValue() && context.getGraphCache() != null) {
-            context.getGraphCache().put(newGraph.copy(), hasMatureProfilingInfo);
+        if (hasMatureProfilingInfo && context.getGraphCache() != null) {
+            context.getGraphCache().put(newGraph.method(), newGraph.copy());
         }
         return newGraph;
     }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Wed Mar 12 13:30:08 2014 +0100
@@ -318,14 +318,9 @@
         }
 
         protected static void inline(Invoke invoke, ResolvedJavaMethod concrete, Inlineable inlineable, Assumptions assumptions, boolean receiverNullCheck) {
-            StructuredGraph graph = invoke.asNode().graph();
             if (inlineable instanceof InlineableGraph) {
                 StructuredGraph calleeGraph = ((InlineableGraph) inlineable).getGraph();
                 InliningUtil.inline(invoke, calleeGraph, receiverNullCheck);
-
-                graph.getLeafGraphIds().add(calleeGraph.graphId());
-                // we might at some point cache already-inlined graphs, so add recursively:
-                graph.getLeafGraphIds().addAll(calleeGraph.getLeafGraphIds());
             } else {
                 assert inlineable instanceof InlineableMacroNode;
 
@@ -1434,7 +1429,7 @@
                     } else {
                         // only handle the outermost frame states
                         if (frameState.outerFrameState() == null) {
-                            assert frameState.bci == FrameState.INVALID_FRAMESTATE_BCI || frameState.method() == inlineGraph.method();
+                            assert frameState.bci == FrameState.INVALID_FRAMESTATE_BCI || frameState.method().equals(inlineGraph.method());
                             if (outerFrameState == null) {
                                 outerFrameState = stateAfter.duplicateModified(invoke.bci(), stateAfter.rethrowException(), invokeNode.kind());
                                 outerFrameState.setDuringCall(true);
@@ -1545,7 +1540,7 @@
 
     public static FixedWithNextNode inlineMacroNode(Invoke invoke, ResolvedJavaMethod concrete, Class<? extends FixedWithNextNode> macroNodeClass) throws GraalInternalError {
         StructuredGraph graph = invoke.asNode().graph();
-        if (((MethodCallTargetNode) invoke.callTarget()).targetMethod() != concrete) {
+        if (!concrete.equals(((MethodCallTargetNode) invoke.callTarget()).targetMethod())) {
             assert ((MethodCallTargetNode) invoke.callTarget()).invokeKind() != InvokeKind.Static;
             InliningUtil.replaceInvokeCallTarget(invoke, graph, InvokeKind.Special, concrete);
         }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ValueAnchorCleanupPhase.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ValueAnchorCleanupPhase.java	Wed Mar 12 13:30:08 2014 +0100
@@ -37,7 +37,7 @@
  */
 public class ValueAnchorCleanupPhase extends Phase {
 
-    private static class State extends MergeableState<State> {
+    private static class State extends MergeableState<State> implements Cloneable {
 
         private final HashSet<Node> anchoredValues;
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Wed Mar 12 13:30:08 2014 +0100
@@ -92,10 +92,6 @@
     // graph caching
     @Option(help = "")
     public static final OptionValue<Boolean> CacheGraphs = new OptionValue<>(true);
-    @Option(help = "")
-    public static final OptionValue<Integer> GraphCacheSize = new OptionValue<>(1000);
-    @Option(help = "")
-    public static final OptionValue<Boolean> PrintGraphCache = new OptionValue<>(false);
 
     //loop transform settings TODO (gd) tune
     @Option(help = "")
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java	Wed Mar 12 13:30:08 2014 +0100
@@ -27,15 +27,35 @@
 /***
  * This phase serves as a verification, in order to check the graph for certain properties. The
  * {@link #verify(StructuredGraph, Object)} method will be used as an assertion, and implements the
- * actual check. Instead of returning false, it is also valid to throw an {@link AssertionError} in
- * the implemented {@link #verify(StructuredGraph, Object)} method.
+ * actual check. Instead of returning false, it is also valid to throw an {@link VerificationError}
+ * in the implemented {@link #verify(StructuredGraph, Object)} method.
  */
 public abstract class VerifyPhase<C> extends BasePhase<C> {
 
+    /**
+     * Thrown when verification performed by a {@link VerifyPhase} fails.
+     */
+    @SuppressWarnings("serial")
+    public static class VerificationError extends AssertionError {
+
+        public VerificationError(String message) {
+            super(message);
+        }
+
+        public VerificationError(String message, Throwable cause) {
+            super(message, cause);
+        }
+    }
+
     @Override
     protected final void run(StructuredGraph graph, C context) {
         assert verify(graph, context);
     }
 
+    /**
+     * Performs the actual verification.
+     * 
+     * @throws VerificationError if the verification fails
+     */
     protected abstract boolean verify(StructuredGraph graph, C context);
 }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java	Wed Mar 12 13:30:08 2014 +0100
@@ -169,7 +169,7 @@
 
         public final NodeMap<Set<LoopInfo>> requires;
 
-        private double loopFrequency = -1;
+        private double loopFrequency = -1.0;
         public boolean ended = false;
 
         public LoopInfo(LoopBeginNode loopBegin) {
@@ -178,7 +178,8 @@
         }
 
         public double loopFrequency(NodesToDoubles nodeProbabilities) {
-            if (loopFrequency == -1 && ended) {
+            // loopFrequency is initialized with -1.0
+            if (loopFrequency < 0.0 && ended) {
                 double backEdgeProb = 0.0;
                 for (LoopEndNode le : loopBegin.loopEnds()) {
                     double factor = 1;
@@ -219,7 +220,7 @@
         return r;
     }
 
-    private class Probability extends MergeableState<Probability> {
+    private class Probability extends MergeableState<Probability> implements Cloneable {
 
         public double probability;
         public Set<LoopInfo> loops;
@@ -330,7 +331,7 @@
         }
     }
 
-    private class LoopCount extends MergeableState<LoopCount> {
+    private class LoopCount extends MergeableState<LoopCount> implements Cloneable {
 
         public double count;
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java	Wed Mar 12 13:30:08 2014 +0100
@@ -62,7 +62,7 @@
         // empty default implementation
     }
 
-    public static final class EmptyState extends MergeableState<EmptyState> {
+    public static final class EmptyState extends MergeableState<EmptyState> implements Cloneable {
 
         @Override
         public EmptyState clone() {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java	Wed Mar 12 13:30:08 2014 +0100
@@ -22,8 +22,11 @@
  */
 package com.oracle.graal.phases.tiers;
 
+import java.util.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.util.*;
@@ -32,18 +35,19 @@
 
     private final PhaseSuite<HighTierContext> graphBuilderSuite;
 
-    private final GraphCache cache;
+    private final Map<ResolvedJavaMethod, StructuredGraph> cache;
     private final OptimisticOptimizations optimisticOpts;
 
     public HighTierContext(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, LoweringProvider lowerer, Replacements replacements, Assumptions assumptions,
-                    GraphCache cache, PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts) {
+                    Map<ResolvedJavaMethod, StructuredGraph> cache, PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts) {
         super(metaAccess, constantReflection, lowerer, replacements, assumptions);
         this.cache = cache;
         this.graphBuilderSuite = graphBuilderSuite;
         this.optimisticOpts = optimisticOpts;
     }
 
-    public HighTierContext(Providers providers, Assumptions assumptions, GraphCache cache, PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts) {
+    public HighTierContext(Providers providers, Assumptions assumptions, Map<ResolvedJavaMethod, StructuredGraph> cache, PhaseSuite<HighTierContext> graphBuilderSuite,
+                    OptimisticOptimizations optimisticOpts) {
         this(providers.getMetaAccess(), providers.getConstantReflection(), providers.getLowerer(), providers.getReplacements(), assumptions, cache, graphBuilderSuite, optimisticOpts);
     }
 
@@ -51,7 +55,7 @@
         return graphBuilderSuite;
     }
 
-    public GraphCache getGraphCache() {
+    public Map<ResolvedJavaMethod, StructuredGraph> getGraphCache() {
         return cache;
     }
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java	Wed Mar 12 13:30:08 2014 +0100
@@ -62,18 +62,13 @@
         return isAssignableType(x, metaAccess) && !isNullConstant(y);
     }
 
-    private static boolean isEqualsMethod(StructuredGraph graph) {
-        Signature signature = graph.method().getSignature();
-        return graph.method().getName().equals("equals") && signature.getParameterCount(false) == 1 && signature.getParameterKind(0).equals(Kind.Object);
-    }
-
     @Override
     protected boolean verify(StructuredGraph graph, PhaseContext context) {
         for (ObjectEqualsNode cn : graph.getNodes().filter(ObjectEqualsNode.class)) {
-            if (!isEqualsMethod(graph)) {
-                // bail out if we compare an object of type klass with == or != (except null checks)
-                assert !(checkUsage(cn.x(), cn.y(), context.getMetaAccess()) && checkUsage(cn.y(), cn.x(), context.getMetaAccess())) : "Verification of " + klass.getName() +
-                                " usage failed: Comparing " + cn.x() + " and " + cn.y() + " in " + graph.method() + " must use .equals() for object equality, not '==' or '!='";
+            // bail out if we compare an object of type klass with == or != (except null checks)
+            if (checkUsage(cn.x(), cn.y(), context.getMetaAccess()) && checkUsage(cn.y(), cn.x(), context.getMetaAccess())) {
+                throw new VerificationError("Verification of " + klass.getName() + " usage failed: Comparing " + cn.x() + " and " + cn.y() + " in " + graph.method() +
+                                " must use .equals() for object equality, not '==' or '!='");
             }
         }
         return true;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Wed Mar 12 13:30:08 2014 +0100
@@ -250,11 +250,8 @@
             }
         }
 
-        if (lir != null) {
-            for (Node node : lir.nodesFor(block)) {
-                printNode(node, false);
-            }
-        } else {
+        // Currently no node printing for lir
+        if (lir == null) {
             Node cur = block.getBeginNode();
             while (true) {
                 printNode(cur, false);
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Wed Mar 12 13:30:08 2014 +0100
@@ -141,7 +141,7 @@
             cfgPrinter.target = cfgPrinter.lirGenerator.target();
         }
         if (cfgPrinter.lir != null) {
-            cfgPrinter.cfg = cfgPrinter.lir.cfg;
+            cfgPrinter.cfg = cfgPrinter.lir.getControlFlowGraph();
         }
 
         CodeCacheProvider codeCache = Debug.contextLookup(CodeCacheProvider.class);
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Wed Mar 12 13:30:08 2014 +0100
@@ -86,7 +86,7 @@
     // This field must be lazily initialized as this class may be loaded in a version
     // VM startup phase at which not all required features (such as system properties)
     // are online.
-    private static SimpleDateFormat sdf;
+    private static volatile SimpleDateFormat sdf;
 
     private void initializeFilePrinter() {
         String ext;
@@ -98,7 +98,13 @@
         if (sdf == null) {
             sdf = new SimpleDateFormat("YYYY-MM-dd-HHmm");
         }
-        String prefix = "Graphs-" + Thread.currentThread().getName() + "-" + sdf.format(new Date());
+
+        // DateFormats are inherently unsafe for multi-threaded use. Use a synchronized block.
+        String prefix;
+        synchronized (sdf) {
+            prefix = "Graphs-" + Thread.currentThread().getName() + "-" + sdf.format(new Date());
+        }
+
         String num = "";
         File file;
         int i = 0;
@@ -196,7 +202,7 @@
         for (Object o : Debug.context()) {
             JavaMethod method = asJavaMethod(o);
             if (method != null) {
-                if (lastMethodOrGraph == null || asJavaMethod(lastMethodOrGraph) != method) {
+                if (lastMethodOrGraph == null || !asJavaMethod(lastMethodOrGraph).equals(method)) {
                     result.add(MetaUtil.format("%H::%n(%p)", method));
                 } else {
                     // This prevents multiple adjacent method context objects for the same method
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Wed Mar 12 13:30:08 2014 +0100
@@ -452,7 +452,7 @@
 
                 for (MethodCallTargetNode callTarget : graph.getNodes(MethodCallTargetNode.class)) {
                     ResolvedJavaMethod callee = callTarget.targetMethod();
-                    if (callee == recursiveEntry) {
+                    if (callee.equals(recursiveEntry)) {
                         if (isInlinableSnippet(substitutedMethod)) {
                             final StructuredGraph originalGraph = buildInitialGraph(substitutedMethod);
                             InliningUtil.inline(callTarget.invoke(), originalGraph, true);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Wed Mar 12 13:30:08 2014 +0100
@@ -340,7 +340,7 @@
                 return false;
             }
             CacheKey other = (CacheKey) obj;
-            if (method != other.method) {
+            if (!method.equals(other.method)) {
                 return false;
             }
             if (guardsStage != other.guardsStage || loweringStage != other.loweringStage) {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java	Wed Mar 12 13:30:08 2014 +0100
@@ -169,7 +169,7 @@
     protected void replaceSnippetInvokes(StructuredGraph snippetGraph) {
         for (MethodCallTargetNode call : snippetGraph.getNodes(MethodCallTargetNode.class)) {
             Invoke invoke = call.invoke();
-            if (call.targetMethod() != getTargetMethod()) {
+            if (!call.targetMethod().equals(getTargetMethod())) {
                 throw new GraalInternalError("unexpected invoke %s in snippet", getClass().getSimpleName());
             }
             assert invoke.stateAfter().bci == FrameState.AFTER_BCI;
--- a/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java	Wed Mar 12 13:30:08 2014 +0100
@@ -24,11 +24,9 @@
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.nodes.spi.*;
 
 /**
- * A runtime supporting a host backend as well, zero or more additional backends and an optional
- * {@linkplain GraphCache graph cache}.
+ * A runtime supporting a host backend as well, zero or more additional backends.
  */
 public interface RuntimeProvider {
 
@@ -43,9 +41,4 @@
      * @param arch a specific architecture class
      */
     <T extends Architecture> Backend getBackend(Class<T> arch);
-
-    /**
-     * Gets the graph cache (if any) maintained by this runtime.
-     */
-    GraphCache getGraphCache();
 }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Wed Mar 12 13:30:08 2014 +0100
@@ -203,8 +203,8 @@
         CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false);
         Backend backend = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend();
         CompilationResultBuilderFactory factory = getOptimizedCallTargetInstrumentationFactory(backend.getTarget().arch.getName(), javaMethod);
-        return compileGraph(graph, cc, javaMethod, providers, backend, providers.getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), null,
-                        suites, true, new CompilationResult(), factory);
+        return compileGraph(graph, null, cc, javaMethod, providers, backend, providers.getCodeCache().getTarget(), null, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), null,
+                        suites, new CompilationResult(), factory);
     }
 
     private static Providers getGraalProviders() {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Wed Mar 12 13:30:08 2014 +0100
@@ -43,6 +43,7 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.phases.*;
@@ -50,7 +51,6 @@
 import com.oracle.graal.phases.common.CanonicalizerPhase.CustomCanonicalizer;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
-import com.oracle.graal.runtime.*;
 import com.oracle.graal.truffle.nodes.asserts.*;
 import com.oracle.graal.truffle.nodes.frame.*;
 import com.oracle.graal.truffle.nodes.frame.NewFrameNode.VirtualOnlyInstanceNode;
@@ -70,16 +70,16 @@
     private final CanonicalizerPhase canonicalizer;
     private final GraphBuilderConfiguration config;
     private Set<Constant> constantReceivers;
-    private final GraphCache cache;
     private final TruffleCache truffleCache;
+    private final ResolvedJavaType frameType;
 
-    public PartialEvaluator(RuntimeProvider runtime, Providers providers, TruffleCache truffleCache, GraphBuilderConfiguration config) {
+    public PartialEvaluator(Providers providers, TruffleCache truffleCache, GraphBuilderConfiguration config) {
         this.providers = providers;
         CustomCanonicalizer customCanonicalizer = new PartialEvaluatorCanonicalizer(providers.getMetaAccess(), providers.getConstantReflection());
         this.canonicalizer = new CanonicalizerPhase(!ImmutableCode.getValue(), customCanonicalizer);
         this.config = config;
-        this.cache = runtime.getGraphCache();
         this.truffleCache = truffleCache;
+        this.frameType = providers.getMetaAccess().lookupJavaType(FrameWithoutBoxing.class);
         try {
             executeHelperMethod = providers.getMetaAccess().lookupJavaMethod(OptimizedCallTarget.class.getDeclaredMethod("executeHelper", PackedFrame.class, Arguments.class));
         } catch (NoSuchMethodException ex) {
@@ -139,7 +139,11 @@
             }
 
             canonicalizer.apply(graph, baseContext);
-            HighTierContext tierContext = new HighTierContext(providers, assumptions, cache, new PhaseSuite<HighTierContext>(), OptimisticOptimizations.NONE);
+            Map<ResolvedJavaMethod, StructuredGraph> graphCache = null;
+            if (CacheGraphs.getValue()) {
+                graphCache = new HashMap<>();
+            }
+            HighTierContext tierContext = new HighTierContext(providers, assumptions, graphCache, new PhaseSuite<HighTierContext>(), OptimisticOptimizations.NONE);
 
             for (NeverPartOfCompilationNode neverPartOfCompilationNode : graph.getNodes(NeverPartOfCompilationNode.class)) {
                 Throwable exception = new VerificationError(neverPartOfCompilationNode.getMessage());
@@ -183,7 +187,7 @@
             changed = false;
             for (MethodCallTargetNode methodCallTargetNode : graph.getNodes(MethodCallTargetNode.class)) {
                 InvokeKind kind = methodCallTargetNode.invokeKind();
-                if (kind == InvokeKind.Static || (kind == InvokeKind.Special && (methodCallTargetNode.receiver().isConstant() || methodCallTargetNode.receiver() instanceof NewFrameNode))) {
+                if (kind == InvokeKind.Static || (kind == InvokeKind.Special && (methodCallTargetNode.receiver().isConstant() || isFrame(methodCallTargetNode.receiver())))) {
                     if (TraceTruffleCompilationHistogram.getValue() && kind == InvokeKind.Special) {
                         ConstantNode constantNode = (ConstantNode) methodCallTargetNode.arguments().first();
                         constantReceivers.add(constantNode.asConstant());
@@ -237,6 +241,10 @@
         }
     }
 
+    private boolean isFrame(ValueNode receiver) {
+        return receiver instanceof NewFrameNode || Objects.equals(ObjectStamp.typeOrNull(receiver.stamp()), frameType);
+    }
+
     private StructuredGraph parseGraph(final ResolvedJavaMethod targetMethod, final NodeInputList<ValueNode> arguments, final Assumptions assumptions, final PhaseContext phaseContext) {
 
         StructuredGraph graph = truffleCache.lookup(targetMethod, arguments, assumptions, canonicalizer);
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Wed Mar 12 13:30:08 2014 +0100
@@ -247,6 +247,7 @@
     private boolean shouldInline(final MethodCallTargetNode methodCallTargetNode) {
         return (methodCallTargetNode.invokeKind() == InvokeKind.Special || methodCallTargetNode.invokeKind() == InvokeKind.Static) &&
                         !Modifier.isNative(methodCallTargetNode.targetMethod().getModifiers()) && methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) == null &&
-                        methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null && methodCallTargetNode.targetMethod().getDeclaringClass() != stringBuilderClass;
+                        methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null &&
+                        !methodCallTargetNode.targetMethod().getDeclaringClass().equals(stringBuilderClass);
     }
 }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java	Wed Mar 12 13:30:08 2014 +0100
@@ -102,7 +102,7 @@
 
         this.config = GraphBuilderConfiguration.getDefault();
         this.config.setSkippedExceptionTypes(skippedExceptionTypes);
-        this.partialEvaluator = new PartialEvaluator(runtime, providers, truffleCache, config);
+        this.partialEvaluator = new PartialEvaluator(providers, truffleCache, config);
 
         if (Debug.isEnabled()) {
             DebugEnvironment.initialize(System.out);
@@ -136,10 +136,6 @@
 
     private InstalledCode compileMethodImpl(final OptimizedCallTarget compilable) {
         final StructuredGraph graph;
-        GraphCache graphCache = runtime.getGraphCache();
-        if (graphCache != null) {
-            graphCache.removeStaleGraphs();
-        }
 
         if (TraceTruffleCompilation.getValue()) {
             OptimizedCallTarget.logOptimizingStart(compilable);
@@ -203,8 +199,8 @@
             CodeCacheProvider codeCache = providers.getCodeCache();
             CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false);
             CompilationResult compilationResult = new CompilationResult(name);
-            result = compileGraph(graph, cc, graph.method(), providers, backend, codeCache.getTarget(), null, createGraphBuilderSuite(), Optimizations, getProfilingInfo(graph), speculationLog,
-                            suites, false, compilationResult, CompilationResultBuilderFactory.Default);
+            result = compileGraph(graph, null, cc, graph.method(), providers, backend, codeCache.getTarget(), null, createGraphBuilderSuite(), Optimizations, getProfilingInfo(graph), speculationLog,
+                            suites, compilationResult, CompilationResultBuilderFactory.Default);
         } catch (Throwable e) {
             throw Debug.handle(e);
         }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java	Wed Mar 12 13:30:08 2014 +0100
@@ -59,7 +59,7 @@
 
         @Override
         public boolean equals(Object obj) {
-            return obj.getClass() == getClass();
+            return obj instanceof TruffleDebugJavaMethod;
         }
 
         @Override
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleExpansionLogger.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleExpansionLogger.java	Wed Mar 12 13:30:08 2014 +0100
@@ -168,10 +168,10 @@
                 if (e.getLineNumber() >= 0) {
                     return String.format("(%s:%d)", e.getFileName(), e.getLineNumber());
                 } else {
-                    return String.format("(%s)", e.getFileName(), e.getLineNumber());
+                    return String.format("(%s)", e.getFileName());
                 }
             } else {
-                return String.format("(Unknown Source)", e.getFileName(), e.getLineNumber());
+                return String.format("(Unknown Source)");
             }
         }
     }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java	Wed Mar 12 13:30:08 2014 +0100
@@ -50,8 +50,11 @@
 
         @Override
         public boolean equals(Object obj) {
+            if (!(obj instanceof ReadCacheEntry)) {
+                return false;
+            }
             ReadCacheEntry other = (ReadCacheEntry) obj;
-            return identity == other.identity && object == other.object;
+            return identity.equals(other.identity) && object == other.object;
         }
 
         @Override
@@ -133,7 +136,7 @@
         Iterator<Map.Entry<ReadCacheEntry, ValueNode>> iter = readCache.entrySet().iterator();
         while (iter.hasNext()) {
             Map.Entry<ReadCacheEntry, ValueNode> entry = iter.next();
-            if (entry.getKey().identity == identity) {
+            if (entry.getKey().identity.equals(identity)) {
                 iter.remove();
             }
         }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java	Wed Mar 12 13:30:08 2014 +0100
@@ -579,7 +579,7 @@
                     for (int i = 0; i < objStates.length; i++) {
                         ObjectState obj = objStates[i];
                         boolean hasIdentity = obj.virtual.hasIdentity() && mergedVirtualObjects.contains(obj.virtual);
-                        if (hasIdentity || firstObj.virtual.type() != obj.virtual.type() || firstObj.virtual.entryCount() != obj.virtual.entryCount() || !firstObj.locksEqual(obj)) {
+                        if (hasIdentity || !firstObj.virtual.type().equals(obj.virtual.type()) || firstObj.virtual.entryCount() != obj.virtual.entryCount() || !firstObj.locksEqual(obj)) {
                             compatible = false;
                             break;
                         }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java	Tue Mar 11 18:45:59 2014 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java	Wed Mar 12 13:30:08 2014 +0100
@@ -52,6 +52,9 @@
 
         @Override
         public boolean equals(Object obj) {
+            if (!(obj instanceof CacheEntry<?>)) {
+                return false;
+            }
             CacheEntry<?> other = (CacheEntry<?>) obj;
             return identity == other.identity && object == other.object;
         }
--- a/make/bsd/makefiles/gcc.make	Tue Mar 11 18:45:59 2014 -0700
+++ b/make/bsd/makefiles/gcc.make	Wed Mar 12 13:30:08 2014 +0100
@@ -335,7 +335,7 @@
 # We want to use libc++ on Clang 5.0
 ifeq ($(USE_CLANG), true)
   # Clang 5.0
-  ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 0), 1)
+  ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& \( $(CC_VER_MINOR) = 0 \| $(CC_VER_MINOR) = 1 \) ), 1)
     CFLAGS += -stdlib=libc++
   endif
 endif
@@ -377,6 +377,11 @@
 #------------------------------------------------------------------------
 # Linker flags
 
+# Ensure use libstdc++ on clang, not libc++
+ifeq ($(USE_CLANG), true)
+  LFLAGS += -stdlib=libstdc++
+endif
+
 # statically link libstdc++.so, work with gcc but ignored by g++
 STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
 
--- a/make/windows/makefiles/vm.make	Tue Mar 11 18:45:59 2014 -0700
+++ b/make/windows/makefiles/vm.make	Wed Mar 12 13:30:08 2014 +0100
@@ -49,7 +49,7 @@
 !endif
 
 !if "$(Variant)" == "graal"
-CPP_FLAGS=$(CPP_FLAGS) /D "GRAAL"
+CXX_FLAGS=$(CXX_FLAGS) /D "GRAAL" /D "COMPILERGRAAL" /D "COMPILER1"
 !endif
 
 !if "$(BUILDARCH)" == "i486"
--- a/mx/mx_graal.py	Tue Mar 11 18:45:59 2014 -0700
+++ b/mx/mx_graal.py	Wed Mar 12 13:30:08 2014 +0100
@@ -718,6 +718,9 @@
     if vm is None:
         vm = _get_vm()
 
+    if 'client' in vm and len(platform.mac_ver()[0]) != 0:
+        mx.abort("Client VM not supported: java launcher on Mac OS X translates '-client' to '-server'")
+
     if cwd is None:
         cwd = _vm_cwd
     elif _vm_cwd is not None and _vm_cwd != cwd:
--- a/mx/projects	Tue Mar 11 18:45:59 2014 -0700
+++ b/mx/projects	Wed Mar 12 13:30:08 2014 +0100
@@ -13,6 +13,9 @@
 library@CHECKSTYLE@path=lib/checkstyle-5.5-all.jar
 library@CHECKSTYLE@urls=jar:http://sourceforge.net/projects/checkstyle/files/checkstyle/5.5/checkstyle-5.5-bin.zip/download!/checkstyle-5.5/checkstyle-5.5-all.jar
 
+library@FINDBUGS@path=lib/findbugs-3.0.0-dev-20131204-e3cbbd5.jar
+library@FINDBUGS@urls=jar:http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0-dev-20131204-e3cbbd5.zip/download!/findbugs-3.0.0-dev-20131204-e3cbbd5/lib/findbugs.jar
+
 library@DACAPO@path=lib/dacapo-9.12-bach.jar
 library@DACAPO@urls=http://softlayer.dl.sourceforge.net/project/dacapobench/9.12-bach/dacapo-9.12-bach.jar
 
--- a/mxtool/mx.py	Tue Mar 11 18:45:59 2014 -0700
+++ b/mxtool/mx.py	Wed Mar 12 13:30:08 2014 +0100
@@ -349,29 +349,34 @@
 
     def _sha1Cached():
         with open(sha1path, 'r') as f:
-            return f.readline()[0:40]
-
-    def _writesha1Cached():
+            return f.read()[0:40]
+
+    def _writeSha1Cached():
         with open(sha1path, 'w') as f:
             f.write(_sha1OfFile())
 
     def _sha1OfFile():
-        with open(path, 'r') as f:
-            return hashlib.sha1(f.read()).hexdigest()
-
+        with open(path, 'rb') as f:
+            d = hashlib.sha1()
+            while True:
+                buf = f.read(4096)
+                if not buf:
+                    break
+                d.update(buf)
+            return d.hexdigest()
 
     if resolve and mustExist and not exists(path):
         assert not len(urls) == 0, 'cannot find required library ' + name + ' ' + path
         _download_lib()
 
     if sha1 and not exists(sha1path):
-        _writesha1Cached()
+        _writeSha1Cached()
 
     if sha1 and sha1 != _sha1Cached():
         _download_lib()
         if sha1 != _sha1OfFile():
             abort("SHA1 does not match for " + name + ". Broken download? SHA1 not updated in projects file?")
-        _writesha1Cached()
+        _writeSha1Cached()
 
     return path
 
@@ -427,7 +432,7 @@
             path = join(self.suite.dir, path)
         sha1path = path + '.sha1'
 
-        return _download_file_with_sha1(self.name, path, self.sourceUrls, self.sha1, sha1path, resolve, len(self.sourceUrls) != 0, sources=True)
+        return _download_file_with_sha1(self.name, path, self.sourceUrls, self.sourceSha1, sha1path, resolve, len(self.sourceUrls) != 0, sources=True)
 
     def append_to_classpath(self, cp, resolve):
         path = self.get_path(resolve)
@@ -1093,7 +1098,7 @@
 def run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, addDefaultArgs=True):
     return run(java().format_cmd(args, addDefaultArgs), nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd)
 
-def _kill_process_group(pid, sig=signal.SIGKILL):
+def _kill_process_group(pid, sig):
     pgid = os.getpgid(pid)
     try:
         os.killpg(pgid, sig)
@@ -1469,7 +1474,7 @@
 
     def _isJava():
         if args:
-            name = args[0].split("/")[-1]
+            name = args[0].split(os.sep)[-1]
             return name == "java"
         return False
 
@@ -1498,7 +1503,7 @@
         if get_os() == 'windows':
             p.kill()
         else:
-            _kill_process_group(p.pid)
+            _kill_process_group(p.pid, signal.SIGKILL)
 
     raise SystemExit(codeOrMessage)
 
@@ -4088,7 +4093,8 @@
 
     def quit_handler(signum, frame):
         _send_sigquit()
-    signal.signal(signal.SIGQUIT, quit_handler)
+    if get_os() != 'windows':
+        signal.signal(signal.SIGQUIT, quit_handler)
 
     try:
         if opts.timeout != 0:
--- a/src/share/vm/code/nmethod.cpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/code/nmethod.cpp	Wed Mar 12 13:30:08 2014 +0100
@@ -601,8 +601,7 @@
   ExceptionHandlerTable* handler_table,
   ImplicitExceptionTable* nul_chk_table,
   AbstractCompiler* compiler,
-  int comp_level,
-  GrowableArray<jlong>* leaf_graph_ids
+  int comp_level
 #ifdef GRAAL
   , Handle installed_code,
   Handle speculationLog
@@ -611,7 +610,6 @@
 {
   assert(debug_info->oop_recorder() == code_buffer->oop_recorder(), "shared OR");
   code_buffer->finalize_oop_references(method);
-  int leaf_graph_ids_size = leaf_graph_ids == NULL ? 0 : round_to(sizeof(jlong) * leaf_graph_ids->length(), oopSize);
   // create nmethod
   nmethod* nm = NULL;
   { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
@@ -621,8 +619,7 @@
       + round_to(dependencies->size_in_bytes() , oopSize)
       + round_to(handler_table->size_in_bytes(), oopSize)
       + round_to(nul_chk_table->size_in_bytes(), oopSize)
-      + round_to(debug_info->data_size()       , oopSize)
-      + leaf_graph_ids_size;
+      + round_to(debug_info->data_size()       , oopSize);
     nm = new (nmethod_size)
     nmethod(method(), nmethod_size, compile_id, entry_bci, offsets,
             orig_pc_offset, debug_info, dependencies, code_buffer, frame_size,
@@ -630,8 +627,7 @@
             handler_table,
             nul_chk_table,
             compiler,
-            comp_level,
-            leaf_graph_ids
+            comp_level
 #ifdef GRAAL
             , installed_code,
             speculationLog
@@ -711,8 +707,7 @@
     _dependencies_offset     = _scopes_pcs_offset;
     _handler_table_offset    = _dependencies_offset;
     _nul_chk_table_offset    = _handler_table_offset;
-    _leaf_graph_ids_offset   = _nul_chk_table_offset;
-    _nmethod_end_offset      = _leaf_graph_ids_offset;
+    _nmethod_end_offset      = _nul_chk_table_offset;
     _compile_id              = compile_id;
     _comp_level              = CompLevel_none;
     _entry_point             = code_begin()          + offsets->value(CodeOffsets::Entry);
@@ -859,8 +854,7 @@
   ExceptionHandlerTable* handler_table,
   ImplicitExceptionTable* nul_chk_table,
   AbstractCompiler* compiler,
-  int comp_level,
-  GrowableArray<jlong>* leaf_graph_ids
+  int comp_level
 #ifdef GRAAL
   , Handle installed_code,
   Handle speculation_log
@@ -929,8 +923,6 @@
       _unwind_handler_offset = -1;
     }
 
-    int leaf_graph_ids_size = leaf_graph_ids == NULL ? 0 : round_to(sizeof(jlong) * leaf_graph_ids->length(), oopSize);
-
     _oops_offset             = data_offset();
     _metadata_offset         = _oops_offset          + round_to(code_buffer->total_oop_size(), oopSize);
     _scopes_data_offset      = _metadata_offset      + round_to(code_buffer->total_metadata_size(), wordSize);
@@ -939,8 +931,7 @@
     _dependencies_offset     = _scopes_pcs_offset    + adjust_pcs_size(debug_info->pcs_size());
     _handler_table_offset    = _dependencies_offset  + round_to(dependencies->size_in_bytes (), oopSize);
     _nul_chk_table_offset    = _handler_table_offset + round_to(handler_table->size_in_bytes(), oopSize);
-    _leaf_graph_ids_offset   = _nul_chk_table_offset + round_to(nul_chk_table->size_in_bytes(), oopSize);
-    _nmethod_end_offset      = _leaf_graph_ids_offset + leaf_graph_ids_size;
+    _nmethod_end_offset      = _nul_chk_table_offset + round_to(nul_chk_table->size_in_bytes(), oopSize);
 
     _entry_point             = code_begin()          + offsets->value(CodeOffsets::Entry);
     _verified_entry_point    = code_begin()          + offsets->value(CodeOffsets::Verified_Entry);
@@ -964,10 +955,6 @@
     handler_table->copy_to(this);
     nul_chk_table->copy_to(this);
 
-    if (leaf_graph_ids != NULL && leaf_graph_ids_size > 0) {
-      memcpy(leaf_graph_ids_begin(), leaf_graph_ids->adr_at(0), leaf_graph_ids_size);
-    }
-
     // we use the information of entry points to find out if a method is
     // static or non static
     assert(compiler->is_c2() || compiler->is_graal() ||
--- a/src/share/vm/code/nmethod.hpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/code/nmethod.hpp	Wed Mar 12 13:30:08 2014 +0100
@@ -159,7 +159,6 @@
   int _dependencies_offset;
   int _handler_table_offset;
   int _nul_chk_table_offset;
-  int _leaf_graph_ids_offset;
   int _nmethod_end_offset;
 
   // location in frame (offset for sp) that deopt can store the original
@@ -276,8 +275,7 @@
           ExceptionHandlerTable* handler_table,
           ImplicitExceptionTable* nul_chk_table,
           AbstractCompiler* compiler,
-          int comp_level,
-          GrowableArray<jlong>* leaf_graph_ids
+          int comp_level
 #ifdef GRAAL
           , Handle installed_code,
           Handle speculation_log
@@ -318,8 +316,7 @@
                               ExceptionHandlerTable* handler_table,
                               ImplicitExceptionTable* nul_chk_table,
                               AbstractCompiler* compiler,
-                              int comp_level,
-                              GrowableArray<jlong>* leaf_graph_ids = NULL
+                              int comp_level
 #ifdef GRAAL
                               , Handle installed_code = Handle(),
                               Handle speculation_log = Handle()
@@ -393,9 +390,7 @@
   address handler_table_begin   () const          { return           header_begin() + _handler_table_offset ; }
   address handler_table_end     () const          { return           header_begin() + _nul_chk_table_offset ; }
   address nul_chk_table_begin   () const          { return           header_begin() + _nul_chk_table_offset ; }
-  address nul_chk_table_end     () const          { return           header_begin() + _leaf_graph_ids_offset; }
-  jlong*  leaf_graph_ids_begin  () const          { return  (jlong*)(header_begin() + _leaf_graph_ids_offset); }
-  jlong*  leaf_graph_ids_end    () const          { return  (jlong*)(header_begin() + _nmethod_end_offset)  ; }
+  address nul_chk_table_end     () const          { return           header_begin() + _nmethod_end_offset;    }
 
   // Sizes
   int consts_size       () const                  { return            consts_end       () -            consts_begin       (); }
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Wed Mar 12 13:30:08 2014 +0100
@@ -364,24 +364,6 @@
   }
 }
 
-GrowableArray<jlong>* get_leaf_graph_ids(Handle& compiled_code) {
-  arrayOop leafGraphArray = (arrayOop) CompilationResult::leafGraphIds(HotSpotCompiledCode::comp(compiled_code));
-
-  jint length;
-  if (leafGraphArray == NULL) {
-    length = 0;
-  } else {
-    length = leafGraphArray->length();
-  }
-
-  GrowableArray<jlong>* result = new GrowableArray<jlong>(length);
-  for (int i = 0; i < length; i++) {
-    result->append(((jlong*) leafGraphArray->base(T_LONG))[i]);
-  }
-
-  return result;
-}
-
 // constructor used to create a method
 GraalEnv::CodeInstallResult CodeInstaller::install(Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log) {
   BufferBlob* buffer_blob = GraalCompiler::initialize_buffer_blob();
@@ -407,7 +389,6 @@
   }
 
   int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
-  GrowableArray<jlong>* leaf_graph_ids = get_leaf_graph_ids(compiled_code);
 
   GraalEnv::CodeInstallResult result;
   if (compiled_code->is_a(HotSpotCompiledRuntimeStub::klass())) {
@@ -430,7 +411,7 @@
       id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
     }
     result = GraalEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
-        GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, id, false, leaf_graph_ids, installed_code, speculation_log);
+        GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, id, false, installed_code, speculation_log);
     cb = nm;
   }
 
--- a/src/share/vm/graal/graalCompiler.cpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Mar 12 13:30:08 2014 +0100
@@ -53,8 +53,6 @@
   AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)"));
   NOT_LP64(error("check TLAB allocation code for address space conflicts"));
 
-  _deopted_leaf_graph_count = 0;
-
   BufferBlob* buffer_blob = initialize_buffer_blob();
   if (buffer_blob == NULL) {
     // If we are called from JNI_CreateJavaVM we cannot use set_state yet because it takes a lock.
@@ -128,47 +126,6 @@
   }
 }
 
-void GraalCompiler::deopt_leaf_graph(jlong leaf_graph_id) {
-  assert(leaf_graph_id != -1, "unexpected leaf graph id");
-
-  if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) {
-    MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag);
-    if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) {
-      _deopted_leaf_graphs[_deopted_leaf_graph_count++] = leaf_graph_id;
-    }
-  }
-}
-
-oop GraalCompiler::dump_deopted_leaf_graphs(TRAPS) {
-  if (_deopted_leaf_graph_count == 0) {
-    return NULL;
-  }
-  jlong* elements;
-  int length;
-  {
-    MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag);
-    if (_deopted_leaf_graph_count == 0) {
-      return NULL;
-    }
-    if (_deopted_leaf_graph_count == LEAF_GRAPH_ARRAY_SIZE) {
-      length = 0;
-    } else {
-      length = _deopted_leaf_graph_count;
-    }
-    elements = NEW_C_HEAP_ARRAY(jlong, length, mtCompiler);
-    for (int i = 0; i < length; i++) {
-      elements[i] = _deopted_leaf_graphs[i];
-    }
-    _deopted_leaf_graph_count = 0;
-  }
-  typeArrayOop array = oopFactory::new_longArray(length, CHECK_NULL);
-  for (int i = 0; i < length; i++) {
-    array->long_at_put(i, elements[i]);
-  }
-  FREE_C_HEAP_ARRAY(jlong, elements, mtCompiler);
-  return array;
-}
-
 BufferBlob* GraalCompiler::initialize_buffer_blob() {
   JavaThread* THREAD = JavaThread::current();
   BufferBlob* buffer_blob = THREAD->get_buffer_blob();
--- a/src/share/vm/graal/graalCompiler.hpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/graal/graalCompiler.hpp	Wed Mar 12 13:30:08 2014 +0100
@@ -36,9 +36,6 @@
 
   static GraalCompiler* _instance;
 
-  jlong                 _deopted_leaf_graphs[LEAF_GRAPH_ARRAY_SIZE];
-  int                   _deopted_leaf_graph_count;
-
 public:
 
   GraalCompiler();
@@ -65,9 +62,6 @@
 
   void compile_method(methodHandle target, int entry_bci, jboolean blocking);
 
-  void deopt_leaf_graph(jlong leaf_graph_id);
-  oop dump_deopted_leaf_graphs(TRAPS);
-
   // Print compilation timers and statistics
   virtual void print_timers();
 
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Wed Mar 12 13:30:08 2014 +0100
@@ -679,17 +679,6 @@
   }
 C2V_END
 
-C2V_VMENTRY(jobject, getDeoptedLeafGraphIds, (JNIEnv *, jobject))
-
-  // the contract for this method is as follows:
-  // returning null: no deopted leaf graphs
-  // returning array (size > 0): the ids of the deopted leaf graphs
-  // returning array (size == 0): there was an overflow, the compiler needs to clear its cache completely
-
-  oop array = GraalCompiler::instance()->dump_deopted_leaf_graphs(CHECK_NULL);
-  return JNIHandles::make_local(array);
-C2V_END
-
 C2V_ENTRY(jlongArray, getLineNumberTable, (JNIEnv *env, jobject, jlong metaspace_method))
   Method* method = (Method*) metaspace_method;
   if (!method->has_linenumber_table()) {
@@ -869,7 +858,6 @@
   {CC"resetCompilationStatistics",      CC"()V",                                                          FN_PTR(resetCompilationStatistics)},
   {CC"disassembleCodeBlob",             CC"(J)"STRING,                                                    FN_PTR(disassembleCodeBlob)},
   {CC"executeCompiledMethodVarargs",    CC"(["OBJECT HS_INSTALLED_CODE")"OBJECT,                          FN_PTR(executeCompiledMethodVarargs)},
-  {CC"getDeoptedLeafGraphIds",          CC"()[J",                                                         FN_PTR(getDeoptedLeafGraphIds)},
   {CC"getLineNumberTable",              CC"("METASPACE_METHOD")[J",                                       FN_PTR(getLineNumberTable)},
   {CC"getLocalVariableTableStart",      CC"("METASPACE_METHOD")J",                                        FN_PTR(getLocalVariableTableStart)},
   {CC"getLocalVariableTableLength",     CC"("METASPACE_METHOD")I",                                        FN_PTR(getLocalVariableTableLength)},
--- a/src/share/vm/graal/graalEnv.cpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/graal/graalEnv.cpp	Wed Mar 12 13:30:08 2014 +0100
@@ -450,7 +450,6 @@
                                 CompileTask* task,
                                 int compile_id,
                                 bool has_unsafe_access,
-                                GrowableArray<jlong>* leaf_graph_ids,
                                 Handle installed_code,
                                 Handle speculation_log) {
   GRAAL_EXCEPTION_CONTEXT;
@@ -497,7 +496,7 @@
                                debug_info, dependencies, code_buffer,
                                frame_words, oop_map_set,
                                handler_table, &implicit_tbl,
-                               compiler, comp_level, leaf_graph_ids, installed_code, speculation_log);
+                               compiler, comp_level, installed_code, speculation_log);
 
     // Free codeBlobs
     //code_buffer->free_blob();
--- a/src/share/vm/graal/graalEnv.hpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/graal/graalEnv.hpp	Wed Mar 12 13:30:08 2014 +0100
@@ -144,7 +144,6 @@
                        CompileTask*              task,
                        int                       compile_id,
                        bool                      has_unsafe_access,
-                       GrowableArray<jlong>*     leaf_graph_ids,
                        Handle                    installed_code,
                        Handle                    speculation_log);
 
--- a/src/share/vm/graal/graalJavaAccess.hpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Wed Mar 12 13:30:08 2014 +0100
@@ -111,7 +111,6 @@
   start_class(CompilationResult)                                                                                                                               \
     int_field(CompilationResult, frameSize)                                                                                                                    \
     int_field(CompilationResult, customStackAreaOffset)                                                                                                        \
-    oop_field(CompilationResult, leafGraphIds, "[J")                                                                                                           \
     oop_field(CompilationResult, targetCode, "[B")                                                                                                             \
     oop_field(CompilationResult, assumptions, "Lcom/oracle/graal/api/code/Assumptions;")                                                                       \
     int_field(CompilationResult, targetCodeSize)                                                                                                               \
--- a/src/share/vm/opto/node.cpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/opto/node.cpp	Wed Mar 12 13:30:08 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, 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
@@ -476,7 +476,6 @@
 #pragma clang diagnostic pop
 #endif
 
-
 //------------------------------clone------------------------------------------
 // Clone a Node.
 Node *Node::clone() const {
--- a/src/share/vm/runtime/deoptimization.cpp	Tue Mar 11 18:45:59 2014 -0700
+++ b/src/share/vm/runtime/deoptimization.cpp	Wed Mar 12 13:30:08 2014 +0100
@@ -212,21 +212,6 @@
   // Java frame.  This storage is allocated with the usual system arena.
   assert(deoptee.is_compiled_frame(), "Wrong frame type");
 
-#ifdef GRAAL
-  nmethod* nm = (nmethod*) deoptee.cb();
-  GraalCompiler* compiler = (GraalCompiler*) nm->compiler();
-  for (jlong* p = nm->leaf_graph_ids_begin(); p != nm->leaf_graph_ids_end(); p++) {
-    compiler->deopt_leaf_graph(*p);
-  }
-  if (PrintDeoptimizationDetails) {
-    tty->print("leaf graph ids: ");
-    for (jlong* p = nm->leaf_graph_ids_begin(); p != nm->leaf_graph_ids_end(); p++) {
-      tty->print("%d ", *p);
-    }
-    tty->cr();
-  }
-#endif
-
   GrowableArray<compiledVFrame*>* chunk = new GrowableArray<compiledVFrame*>(10);
   vframe* vf = vframe::new_vframe(&deoptee, &map, thread);
   while (!vf->is_top()) {