changeset 7713:fec77d5cd187

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 05 Feb 2013 15:27:40 +0100
parents 0a346c23cbd5 (current diff) 09dd65d5e474 (diff)
children c1f63bbdf7b1 d71feabc9995 be7b98533b17
files graal/com.oracle.graal.api.interpreter/overview.html graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/RuntimeInterpreterInterface.java graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/VirtualMachineComponent.java graal/com.oracle.graal.interpreter/overview.html graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/Frame.java graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterCallable.java graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterException.java graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GlobalValueNumberingPhase.java
diffstat 82 files changed, 1407 insertions(+), 3745 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Tue Feb 05 15:27:40 2013 +0100
@@ -26,6 +26,8 @@
 import static com.oracle.graal.api.code.Register.RegisterFlag.*;
 import static com.oracle.graal.api.meta.Kind.*;
 
+import java.nio.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.code.Register.*;
 
@@ -109,7 +111,7 @@
     public AMD64() {
         super("AMD64",
               8,
-              ByteOrder.LittleEndian,
+              ByteOrder.LITTLE_ENDIAN,
               allRegisters,
               LOAD_STORE | STORE_STORE,
               1,
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java	Tue Feb 05 15:27:40 2013 +0100
@@ -22,9 +22,10 @@
  */
 package com.oracle.graal.api.code;
 
+import java.nio.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.Register.*;
+import com.oracle.graal.api.code.Register.RegisterFlag;
 
 /**
  * Represents a CPU architecture, including information such as its endianness, CPU registers, word
@@ -33,13 +34,6 @@
 public abstract class Architecture {
 
     /**
-     * The endianness of the architecture.
-     */
-    public static enum ByteOrder {
-        LittleEndian, BigEndian
-    }
-
-    /**
      * The number of bits required in a bit map covering all the registers that may store
      * references. The bit position of a register in the map is the register's
      * {@linkplain Register#number number}.
--- a/graal/com.oracle.graal.api.interpreter/overview.html	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-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.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-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.
--->
-
-</head>
-<body>
-
-Documentation for the <code>com.oracle.graal.api.interpreter</code> project.
-
-</body>
-</html>
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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.api.interpreter;
-
-import com.oracle.graal.api.meta.*;
-
-public interface Interpreter extends VirtualMachineComponent {
-
-    boolean initialize(String args);
-
-    Object execute(ResolvedJavaMethod method, Object... arguments) throws Throwable;
-}
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/RuntimeInterpreterInterface.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +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.api.interpreter;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Please note: The parameters of the interface are currently in reversed order since it was derived
- * from the java ByteCodeInterpreter implementation. There it was simpler to use the parameters in
- * reversed order since they are popped from the stack in reversed order.
- */
-public interface RuntimeInterpreterInterface {
-
-    Object invoke(ResolvedJavaMethod method, Object... args);
-
-    void monitorEnter(Object value);
-
-    void monitorExit(Object value);
-
-    Object newObject(ResolvedJavaType type) throws InstantiationException;
-
-    Object getFieldObject(Object base, ResolvedJavaField field);
-
-    boolean getFieldBoolean(Object base, ResolvedJavaField field);
-
-    byte getFieldByte(Object base, ResolvedJavaField field);
-
-    char getFieldChar(Object base, ResolvedJavaField field);
-
-    short getFieldShort(Object base, ResolvedJavaField field);
-
-    int getFieldInt(Object base, ResolvedJavaField field);
-
-    long getFieldLong(Object base, ResolvedJavaField field);
-
-    double getFieldDouble(Object base, ResolvedJavaField field);
-
-    float getFieldFloat(Object base, ResolvedJavaField field);
-
-    void setFieldObject(Object value, Object base, ResolvedJavaField field);
-
-    void setFieldInt(int value, Object base, ResolvedJavaField field);
-
-    void setFieldFloat(float value, Object base, ResolvedJavaField field);
-
-    void setFieldDouble(double value, Object base, ResolvedJavaField field);
-
-    void setFieldLong(long value, Object base, ResolvedJavaField field);
-
-    byte getArrayByte(long index, Object array);
-
-    char getArrayChar(long index, Object array);
-
-    short getArrayShort(long index, Object array);
-
-    int getArrayInt(long index, Object array);
-
-    long getArrayLong(long index, Object array);
-
-    double getArrayDouble(long index, Object array);
-
-    float getArrayFloat(long index, Object array);
-
-    Object getArrayObject(long index, Object array);
-
-    void setArrayByte(byte value, long index, Object array);
-
-    void setArrayChar(char value, long index, Object array);
-
-    void setArrayShort(short value, long index, Object array);
-
-    void setArrayInt(int value, long index, Object array);
-
-    void setArrayLong(long value, long index, Object array);
-
-    void setArrayFloat(float value, long index, Object array);
-
-    void setArrayDouble(double value, long index, Object array);
-
-    void setArrayObject(Object value, long index, Object array);
-
-    Class<?> getMirror(ResolvedJavaType type);
-}
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/VirtualMachineComponent.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2012, 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.api.interpreter;
-
-public interface VirtualMachineComponent {
-
-    void setOption(String name, String value);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Tue Feb 05 15:27:40 2013 +0100
@@ -39,5 +39,5 @@
     Unresolved,
     JavaSubroutineMismatch,
     ArithmeticException,
-    RuntimeConstraint,
+    RuntimeConstraint
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Tue Feb 05 15:27:40 2013 +0100
@@ -84,4 +84,13 @@
      * @throws IllegalArgumentException if {@code array} is not an array
      */
     int lookupArrayLength(Constant array);
+
+    /**
+     * Reads a value of this kind using a base address and a displacement.
+     *
+     * @param base the base address from which the value is read
+     * @param displacement the displacement within the object in bytes
+     * @return the read value encapsulated in a {@link Constant} object, or {@code null} if the value cannot be read.
+     */
+    Constant readUnsafeConstant(Kind kind, Object base, long displacement);
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Tue Feb 05 15:27:40 2013 +0100
@@ -70,7 +70,7 @@
         ResolvedJavaType elementalType = getElementalType(type);
         Class elementalClass;
         if (elementalType.isPrimitive()) {
-            elementalClass = type.getKind().toJavaClass();
+            elementalClass = elementalType.getKind().toJavaClass();
         } else {
             try {
                 elementalClass = Class.forName(toJavaName(elementalType), true, loader);
@@ -177,7 +177,7 @@
     public static String toJavaName(JavaType type, boolean qualified) {
         Kind kind = type.getKind();
         if (kind == Kind.Object) {
-            return internalNameToJava(type.getName(), qualified);
+            return internalNameToJava(type.getName(), qualified, false);
         }
         return type.getKind().getJavaName();
     }
@@ -196,10 +196,10 @@
      * @return the Java name corresponding to {@code type}
      */
     public static String toJavaName(JavaType type) {
-        return (type == null) ? null : internalNameToJava(type.getName(), true);
+        return (type == null) ? null : internalNameToJava(type.getName(), true, false);
     }
 
-    private static String internalNameToJava(String name, boolean qualified) {
+    private static String internalNameToJava(String name, boolean qualified, boolean classForNameCompatible) {
         switch (name.charAt(0)) {
             case 'L': {
                 String result = name.substring(1, name.length() - 1).replace('/', '.');
@@ -210,10 +210,9 @@
                     }
                 }
                 return result;
-
             }
             case '[':
-                return internalNameToJava(name.substring(1), qualified) + "[]";
+                return classForNameCompatible ? name.replace('/', '.') : internalNameToJava(name.substring(1), qualified, classForNameCompatible) + "[]";
             default:
                 if (name.length() != 1) {
                     throw new IllegalArgumentException("Illegal internal name: " + name);
@@ -223,6 +222,19 @@
     }
 
     /**
+     * Turns an class name in internal format into a resolved Java type.
+     */
+    public static ResolvedJavaType classForName(String internal, MetaAccessProvider metaAccess, ClassLoader cl) {
+        Kind k = Kind.fromTypeString(internal);
+        try {
+            String n = internalNameToJava(internal, true, true);
+            return metaAccess.lookupJavaType(k.isPrimitive() ? k.toJavaClass() : Class.forName(n, true, cl));
+        } catch (ClassNotFoundException cnfe) {
+            throw new IllegalArgumentException("could not instantiate class described by " + internal, cnfe);
+        }
+    }
+
+    /**
      * Gets a string for a given method formatted according to a given format specification. A
      * format specification is composed of characters that are to be copied verbatim to the result
      * and specifiers that denote an attribute of the method that is to be copied to the result. A
@@ -503,6 +515,29 @@
     }
 
     /**
+     * Gets the <a
+     * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
+     * descriptor</a> corresponding to this signature. For example:
+     * 
+     * <pre>
+     * (ILjava/lang/String;D)V
+     * </pre>
+     * 
+     * .
+     * 
+     * @param sig the {@link Signature} to be converted.
+     * @return the signature as a string
+     */
+    public static String signatureToMethodDescriptor(Signature sig) {
+        StringBuilder sb = new StringBuilder("(");
+        for (int i = 0; i < sig.getParameterCount(false); ++i) {
+            sb.append(sig.getParameterType(i, null).getName());
+        }
+        sb.append(')').append(sig.getReturnType(null).getName());
+        return sb.toString();
+    }
+
+    /**
      * Formats some profiling information associated as a string.
      * 
      * @param info the profiling info to format
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Tue Feb 05 15:27:40 2013 +0100
@@ -26,7 +26,7 @@
 import java.lang.reflect.*;
 
 /**
- * Represents a resolved Java types. Types include primitives, objects, {@code void}, and arrays
+ * Represents a resolved Java type. Types include primitives, objects, {@code void}, and arrays
  * thereof. Types, like fields and methods, are resolved through {@link ConstantPool constant pools}
  * .
  */
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java	Tue Feb 05 15:27:40 2013 +0100
@@ -86,19 +86,4 @@
      * @return the size of the parameters in slots
      */
     int getParameterSlots(boolean withReceiver);
-
-    /**
-     * Gets the <a
-     * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
-     * descriptor</a> corresponding to this signature. For example:
-     * 
-     * <pre>
-     * (ILjava/lang/String;D)V
-     * </pre>
-     * 
-     * .
-     * 
-     * @return the signature as a string
-     */
-    String getMethodDescriptor();
 }
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java	Tue Feb 05 15:27:40 2013 +0100
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.asm;
 
+import java.nio.*;
+
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Architecture.*;
 
 /**
  * The platform-independent base class for the assembler.
@@ -36,7 +37,7 @@
     public AbstractAssembler(TargetDescription target) {
         this.target = target;
 
-        if (target.arch.getByteOrder() == ByteOrder.BigEndian) {
+        if (target.arch.getByteOrder() == ByteOrder.BIG_ENDIAN) {
             this.codeBuffer = new Buffer.BigEndian();
         } else {
             this.codeBuffer = new Buffer.LittleEndian();
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java	Tue Feb 05 15:27:40 2013 +0100
@@ -168,7 +168,7 @@
         // TypeSystemTest.outputGraph(graph);
         Assumptions assumptions = new Assumptions(false);
         new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
-        new ConditionalEliminationPhase().apply(graph);
+        new ConditionalEliminationPhase(runtime()).apply(graph);
         new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
         StructuredGraph referenceGraph = parse(referenceSnippet);
         assertEquals(referenceGraph, graph);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java	Tue Feb 05 15:27:40 2013 +0100
@@ -127,10 +127,7 @@
             }
         } else {
             if (a == constantObject2 || a == constantObject3) {
-                if (a != null) {
-                    return 11;
-                }
-                return 2;
+                return 11;
             }
         }
         if (a == constantObject1) {
@@ -185,34 +182,25 @@
         return ((InputStream) o).available();
     }
 
-    @SuppressWarnings("unused")
     private void test(String snippet, String referenceSnippet) {
-        // TODO(ls) temporarily disabled, reintroduce when a proper type system is available
-        if (false) {
-            StructuredGraph graph = parse(snippet);
-            Debug.dump(graph, "Graph");
-            Assumptions assumptions = new Assumptions(false);
-            new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
-            new ConditionalEliminationPhase().apply(graph);
-            new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
-            new GlobalValueNumberingPhase().apply(graph);
-            StructuredGraph referenceGraph = parse(referenceSnippet);
-            new CanonicalizerPhase(null, runtime(), assumptions).apply(referenceGraph);
-            new GlobalValueNumberingPhase().apply(referenceGraph);
-            assertEquals(referenceGraph, graph);
-        }
+        StructuredGraph graph = parse(snippet);
+        Debug.dump(graph, "Graph");
+        Assumptions assumptions = new Assumptions(false);
+        new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
+        new ConditionalEliminationPhase(runtime()).apply(graph);
+        new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
+        // a second canonicalizer is needed to process nested MaterializeNodes
+        new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
+        StructuredGraph referenceGraph = parse(referenceSnippet);
+        new CanonicalizerPhase(null, runtime(), assumptions).apply(referenceGraph);
+        assertEquals(referenceGraph, graph);
     }
 
     @Override
     protected void assertEquals(StructuredGraph expected, StructuredGraph graph) {
         if (expected.getNodeCount() != graph.getNodeCount()) {
-            // Debug.dump(expected, "Node count not matching - expected");
-            // Debug.dump(graph, "Node count not matching - actual");
-            // System.out.println("================ expected");
-            // outputGraph(expected);
-            // System.out.println("================ actual");
-            // outputGraph(graph);
-            // new IdealGraphPrinterDumpHandler().dump(graph, "asdf");
+            outputGraph(expected, "expected");
+            outputGraph(graph, "actual");
             Assert.fail("Graphs do not have the same number of nodes: " + expected.getNodeCount() + " vs. " + graph.getNodeCount());
         }
     }
@@ -250,18 +238,14 @@
         }
     }
 
-    @SuppressWarnings("unused")
     private <T extends Node & Node.IterableNodeType> void test(String snippet, Class<T> clazz) {
-        // TODO(ls) temporarily disabled, reintroduce when a proper type system is available
-        if (false) {
-            StructuredGraph graph = parse(snippet);
-            Debug.dump(graph, "Graph");
-            Assumptions assumptions = new Assumptions(false);
-            new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
-            new ConditionalEliminationPhase().apply(graph);
-            new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
-            Debug.dump(graph, "Graph");
-            Assert.assertFalse("shouldn't have nodes of type " + clazz, graph.getNodes(clazz).iterator().hasNext());
-        }
+        StructuredGraph graph = parse(snippet);
+        Debug.dump(graph, "Graph");
+        Assumptions assumptions = new Assumptions(false);
+        new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
+        new ConditionalEliminationPhase(runtime()).apply(graph);
+        new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
+        Debug.dump(graph, "Graph");
+        Assert.assertFalse("shouldn't have nodes of type " + clazz, graph.getNodes(clazz).iterator().hasNext());
     }
 }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java	Tue Feb 05 15:27:40 2013 +0100
@@ -198,7 +198,7 @@
         StructuredGraph graph = parse(snippet);
         try {
             for (Invoke n : graph.getInvokes()) {
-                n.node().setProbability(100000);
+                n.setInliningRelevance(1);
             }
 
             Assumptions assumptions = new Assumptions(false);
@@ -211,7 +211,7 @@
                 Assert.assertTrue(returnNode.result().toString(), returnNode.result().isConstant());
                 Assert.assertEquals(expectedConstantResult, returnNode.result().asConstant());
             }
-            int newInstanceCount = graph.getNodes(NewInstanceNode.class).count() + graph.getNodes(NewObjectArrayNode.class).count() + graph.getNodes(MaterializeObjectNode.class).count();
+            int newInstanceCount = graph.getNodes(NewInstanceNode.class).count() + graph.getNodes(NewArrayNode.class).count() + graph.getNodes(MaterializeObjectNode.class).count();
             Assert.assertEquals(0, newInstanceCount);
             return returnNode;
         } catch (AssertionFailedError t) {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java	Tue Feb 05 15:27:40 2013 +0100
@@ -126,8 +126,7 @@
     final void testMaterialize(final String snippet, double expectedProbability, int expectedCount, Class<? extends Node>... invalidNodeClasses) {
         StructuredGraph result = processMethod(snippet);
         Assert.assertTrue("partial escape analysis should have removed all NewInstanceNode allocations", result.getNodes(NewInstanceNode.class).isEmpty());
-        Assert.assertTrue("partial escape analysis should have removed all NewObjectArrayNode allocations", result.getNodes(NewObjectArrayNode.class).isEmpty());
-        Assert.assertTrue("partial escape analysis should have removed all NewPrimitiveArrayNode allocations", result.getNodes(NewPrimitiveArrayNode.class).isEmpty());
+        Assert.assertTrue("partial escape analysis should have removed all NewArrayNode allocations", result.getNodes(NewArrayNode.class).isEmpty());
         double probabilitySum = 0;
         int materializeCount = 0;
         for (MaterializeObjectNode materialize : result.getNodes(MaterializeObjectNode.class)) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Feb 05 15:27:40 2013 +0100
@@ -28,7 +28,6 @@
 import java.util.*;
 
 import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.interpreter.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.*;
@@ -265,9 +264,6 @@
         if (clazz == GraalCompiler.class) {
             return (T) getCompiler();
         }
-        if (clazz == RuntimeInterpreterInterface.class) {
-            return (T) getRuntimeInterpreterInterface();
-        }
         return null;
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java	Tue Feb 05 15:27:40 2013 +0100
@@ -28,11 +28,10 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.interpreter.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.meta.*;
 
-public class HotSpotRuntimeInterpreterInterface implements RuntimeInterpreterInterface {
+public class HotSpotRuntimeInterpreterInterface {
 
     private final MetaAccessProvider metaProvider;
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Tue Feb 05 15:27:40 2013 +0100
@@ -28,8 +28,8 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.phases.*;
+import com.oracle.graal.snippets.*;
 
 /**
  * Represents a field in a HotSpot type.
@@ -87,10 +87,16 @@
             }
             return constant;
         } else {
+            /*
+             * for non-static final fields, we must assume that they are only initialized if they
+             * have a non-default value.
+             */
             assert !Modifier.isStatic(flags);
-            // TODO (chaeubl) HotSpot does not trust final non-static fields (see ciField.cpp)
             if (Modifier.isFinal(getModifiers())) {
-                return readValue(receiver);
+                Constant value = readValue(receiver);
+                if (assumeNonStaticFinalFieldsAsFinal(receiver.asObject().getClass()) || !value.isDefaultForKind()) {
+                    return value;
+                }
             }
         }
         return null;
@@ -101,12 +107,12 @@
         if (receiver == null) {
             assert Modifier.isStatic(flags);
             if (holder.isInitialized()) {
-                return ReadNode.readUnsafeConstant(getKind(), holder.mirror(), offset);
+                return HotSpotGraalRuntime.getInstance().getRuntime().readUnsafeConstant(getKind(), holder.mirror(), offset);
             }
             return null;
         } else {
             assert !Modifier.isStatic(flags);
-            return ReadNode.readUnsafeConstant(getKind(), receiver.asObject(), offset);
+            return HotSpotGraalRuntime.getInstance().getRuntime().readUnsafeConstant(getKind(), receiver.asObject(), offset);
         }
     }
 
@@ -114,6 +120,10 @@
         return clazz == GraalOptions.class;
     }
 
+    private static boolean assumeNonStaticFinalFieldsAsFinal(Class<?> clazz) {
+        return clazz == SnippetCounter.class;
+    }
+
     @Override
     public HotSpotResolvedObjectType getDeclaringClass() {
         return holder;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Tue Feb 05 15:27:40 2013 +0100
@@ -52,7 +52,7 @@
     private final HotSpotResolvedObjectType holder;
     private/* final */int codeSize;
     private/* final */int exceptionHandlerCount;
-    private Signature signature;
+    private HotSpotSignature signature;
     private Boolean hasBalancedMonitors;
     private Map<Object, Object> compilerStorage;
     private HotSpotMethodData methodData;
@@ -162,7 +162,7 @@
     }
 
     @Override
-    public Signature getSignature() {
+    public HotSpotSignature getSignature() {
         if (signature == null) {
             signature = new HotSpotSignature(HotSpotGraalRuntime.getInstance().getCompilerToVM().getSignature(metaspaceMethod));
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue Feb 05 15:27:40 2013 +0100
@@ -28,6 +28,7 @@
 import static com.oracle.graal.api.code.Register.RegisterFlag.*;
 import static com.oracle.graal.api.meta.DeoptimizationReason.*;
 import static com.oracle.graal.api.meta.Value.*;
+import static com.oracle.graal.graph.UnsafeAccess.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.hotspot.snippets.SystemSubstitutions.*;
 import static com.oracle.graal.java.GraphBuilderPhase.RuntimeCalls.*;
@@ -916,4 +917,30 @@
         gcRoots.put(object, object);
         return object;
     }
+
+    @Override
+    public Constant readUnsafeConstant(Kind kind, Object base, long displacement) {
+        switch (kind) {
+            case Boolean:
+                return Constant.forBoolean(base == null ? unsafe.getByte(displacement) != 0 : unsafe.getBoolean(base, displacement));
+            case Byte:
+                return Constant.forByte(base == null ? unsafe.getByte(displacement) : unsafe.getByte(base, displacement));
+            case Char:
+                return Constant.forChar(base == null ? unsafe.getChar(displacement) : unsafe.getChar(base, displacement));
+            case Short:
+                return Constant.forShort(base == null ? unsafe.getShort(displacement) : unsafe.getShort(base, displacement));
+            case Int:
+                return Constant.forInt(base == null ? unsafe.getInt(displacement) : unsafe.getInt(base, displacement));
+            case Long:
+                return Constant.forLong(base == null ? unsafe.getLong(displacement) : unsafe.getLong(base, displacement));
+            case Float:
+                return Constant.forFloat(base == null ? unsafe.getFloat(displacement) : unsafe.getFloat(base, displacement));
+            case Double:
+                return Constant.forDouble(base == null ? unsafe.getDouble(displacement) : unsafe.getDouble(base, displacement));
+            case Object:
+                return Constant.forObject(unsafe.getObject(base, displacement));
+            default:
+                throw GraalInternalError.shouldNotReachHere();
+        }
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java	Tue Feb 05 15:27:40 2013 +0100
@@ -124,8 +124,8 @@
         return type;
     }
 
-    @Override
     public String getMethodDescriptor() {
+        assert originalString.equals(MetaUtil.signatureToMethodDescriptor(this));
         return originalString;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java	Tue Feb 05 15:27:40 2013 +0100
@@ -79,7 +79,7 @@
             isNull.inc();
         } else {
             Word objectHub = loadHub(object);
-            if (objectHub != exactHub) {
+            if (objectHub.notEqual(exactHub)) {
                 probability(DEOPT_PATH_PROBABILITY);
                 exactMiss.inc();
                 //bkpt(object, exactHub, objectHub);
@@ -108,7 +108,7 @@
             isNull.inc();
         } else {
             Word objectHub = loadHub(object);
-            if (objectHub.readWord(superCheckOffset) != hub) {
+            if (objectHub.readWord(superCheckOffset).notEqual(hub)) {
                 probability(DEOPT_PATH_PROBABILITY);
                 displayMiss.inc();
                 DeoptimizeNode.deopt(InvalidateReprofile, ClassCastException);
@@ -136,7 +136,7 @@
             ExplodeLoopNode.explodeLoop();
             for (int i = 0; i < hints.length; i++) {
                 Word hintHub = hints[i];
-                if (hintHub == objectHub) {
+                if (hintHub.equal(objectHub)) {
                     hintsHit.inc();
                     return unsafeCast(verifyOop(object), StampFactory.forNodeIntrinsic());
                 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ClassSubstitutions.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ClassSubstitutions.java	Tue Feb 05 15:27:40 2013 +0100
@@ -41,7 +41,7 @@
     @MethodSubstitution(isStatic = false)
     public static int getModifiers(final Class<?> thisObj) {
         Word klass = loadWordFromObject(thisObj, klassOffset());
-        if (klass == Word.zero()) {
+        if (klass.equal(0)) {
             // Class for primitive type
             return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
         } else {
@@ -52,7 +52,7 @@
     @MethodSubstitution(isStatic = false)
     public static boolean isInterface(final Class<?> thisObj) {
         Word klass = loadWordFromObject(thisObj, klassOffset());
-        if (klass == Word.zero()) {
+        if (klass.equal(0)) {
             return false;
         } else {
             int accessFlags = klass.readInt(klassAccessFlagsOffset());
@@ -63,7 +63,7 @@
     @MethodSubstitution(isStatic = false)
     public static boolean isArray(final Class<?> thisObj) {
         Word klass = loadWordFromObject(thisObj, klassOffset());
-        if (klass == Word.zero()) {
+        if (klass.equal(0)) {
             return false;
         } else {
             int layoutHelper = klass.readInt(klassLayoutHelperOffset());
@@ -74,13 +74,13 @@
     @MethodSubstitution(isStatic = false)
     public static boolean isPrimitive(final Class<?> thisObj) {
         Word klass = loadWordFromObject(thisObj, klassOffset());
-        return klass == Word.zero();
+        return klass.equal(0);
     }
 
     @MethodSubstitution(isStatic = false)
     public static Class<?> getSuperclass(final Class<?> thisObj) {
         Word klass = loadWordFromObject(thisObj, klassOffset());
-        if (klass != Word.zero()) {
+        if (klass.notEqual(0)) {
             int accessFlags = klass.readInt(klassAccessFlagsOffset());
             if ((accessFlags & Modifier.INTERFACE) == 0) {
                 int layoutHelper = klass.readInt(klassLayoutHelperOffset());
@@ -88,7 +88,7 @@
                     return Object.class;
                 } else {
                     Word superKlass = klass.readWord(klassSuperKlassOffset());
-                    if (superKlass == Word.zero()) {
+                    if (superKlass.equal(0)) {
                         return null;
                     } else {
                         return unsafeCast(superKlass.readObject(classMirrorOffset()), Class.class, true, true);
@@ -102,7 +102,7 @@
     @MethodSubstitution(isStatic = false)
     public static Class<?> getComponentType(final Class<?> thisObj) {
         Word klass = loadWordFromObject(thisObj, klassOffset());
-        if (klass != Word.zero()) {
+        if (klass.notEqual(0)) {
             int layoutHelper = klass.readInt(klassLayoutHelperOffset());
             if ((layoutHelper & arrayKlassLayoutHelperIdentifier()) != 0) {
                 return unsafeCast(klass.readObject(arrayKlassComponentMirrorOffset()), Class.class, true, true);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java	Tue Feb 05 15:27:40 2013 +0100
@@ -458,7 +458,7 @@
 
         // this code is independent from biased locking (although it does not look that way)
         final Word biasedLock = mark.and(biasedLockMaskInPlace());
-        if (biasedLock == Word.unsigned(unlockedMask())) {
+        if (biasedLock.equal(Word.unsigned(unlockedMask()))) {
             probability(FAST_PATH_PROBABILITY);
             int hash = (int) mark.unsignedShiftRight(identityHashCodeShift()).rawValue();
             if (hash != uninitializedIdentityHashCodeValue()) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java	Tue Feb 05 15:27:40 2013 +0100
@@ -73,7 +73,7 @@
             return falseValue;
         }
         Word objectHub = loadHub(object);
-        if (objectHub != exactHub) {
+        if (objectHub.notEqual(exactHub)) {
             probability(LIKELY_PROBABILITY);
             exactMiss.inc();
             return falseValue;
@@ -99,7 +99,7 @@
             return falseValue;
         }
         Word objectHub = loadHub(object);
-        if (objectHub.readWord(superCheckOffset) != hub) {
+        if (objectHub.readWord(superCheckOffset).notEqual(hub)) {
             probability(NOT_LIKELY_PROBABILITY);
             displayMiss.inc();
             return falseValue;
@@ -129,7 +129,7 @@
         ExplodeLoopNode.explodeLoop();
         for (int i = 0; i < hints.length; i++) {
             Word hintHub = hints[i];
-            if (hintHub == objectHub) {
+            if (hintHub.equal(objectHub)) {
                 probability(NOT_FREQUENT_PROBABILITY);
                 hintsHit.inc();
                 return trueValue;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java	Tue Feb 05 15:27:40 2013 +0100
@@ -76,10 +76,7 @@
     public static final boolean CHECK_BALANCED_MONITORS = Boolean.getBoolean("graal.monitors.checkBalanced");
 
     @Snippet
-    public static void monitorenter(@Parameter("object")
-    Object object, @ConstantParameter("checkNull")
-    boolean checkNull, @ConstantParameter("trace")
-    boolean trace) {
+    public static void monitorenter(@Parameter("object") Object object, @ConstantParameter("checkNull") boolean checkNull, @ConstantParameter("trace") boolean trace) {
         verifyOop(object);
 
         if (checkNull && object == null) {
@@ -105,7 +102,7 @@
             final Word biasableLockBits = mark.and(biasedLockMaskInPlace());
 
             // First check to see whether biasing is enabled for this object
-            if (biasableLockBits != Word.unsigned(biasedLockPattern())) {
+            if (biasableLockBits.notEqual(Word.unsigned(biasedLockPattern()))) {
                 // Biasing not enabled -> fall through to lightweight locking
             } else {
                 probability(FREQUENT_PROBABILITY);
@@ -118,7 +115,7 @@
                 trace(trace, "prototypeMarkWord: 0x%016lx\n", prototypeMarkWord);
                 trace(trace, "           thread: 0x%016lx\n", thread);
                 trace(trace, "              tmp: 0x%016lx\n", tmp);
-                if (tmp == Word.zero()) {
+                if (tmp.equal(0)) {
                     // Object is already biased to current thread -> done
                     probability(FREQUENT_PROBABILITY);
                     traceObject(trace, "+lock{bias:existing}", object);
@@ -134,7 +131,7 @@
                 // If the low three bits in the xor result aren't clear, that means
                 // the prototype header is no longer biasable and we have to revoke
                 // the bias on this object.
-                if (tmp.and(biasedLockMaskInPlace()) == Word.zero()) {
+                if (tmp.and(biasedLockMaskInPlace()).equal(0)) {
                     probability(FREQUENT_PROBABILITY);
                     // Biasing is still enabled for object's type. See whether the
                     // epoch of the current bias is still valid, meaning that the epoch
@@ -145,7 +142,7 @@
                     // that the current epoch is invalid in order to do this because
                     // otherwise the manipulations it performs on the mark word are
                     // illegal.
-                    if (tmp.and(epochMaskInPlace()) == Word.zero()) {
+                    if (tmp.and(epochMaskInPlace()).equal(0)) {
                         probability(FREQUENT_PROBABILITY);
                         // The epoch of the current bias is still valid but we know nothing
                         // about the owner; it might be set or it might be clear. Try to
@@ -157,7 +154,7 @@
                         Word biasedMark = unbiasedMark.or(thread);
                         trace(trace, "     unbiasedMark: 0x%016lx\n", unbiasedMark);
                         trace(trace, "       biasedMark: 0x%016lx\n", biasedMark);
-                        if (compareAndSwap(object, markOffset(), unbiasedMark, biasedMark) == unbiasedMark) {
+                        if (compareAndSwap(object, markOffset(), unbiasedMark, biasedMark).equal(unbiasedMark)) {
                             // Object is now biased to current thread -> done
                             traceObject(trace, "+lock{bias:acquired}", object);
                             return;
@@ -178,7 +175,7 @@
                         // the bias from one thread to another directly in this situation.
                         Word biasedMark = prototypeMarkWord.or(thread);
                         trace(trace, "       biasedMark: 0x%016lx\n", biasedMark);
-                        if (compareAndSwap(object, markOffset(), mark, biasedMark) == mark) {
+                        if (compareAndSwap(object, markOffset(), mark, biasedMark).equal(mark)) {
                             // Object is now biased to current thread -> done
                             traceObject(trace, "+lock{bias:transfer}", object);
                             return;
@@ -223,7 +220,7 @@
         // Test if the object's mark word is unlocked, and if so, store the
         // (address of) the lock slot into the object's mark word.
         Word currentMark = compareAndSwap(object, markOffset(), unlockedMark, lock);
-        if (currentMark != unlockedMark) {
+        if (currentMark.notEqual(unlockedMark)) {
             trace(trace, "      currentMark: 0x%016lx\n", currentMark);
             // The mark word in the object header was not the same.
             // Either the object is locked by another thread or is already locked
@@ -242,7 +239,7 @@
             // significant 2 bits cleared and page_size is a power of 2
             final Word alignedMask = Word.unsigned(wordSize() - 1);
             final Word stackPointer = stackPointer();
-            if (currentMark.subtract(stackPointer).and(alignedMask.subtract(pageSize())) != Word.zero()) {
+            if (currentMark.subtract(stackPointer).and(alignedMask.subtract(pageSize())).notEqual(0)) {
                 // Most likely not a recursive lock, go into a slow runtime call
                 probability(DEOPT_PATH_PROBABILITY);
                 traceObject(trace, "+lock{stub:failed-cas}", object);
@@ -268,10 +265,7 @@
      * Calls straight out to the monitorenter stub.
      */
     @Snippet
-    public static void monitorenterStub(@Parameter("object")
-    Object object, @ConstantParameter("checkNull")
-    boolean checkNull, @ConstantParameter("trace")
-    boolean trace) {
+    public static void monitorenterStub(@Parameter("object") Object object, @ConstantParameter("checkNull") boolean checkNull, @ConstantParameter("trace") boolean trace) {
         verifyOop(object);
         incCounter();
         if (checkNull && object == null) {
@@ -285,9 +279,7 @@
     }
 
     @Snippet
-    public static void monitorexit(@Parameter("object")
-    Object object, @ConstantParameter("trace")
-    boolean trace) {
+    public static void monitorexit(@Parameter("object") Object object, @ConstantParameter("trace") boolean trace) {
         trace(trace, "           object: 0x%016lx\n", Word.fromObject(object));
         if (useBiasedLocking()) {
             // Check for biased locking unlock case, which is a no-op
@@ -298,7 +290,7 @@
             // the bias bit would be clear.
             final Word mark = loadWordFromObject(object, markOffset());
             trace(trace, "             mark: 0x%016lx\n", mark);
-            if (mark.and(biasedLockMaskInPlace()) == Word.unsigned(biasedLockPattern())) {
+            if (mark.and(biasedLockMaskInPlace()).equal(Word.unsigned(biasedLockPattern()))) {
                 probability(FREQUENT_PROBABILITY);
                 endLockScope();
                 decCounter();
@@ -313,7 +305,7 @@
         final Word displacedMark = lock.readWord(lockDisplacedMarkOffset());
         trace(trace, "    displacedMark: 0x%016lx\n", displacedMark);
 
-        if (displacedMark == Word.zero()) {
+        if (displacedMark.equal(0)) {
             // Recursive locking => done
             traceObject(trace, "-lock{recursive}", object);
         } else {
@@ -321,7 +313,7 @@
             // Test if object's mark word is pointing to the displaced mark word, and if so, restore
             // the displaced mark in the object - if the object's mark word is not pointing to
             // the displaced mark word, do unlocking via runtime call.
-            if (DirectCompareAndSwapNode.compareAndSwap(object, markOffset(), lock, displacedMark) != lock) {
+            if (DirectCompareAndSwapNode.compareAndSwap(object, markOffset(), lock, displacedMark).notEqual(lock)) {
                 // The object's mark word was not pointing to the displaced header,
                 // we do unlocking via runtime call.
                 probability(DEOPT_PATH_PROBABILITY);
@@ -339,9 +331,7 @@
      * Calls straight out to the monitorexit stub.
      */
     @Snippet
-    public static void monitorexitStub(@Parameter("object")
-    Object object, @ConstantParameter("trace")
-    boolean trace) {
+    public static void monitorexitStub(@Parameter("object") Object object, @ConstantParameter("trace") boolean trace) {
         verifyOop(object);
         traceObject(trace, "-lock{stub}", object);
         MonitorExitStubCall.call(object);
@@ -434,8 +424,7 @@
             this.useFastLocking = useFastLocking;
         }
 
-        public void lower(MonitorEnterNode monitorenterNode, @SuppressWarnings("unused")
-        LoweringTool tool) {
+        public void lower(MonitorEnterNode monitorenterNode, @SuppressWarnings("unused") LoweringTool tool) {
             StructuredGraph graph = (StructuredGraph) monitorenterNode.graph();
 
             checkBalancedMonitors(graph);
@@ -466,8 +455,7 @@
             }
         }
 
-        public void lower(MonitorExitNode monitorexitNode, @SuppressWarnings("unused")
-        LoweringTool tool) {
+        public void lower(MonitorExitNode monitorexitNode, @SuppressWarnings("unused") LoweringTool tool) {
             StructuredGraph graph = (StructuredGraph) monitorexitNode.graph();
             FrameState stateAfter = monitorexitNode.stateAfter();
             boolean eliminated = monitorexitNode.eliminated();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java	Tue Feb 05 15:27:40 2013 +0100
@@ -84,7 +84,7 @@
                     @ConstantParameter("locked") boolean locked) {
 
         Object result;
-        if (memory == Word.zero()) {
+        if (memory.equal(0)) {
             new_stub.inc();
             result = NewInstanceStubCall.call(hub);
         } else {
@@ -118,7 +118,7 @@
 
     private static Object initializeArray(Word memory, Word hub, int length, int allocationSize, Word prototypeMarkWord, int headerSize, boolean fillContents) {
         Object result;
-        if (memory == Word.zero()) {
+        if (memory.equal(0)) {
             newarray_stub.inc();
             result = NewArrayStubCall.call(hub, length);
         } else {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/TypeCheckSnippetUtils.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/TypeCheckSnippetUtils.java	Tue Feb 05 15:27:40 2013 +0100
@@ -41,7 +41,7 @@
 
     static boolean checkSecondarySubType(Word t, Word s) {
         // if (S.cache == T) return true
-        if (s.readWord(secondarySuperCacheOffset()) == t) {
+        if (s.readWord(secondarySuperCacheOffset()).equal(t)) {
             cacheHit.inc();
             return true;
         }
@@ -55,7 +55,7 @@
         boolean primary = superCheckOffset != secondarySuperCacheOffset();
 
         // if (T = S[off]) return true
-        if (s.readWord(superCheckOffset) == t) {
+        if (s.readWord(superCheckOffset).equal(t)) {
             if (primary) {
                 cacheHit.inc();
             } else {
@@ -75,7 +75,7 @@
 
     private static boolean checkSelfAndSupers(Word t, Word s) {
         // if (T == S) return true
-        if (s == t) {
+        if (s.equal(t)) {
             T_equals_S.inc();
             return true;
         }
@@ -84,7 +84,7 @@
         Word secondarySupers = s.readWord(secondarySupersOffset());
         int length = secondarySupers.readInt(metaspaceArrayLengthOffset());
         for (int i = 0; i < length; i++) {
-            if (t == loadWordElement(secondarySupers, i)) {
+            if (t.equal(loadWordElement(secondarySupers, i))) {
                 probability(NOT_LIKELY_PROBABILITY);
                 s.writeWord(secondarySuperCacheOffset(), t);
                 secondariesHit.inc();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Tue Feb 05 15:27:40 2013 +0100
@@ -80,7 +80,7 @@
         // check that array length is small enough for fast path.
         if (length <= MAX_ARRAY_FAST_PATH_ALLOCATION_LENGTH) {
             Word memory = refillAllocate(intArrayHub, sizeInBytes, log);
-            if (memory != Word.zero()) {
+            if (memory.notEqual(0)) {
                 log(log, "newArray: allocated new array at %p\n", memory);
                 formatArray(hub, sizeInBytes, length, headerSize, memory, Word.unsigned(arrayPrototypeMarkWord()), true);
                 return verifyOop(memory.toObject());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Tue Feb 05 15:27:40 2013 +0100
@@ -71,7 +71,7 @@
         if (!forceSlowPath() && inlineContiguousAllocationSupported()) {
             if (hub.readInt(klassStateOffset()) == klassStateFullyInitialized()) {
                 Word memory = refillAllocate(intArrayHub, sizeInBytes, log);
-                if (memory != Word.zero()) {
+                if (memory.notEqual(0)) {
                     Word prototypeMarkWord = hub.readWord(prototypeMarkWordOffset());
                     memory.writeWord(markOffset(), prototypeMarkWord);
                     memory.writeWord(hubOffset(), hub);
@@ -129,7 +129,7 @@
 
             // if TLAB is currently allocated (top or end != null) then
             // fill [top, end + alignment_reserve) with array object
-            if (top != Word.zero()) {
+            if (top.notEqual(0)) {
                 int headerSize = arrayBaseOffset(Kind.Int);
                 // just like the HotSpot assembler stubs, assumes that tlabFreeSpaceInInts fits in
                 // an int
@@ -147,7 +147,7 @@
             Word tlabRefillSizeInBytes = tlabRefillSizeInWords.multiply(wordSize());
             // allocate new TLAB, address returned in top
             top = edenAllocate(tlabRefillSizeInBytes, log);
-            if (top != Word.zero()) {
+            if (top.notEqual(0)) {
                 thread.writeWord(threadTlabStartOffset(), top);
                 thread.writeWord(threadTlabTopOffset(), top);
 
@@ -195,7 +195,7 @@
                 return Word.zero();
             }
 
-            if (compareAndSwap(heapTopAddress, 0, heapTop, newHeapTop) == heapTop) {
+            if (compareAndSwap(heapTopAddress, 0, heapTop, newHeapTop).equal(heapTop)) {
                 return heapTop;
             }
         }
--- a/graal/com.oracle.graal.interpreter/overview.html	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-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.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-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.
--->
-
-</head>
-<body>
-
-Documentation for the <code>com.oracle.graal.interpreter</code> project.
-
-</body>
-</html>
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1679 +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.interpreter;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.api.interpreter.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.bytecode.*;
-
-/**
- * High-level bytecode interpreter that executes on top of Java. Java native methods are executed
- * using the {@link com.oracle.graal.api.interpreter.RuntimeInterpreterInterface}.
- */
-@SuppressWarnings("static-method")
-public final class BytecodeInterpreter implements Interpreter {
-
-    private static final String OPTION_MAX_STACK_SIZE = "maxStackSize";
-    private static final boolean TRACE = false;
-    private static final boolean TRACE_BYTE_CODE = false;
-
-    private static final int DEFAULT_MAX_STACK_SIZE = 1500;
-
-    private static final int NEXT = -1;
-    private static final int BRANCH = -2;
-    private static final int RETURN = -3;
-    private static final int CALL = -4;
-
-    private InterpreterFrame callFrame;
-
-    private Map<ResolvedJavaMethod, MethodRedirectionInfo> methodDelegates;
-
-    private int maxStackFrames;
-
-    private ResolvedJavaMethod rootMethod;
-    private RuntimeInterpreterInterface runtimeInterface;
-    private MetaAccessProvider metaAccessProvider;
-
-    public boolean initialize(String args) {
-        methodDelegates = new HashMap<>();
-        maxStackFrames = DEFAULT_MAX_STACK_SIZE;
-
-        GraalRuntime runtime = Graal.getRuntime();
-        this.runtimeInterface = runtime.getCapability(RuntimeInterpreterInterface.class);
-        if (this.runtimeInterface == null) {
-            throw new UnsupportedOperationException("The provided Graal runtime does not support the required capability " + RuntimeInterpreterInterface.class.getName() + ".");
-        }
-        this.metaAccessProvider = runtime.getCapability(MetaAccessProvider.class);
-        if (this.metaAccessProvider == null) {
-            throw new UnsupportedOperationException("The provided Graal runtime does not support the required capability " + MetaAccessProvider.class.getName() + ".");
-        }
-
-        this.rootMethod = resolveRootMethod();
-        registerDelegates();
-        return parseArguments(args);
-    }
-
-    @Override
-    public void setOption(String name, String value) {
-        if (name != null && name.equals(OPTION_MAX_STACK_SIZE)) {
-            this.maxStackFrames = Integer.parseInt(value);
-        }
-    }
-
-    private void registerDelegates() {
-        addDelegate(findMethod(Throwable.class, "fillInStackTrace"), new InterpreterCallable() {
-
-            @Override
-            public Object invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object[] arguments) throws Throwable {
-                setBackTrace(caller, (Throwable) arguments[0], createStackTraceElements(caller, runtimeInterface));
-                return null;
-            }
-        });
-        addDelegate(findMethod(Throwable.class, "getStackTraceDepth"), new InterpreterCallable() {
-
-            @Override
-            public Object invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object[] arguments) throws Throwable {
-                StackTraceElement[] elements = getBackTrace(caller, (Throwable) arguments[0]);
-                if (elements != null) {
-                    return elements.length;
-                }
-                return 0;
-            }
-        });
-        addDelegate(findMethod(Throwable.class, "getStackTraceElement", int.class), new InterpreterCallable() {
-
-            @Override
-            public Object invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object[] arguments) throws Throwable {
-                StackTraceElement[] elements = getBackTrace(caller, (Throwable) arguments[0]);
-                if (elements != null) {
-                    Integer index = (Integer) arguments[0];
-                    if (index != null) {
-                        return elements[index];
-                    }
-                }
-                return null;
-            }
-        });
-    }
-
-    @SuppressWarnings("unused")
-    private boolean parseArguments(String stringArgs) {
-        // TODO: parse the arguments
-        return true;
-    }
-
-    public void setMaxStackFrames(int maxStackSize) {
-        this.maxStackFrames = maxStackSize;
-    }
-
-    public int getMaxStackFrames() {
-        return maxStackFrames;
-    }
-
-    public void addDelegate(Method method, InterpreterCallable callable) {
-        ResolvedJavaMethod resolvedMethod = metaAccessProvider.lookupJavaMethod(method);
-        if (methodDelegates.containsKey(resolvedMethod)) {
-            throw new IllegalArgumentException("Delegate for method " + method + " already added.");
-        }
-
-        methodDelegates.put(resolvedMethod, new MethodRedirectionInfo(callable));
-    }
-
-    public void removeDelegate(Method method) {
-        methodDelegates.remove(metaAccessProvider.lookupJavaMethod(method));
-    }
-
-    @Override
-    public Object execute(ResolvedJavaMethod method, Object... boxedArguments) throws Throwable {
-        try {
-            boolean receiver = hasReceiver(method);
-            Signature signature = method.getSignature();
-            assert boxedArguments != null;
-            assert signature.getParameterCount(receiver) == boxedArguments.length;
-
-            if (TRACE) {
-                trace(0, "Executing root method " + method);
-            }
-
-            InterpreterFrame rootFrame = new InterpreterFrame(rootMethod, signature.getParameterSlots(true));
-            rootFrame.pushObject(this);
-            rootFrame.pushObject(method);
-            rootFrame.pushObject(boxedArguments);
-
-            int index = 0;
-            if (receiver) {
-                pushAsObject(rootFrame, Kind.Object, boxedArguments[index]);
-                index++;
-            }
-
-            for (int i = 0; index < boxedArguments.length; i++, index++) {
-                pushAsObject(rootFrame, signature.getParameterKind(i), boxedArguments[index]);
-            }
-
-            InterpreterFrame frame = rootFrame.create(method, receiver);
-            executeRoot(rootFrame, frame);
-            return popAsObject(rootFrame, signature.getReturnKind());
-        } catch (Exception e) {
-            // TODO (chaeubl): remove this exception handler (only used for debugging)
-            throw e;
-        }
-    }
-
-    public Object execute(Method javaMethod, Object... boxedArguments) throws Throwable {
-        return execute(metaAccessProvider.lookupJavaMethod(javaMethod), boxedArguments);
-    }
-
-    private boolean hasReceiver(ResolvedJavaMethod method) {
-        return !Modifier.isStatic(method.getModifiers());
-    }
-
-    private void executeRoot(InterpreterFrame root, InterpreterFrame frame) throws Throwable {
-        // TODO reflection redirection
-        InterpreterFrame prevFrame = frame;
-        InterpreterFrame currentFrame = frame;
-        BytecodeStream bs = new BytecodeStream(currentFrame.getMethod().getCode());
-        if (TRACE) {
-            traceCall(frame, "Call");
-        }
-        while (currentFrame != root) {
-            if (prevFrame != currentFrame) {
-                bs = new BytecodeStream(currentFrame.getMethod().getCode());
-            }
-            bs.setBCI(currentFrame.getBCI());
-
-            prevFrame = currentFrame;
-            currentFrame = loop(root, prevFrame, bs);
-        }
-        assert callFrame == null;
-    }
-
-    private InterpreterFrame loop(InterpreterFrame root, final InterpreterFrame frame, final BytecodeStream bs) throws Throwable {
-        try {
-            while (true) {
-                int result = executeInstruction(frame, bs);
-                switch (result) {
-                    case NEXT:
-                        bs.next();
-                        break;
-                    case RETURN:
-                        return popFrame(frame);
-                    case CALL:
-                        return allocateFrame(frame, bs);
-                    case BRANCH:
-                        bs.setBCI(bs.readBranchDest());
-                        break;
-                    default:
-                        // the outcome depends on stack values
-                        assert result >= 0 : "negative branch target";
-                        bs.setBCI(result);
-                        break;
-                }
-            }
-        } catch (Throwable t) {
-            if (TRACE) {
-                traceOp(frame, "Exception " + t.toString());
-            }
-            updateStackTrace(frame, t);
-
-            // frame bci needs to be in sync when handling exceptions
-            frame.setBCI(bs.currentBCI());
-
-            InterpreterFrame handlerFrame = handleThrowable(root, frame, t);
-            if (handlerFrame == null) {
-                // matched root we just throw it again.
-                throw t;
-            } else {
-                if (TRACE) {
-                    traceOp(frame, "Handler found " + handlerFrame.getMethod() + ":" + handlerFrame.getBCI());
-                }
-                // update bci from frame
-                bs.setBCI(handlerFrame.getBCI());
-
-                // continue execution on the found frame
-                return handlerFrame;
-            }
-        } finally {
-            // TODO may be not necessary.
-            frame.setBCI(bs.currentBCI());
-        }
-    }
-
-    private int executeInstruction(InterpreterFrame frame, BytecodeStream bs) throws Throwable {
-        if (TRACE_BYTE_CODE) {
-            traceOp(frame, bs.currentBCI() + ": " + Bytecodes.baseNameOf(bs.currentBC()));
-        }
-        switch (bs.currentBC()) {
-            case Bytecodes.NOP:
-                break;
-            case Bytecodes.ACONST_NULL:
-                frame.pushObject(null);
-                break;
-            case Bytecodes.ICONST_M1:
-                frame.pushInt(-1);
-                break;
-            case Bytecodes.ICONST_0:
-                frame.pushInt(0);
-                break;
-            case Bytecodes.ICONST_1:
-                frame.pushInt(1);
-                break;
-            case Bytecodes.ICONST_2:
-                frame.pushInt(2);
-                break;
-            case Bytecodes.ICONST_3:
-                frame.pushInt(3);
-                break;
-            case Bytecodes.ICONST_4:
-                frame.pushInt(4);
-                break;
-            case Bytecodes.ICONST_5:
-                frame.pushInt(5);
-                break;
-            case Bytecodes.LCONST_0:
-                frame.pushLong(0L);
-                break;
-            case Bytecodes.LCONST_1:
-                frame.pushLong(1L);
-                break;
-            case Bytecodes.FCONST_0:
-                frame.pushFloat(0.0F);
-                break;
-            case Bytecodes.FCONST_1:
-                frame.pushFloat(1.0F);
-                break;
-            case Bytecodes.FCONST_2:
-                frame.pushFloat(2.0F);
-                break;
-            case Bytecodes.DCONST_0:
-                frame.pushDouble(0.0D);
-                break;
-            case Bytecodes.DCONST_1:
-                frame.pushDouble(1.0D);
-                break;
-            case Bytecodes.BIPUSH:
-                frame.pushInt(bs.readByte());
-                break;
-            case Bytecodes.SIPUSH:
-                frame.pushInt(bs.readShort());
-                break;
-            case Bytecodes.LDC:
-            case Bytecodes.LDC_W:
-            case Bytecodes.LDC2_W:
-                pushCPConstant(frame, bs.readCPI());
-                break;
-            case Bytecodes.ILOAD:
-                frame.pushInt(frame.getInt(frame.resolveLocalIndex(bs.readLocalIndex())));
-                break;
-            case Bytecodes.LLOAD:
-                frame.pushLong(frame.getLong(frame.resolveLocalIndex(bs.readLocalIndex())));
-                break;
-            case Bytecodes.FLOAD:
-                frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(bs.readLocalIndex())));
-                break;
-            case Bytecodes.DLOAD:
-                frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(bs.readLocalIndex())));
-                break;
-            case Bytecodes.ALOAD:
-                frame.pushObject(frame.getObject(frame.resolveLocalIndex(bs.readLocalIndex())));
-                break;
-            case Bytecodes.ILOAD_0:
-                frame.pushInt(frame.getInt(frame.resolveLocalIndex(0)));
-                break;
-            case Bytecodes.ILOAD_1:
-                frame.pushInt(frame.getInt(frame.resolveLocalIndex(1)));
-                break;
-            case Bytecodes.ILOAD_2:
-                frame.pushInt(frame.getInt(frame.resolveLocalIndex(2)));
-                break;
-            case Bytecodes.ILOAD_3:
-                frame.pushInt(frame.getInt(frame.resolveLocalIndex(3)));
-                break;
-            case Bytecodes.LLOAD_0:
-                frame.pushLong(frame.getLong(frame.resolveLocalIndex(0)));
-                break;
-            case Bytecodes.LLOAD_1:
-                frame.pushLong(frame.getLong(frame.resolveLocalIndex(1)));
-                break;
-            case Bytecodes.LLOAD_2:
-                frame.pushLong(frame.getLong(frame.resolveLocalIndex(2)));
-                break;
-            case Bytecodes.LLOAD_3:
-                frame.pushLong(frame.getLong(frame.resolveLocalIndex(3)));
-                break;
-            case Bytecodes.FLOAD_0:
-                frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(0)));
-                break;
-            case Bytecodes.FLOAD_1:
-                frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(1)));
-                break;
-            case Bytecodes.FLOAD_2:
-                frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(2)));
-                break;
-            case Bytecodes.FLOAD_3:
-                frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(3)));
-                break;
-            case Bytecodes.DLOAD_0:
-                frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(0)));
-                break;
-            case Bytecodes.DLOAD_1:
-                frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(1)));
-                break;
-            case Bytecodes.DLOAD_2:
-                frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(2)));
-                break;
-            case Bytecodes.DLOAD_3:
-                frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(3)));
-                break;
-            case Bytecodes.ALOAD_0:
-                frame.pushObject(frame.getObject(frame.resolveLocalIndex(0)));
-                break;
-            case Bytecodes.ALOAD_1:
-                frame.pushObject(frame.getObject(frame.resolveLocalIndex(1)));
-                break;
-            case Bytecodes.ALOAD_2:
-                frame.pushObject(frame.getObject(frame.resolveLocalIndex(2)));
-                break;
-            case Bytecodes.ALOAD_3:
-                frame.pushObject(frame.getObject(frame.resolveLocalIndex(3)));
-                break;
-            case Bytecodes.IALOAD:
-                frame.pushInt(runtimeInterface.getArrayInt(frame.popInt(), frame.popObject()));
-                break;
-            case Bytecodes.LALOAD:
-                frame.pushLong(runtimeInterface.getArrayLong(frame.popInt(), frame.popObject()));
-                break;
-            case Bytecodes.FALOAD:
-                frame.pushFloat(runtimeInterface.getArrayFloat(frame.popInt(), frame.popObject()));
-                break;
-            case Bytecodes.DALOAD:
-                frame.pushDouble(runtimeInterface.getArrayDouble(frame.popInt(), frame.popObject()));
-                break;
-            case Bytecodes.AALOAD:
-                frame.pushObject(runtimeInterface.getArrayObject(frame.popInt(), frame.popObject()));
-                break;
-            case Bytecodes.BALOAD:
-                frame.pushInt(runtimeInterface.getArrayByte(frame.popInt(), frame.popObject()));
-                break;
-            case Bytecodes.CALOAD:
-                frame.pushInt(runtimeInterface.getArrayChar(frame.popInt(), frame.popObject()));
-                break;
-            case Bytecodes.SALOAD:
-                frame.pushInt(runtimeInterface.getArrayShort(frame.popInt(), frame.popObject()));
-                break;
-            case Bytecodes.ISTORE:
-                frame.setInt(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popInt());
-                break;
-            case Bytecodes.LSTORE:
-                frame.setLong(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popLong());
-                break;
-            case Bytecodes.FSTORE:
-                frame.setFloat(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popFloat());
-                break;
-            case Bytecodes.DSTORE:
-                frame.setDouble(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popDouble());
-                break;
-            case Bytecodes.ASTORE:
-                frame.setObject(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popObject());
-                break;
-            case Bytecodes.ISTORE_0:
-                frame.setInt(frame.resolveLocalIndex(0), frame.popInt());
-                break;
-            case Bytecodes.ISTORE_1:
-                frame.setInt(frame.resolveLocalIndex(1), frame.popInt());
-                break;
-            case Bytecodes.ISTORE_2:
-                frame.setInt(frame.resolveLocalIndex(2), frame.popInt());
-                break;
-            case Bytecodes.ISTORE_3:
-                frame.setInt(frame.resolveLocalIndex(3), frame.popInt());
-                break;
-            case Bytecodes.LSTORE_0:
-                frame.setLong(frame.resolveLocalIndex(0), frame.popLong());
-                break;
-            case Bytecodes.LSTORE_1:
-                frame.setLong(frame.resolveLocalIndex(1), frame.popLong());
-                break;
-            case Bytecodes.LSTORE_2:
-                frame.setLong(frame.resolveLocalIndex(2), frame.popLong());
-                break;
-            case Bytecodes.LSTORE_3:
-                frame.setLong(frame.resolveLocalIndex(3), frame.popLong());
-                break;
-            case Bytecodes.FSTORE_0:
-                frame.setFloat(frame.resolveLocalIndex(0), frame.popFloat());
-                break;
-            case Bytecodes.FSTORE_1:
-                frame.setFloat(frame.resolveLocalIndex(1), frame.popFloat());
-                break;
-            case Bytecodes.FSTORE_2:
-                frame.setFloat(frame.resolveLocalIndex(2), frame.popFloat());
-                break;
-            case Bytecodes.FSTORE_3:
-                frame.setFloat(frame.resolveLocalIndex(3), frame.popFloat());
-                break;
-            case Bytecodes.DSTORE_0:
-                frame.setDouble(frame.resolveLocalIndex(0), frame.popDouble());
-                break;
-            case Bytecodes.DSTORE_1:
-                frame.setDouble(frame.resolveLocalIndex(1), frame.popDouble());
-                break;
-            case Bytecodes.DSTORE_2:
-                frame.setDouble(frame.resolveLocalIndex(2), frame.popDouble());
-                break;
-            case Bytecodes.DSTORE_3:
-                frame.setDouble(frame.resolveLocalIndex(3), frame.popDouble());
-                break;
-            case Bytecodes.ASTORE_0:
-                frame.setObject(frame.resolveLocalIndex(0), frame.popObject());
-                break;
-            case Bytecodes.ASTORE_1:
-                frame.setObject(frame.resolveLocalIndex(1), frame.popObject());
-                break;
-            case Bytecodes.ASTORE_2:
-                frame.setObject(frame.resolveLocalIndex(2), frame.popObject());
-                break;
-            case Bytecodes.ASTORE_3:
-                frame.setObject(frame.resolveLocalIndex(3), frame.popObject());
-                break;
-            case Bytecodes.IASTORE:
-                runtimeInterface.setArrayInt(frame.popInt(), frame.popInt(), frame.popObject());
-                break;
-            case Bytecodes.LASTORE:
-                runtimeInterface.setArrayLong(frame.popLong(), frame.popInt(), frame.popObject());
-                break;
-            case Bytecodes.FASTORE:
-                runtimeInterface.setArrayFloat(frame.popFloat(), frame.popInt(), frame.popObject());
-                break;
-            case Bytecodes.DASTORE:
-                runtimeInterface.setArrayDouble(frame.popDouble(), frame.popInt(), frame.popObject());
-                break;
-            case Bytecodes.AASTORE:
-                runtimeInterface.setArrayObject(frame.popObject(), frame.popInt(), frame.popObject());
-                break;
-            case Bytecodes.BASTORE:
-                runtimeInterface.setArrayByte((byte) frame.popInt(), frame.popInt(), frame.popObject());
-                break;
-            case Bytecodes.CASTORE:
-                runtimeInterface.setArrayChar((char) frame.popInt(), frame.popInt(), frame.popObject());
-                break;
-            case Bytecodes.SASTORE:
-                runtimeInterface.setArrayShort((short) frame.popInt(), frame.popInt(), frame.popObject());
-                break;
-            case Bytecodes.POP:
-                frame.popVoid(1);
-                break;
-            case Bytecodes.POP2:
-                frame.popVoid(2);
-                break;
-            case Bytecodes.DUP:
-                frame.dup(1);
-                break;
-            case Bytecodes.DUP_X1:
-                frame.dupx1();
-                break;
-            case Bytecodes.DUP_X2:
-                frame.dupx2();
-                break;
-            case Bytecodes.DUP2:
-                frame.dup(2);
-                break;
-            case Bytecodes.DUP2_X1:
-                frame.dup2x1();
-                break;
-            case Bytecodes.DUP2_X2:
-                frame.dup2x2();
-                break;
-            case Bytecodes.SWAP:
-                frame.swapSingle();
-                break;
-            case Bytecodes.IADD:
-                frame.pushInt(frame.popInt() + frame.popInt());
-                break;
-            case Bytecodes.LADD:
-                frame.pushLong(frame.popLong() + frame.popLong());
-                break;
-            case Bytecodes.FADD:
-                frame.pushFloat(frame.popFloat() + frame.popFloat());
-                break;
-            case Bytecodes.DADD:
-                frame.pushDouble(frame.popDouble() + frame.popDouble());
-                break;
-            case Bytecodes.ISUB:
-                frame.pushInt(-frame.popInt() + frame.popInt());
-                break;
-            case Bytecodes.LSUB:
-                frame.pushLong(-frame.popLong() + frame.popLong());
-                break;
-            case Bytecodes.FSUB:
-                frame.pushFloat(-frame.popFloat() + frame.popFloat());
-                break;
-            case Bytecodes.DSUB:
-                frame.pushDouble(-frame.popDouble() + frame.popDouble());
-                break;
-            case Bytecodes.IMUL:
-                frame.pushInt(frame.popInt() * frame.popInt());
-                break;
-            case Bytecodes.LMUL:
-                frame.pushLong(frame.popLong() * frame.popLong());
-                break;
-            case Bytecodes.FMUL:
-                frame.pushFloat(frame.popFloat() * frame.popFloat());
-                break;
-            case Bytecodes.DMUL:
-                frame.pushDouble(frame.popDouble() * frame.popDouble());
-                break;
-            case Bytecodes.IDIV:
-                divInt(frame);
-                break;
-            case Bytecodes.LDIV:
-                divLong(frame);
-                break;
-            case Bytecodes.FDIV:
-                divFloat(frame);
-                break;
-            case Bytecodes.DDIV:
-                divDouble(frame);
-                break;
-            case Bytecodes.IREM:
-                remInt(frame);
-                break;
-            case Bytecodes.LREM:
-                remLong(frame);
-                break;
-            case Bytecodes.FREM:
-                remFloat(frame);
-                break;
-            case Bytecodes.DREM:
-                remDouble(frame);
-                break;
-            case Bytecodes.INEG:
-                frame.pushInt(-frame.popInt());
-                break;
-            case Bytecodes.LNEG:
-                frame.pushLong(-frame.popLong());
-                break;
-            case Bytecodes.FNEG:
-                frame.pushFloat(-frame.popFloat());
-                break;
-            case Bytecodes.DNEG:
-                frame.pushDouble(-frame.popDouble());
-                break;
-            case Bytecodes.ISHL:
-                shiftLeftInt(frame);
-                break;
-            case Bytecodes.LSHL:
-                shiftLeftLong(frame);
-                break;
-            case Bytecodes.ISHR:
-                shiftRightSignedInt(frame);
-                break;
-            case Bytecodes.LSHR:
-                shiftRightSignedLong(frame);
-                break;
-            case Bytecodes.IUSHR:
-                shiftRightUnsignedInt(frame);
-                break;
-            case Bytecodes.LUSHR:
-                shiftRightUnsignedLong(frame);
-                break;
-            case Bytecodes.IAND:
-                frame.pushInt(frame.popInt() & frame.popInt());
-                break;
-            case Bytecodes.LAND:
-                frame.pushLong(frame.popLong() & frame.popLong());
-                break;
-            case Bytecodes.IOR:
-                frame.pushInt(frame.popInt() | frame.popInt());
-                break;
-            case Bytecodes.LOR:
-                frame.pushLong(frame.popLong() | frame.popLong());
-                break;
-            case Bytecodes.IXOR:
-                frame.pushInt(frame.popInt() ^ frame.popInt());
-                break;
-            case Bytecodes.LXOR:
-                frame.pushLong(frame.popLong() ^ frame.popLong());
-                break;
-            case Bytecodes.IINC:
-                iinc(frame, bs);
-                break;
-            case Bytecodes.I2L:
-                frame.pushLong(frame.popInt());
-                break;
-            case Bytecodes.I2F:
-                frame.pushFloat(frame.popInt());
-                break;
-            case Bytecodes.I2D:
-                frame.pushDouble(frame.popInt());
-                break;
-            case Bytecodes.L2I:
-                frame.pushInt((int) frame.popLong());
-                break;
-            case Bytecodes.L2F:
-                frame.pushFloat(frame.popLong());
-                break;
-            case Bytecodes.L2D:
-                frame.pushDouble(frame.popLong());
-                break;
-            case Bytecodes.F2I:
-                frame.pushInt((int) frame.popFloat());
-                break;
-            case Bytecodes.F2L:
-                frame.pushLong((long) frame.popFloat());
-                break;
-            case Bytecodes.F2D:
-                frame.pushDouble(frame.popFloat());
-                break;
-            case Bytecodes.D2I:
-                frame.pushInt((int) frame.popDouble());
-                break;
-            case Bytecodes.D2L:
-                frame.pushLong((long) frame.popDouble());
-                break;
-            case Bytecodes.D2F:
-                frame.pushFloat((float) frame.popDouble());
-                break;
-            case Bytecodes.I2B:
-                frame.pushInt((byte) frame.popInt());
-                break;
-            case Bytecodes.I2C:
-                frame.pushInt((char) frame.popInt());
-                break;
-            case Bytecodes.I2S:
-                frame.pushInt((short) frame.popInt());
-                break;
-            case Bytecodes.LCMP:
-                compareLong(frame);
-                break;
-            case Bytecodes.FCMPL:
-                compareFloatLess(frame);
-                break;
-            case Bytecodes.FCMPG:
-                compareFloatGreater(frame);
-                break;
-            case Bytecodes.DCMPL:
-                compareDoubleLess(frame);
-                break;
-            case Bytecodes.DCMPG:
-                compareDoubleGreater(frame);
-                break;
-            case Bytecodes.IFEQ:
-                if (frame.popInt() == 0) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IFNE:
-                if (frame.popInt() != 0) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IFLT:
-                if (frame.popInt() < 0) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IFGE:
-                if (frame.popInt() >= 0) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IFGT:
-                if (frame.popInt() > 0) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IFLE:
-                if (frame.popInt() <= 0) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IF_ICMPEQ:
-                if (frame.popInt() == frame.popInt()) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IF_ICMPNE:
-                if (frame.popInt() != frame.popInt()) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IF_ICMPLT:
-                if (frame.popInt() > frame.popInt()) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IF_ICMPGE:
-                if (frame.popInt() <= frame.popInt()) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IF_ICMPGT:
-                if (frame.popInt() < frame.popInt()) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IF_ICMPLE:
-                if (frame.popInt() >= frame.popInt()) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IF_ACMPEQ:
-                if (frame.popObject() == frame.popObject()) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IF_ACMPNE:
-                if (frame.popObject() != frame.popObject()) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.GOTO:
-            case Bytecodes.GOTO_W:
-                return BRANCH;
-            case Bytecodes.JSR:
-            case Bytecodes.JSR_W:
-                frame.pushInt(bs.currentBCI());
-                return BRANCH;
-            case Bytecodes.RET:
-                return frame.getInt(frame.resolveLocalIndex(bs.readLocalIndex()));
-            case Bytecodes.TABLESWITCH:
-                return tableSwitch(frame, bs);
-            case Bytecodes.LOOKUPSWITCH:
-                return lookupSwitch(frame, bs);
-            case Bytecodes.IRETURN:
-                frame.getParentFrame().pushInt(frame.popInt());
-                return RETURN;
-            case Bytecodes.LRETURN:
-                frame.getParentFrame().pushLong(frame.popLong());
-                return RETURN;
-            case Bytecodes.FRETURN:
-                frame.getParentFrame().pushFloat(frame.popFloat());
-                return RETURN;
-            case Bytecodes.DRETURN:
-                frame.getParentFrame().pushDouble(frame.popDouble());
-                return RETURN;
-            case Bytecodes.ARETURN:
-                frame.getParentFrame().pushObject(frame.popObject());
-                return RETURN;
-            case Bytecodes.RETURN:
-                return RETURN;
-            case Bytecodes.GETSTATIC:
-                getField(frame, null, bs.currentBC(), bs.readCPI());
-                break;
-            case Bytecodes.PUTSTATIC:
-                putStatic(frame, bs.readCPI());
-                break;
-            case Bytecodes.GETFIELD:
-                getField(frame, nullCheck(frame.popObject()), bs.currentBC(), bs.readCPI());
-                break;
-            case Bytecodes.PUTFIELD:
-                putField(frame, bs.readCPI());
-                break;
-            case Bytecodes.INVOKEVIRTUAL:
-                callFrame = invokeVirtual(frame, bs.readCPI());
-                if (callFrame == null) {
-                    break;
-                }
-                return CALL;
-            case Bytecodes.INVOKESPECIAL:
-                callFrame = invokeSpecial(frame, bs.readCPI());
-                if (callFrame == null) {
-                    break;
-                }
-                return CALL;
-            case Bytecodes.INVOKESTATIC:
-                callFrame = invokeStatic(frame, bs.readCPI());
-                if (callFrame == null) {
-                    break;
-                }
-                return CALL;
-            case Bytecodes.INVOKEINTERFACE:
-                callFrame = invokeInterface(frame, bs.readCPI());
-                if (callFrame == null) {
-                    break;
-                }
-                return CALL;
-            case Bytecodes.XXXUNUSEDXXX:
-                assert false : "unused bytecode used. behaviour unspecified.";
-                // nop
-                break;
-            case Bytecodes.NEW:
-                frame.pushObject(allocateInstance(frame, bs.readCPI()));
-                break;
-            case Bytecodes.NEWARRAY:
-                frame.pushObject(allocateNativeArray(frame, bs.readByte()));
-                break;
-            case Bytecodes.ANEWARRAY:
-                frame.pushObject(allocateArray(frame, bs.readCPI()));
-                break;
-            case Bytecodes.ARRAYLENGTH:
-                frame.pushInt(Array.getLength(nullCheck(frame.popObject())));
-                break;
-            case Bytecodes.ATHROW:
-                Throwable t = (Throwable) frame.popObject();
-                if ("break".equals(t.getMessage())) {
-                    t.printStackTrace();
-                }
-                throw t;
-            case Bytecodes.CHECKCAST:
-                checkCast(frame, bs.readCPI());
-                break;
-            case Bytecodes.INSTANCEOF:
-                instanceOf(frame, bs.readCPI());
-                break;
-            case Bytecodes.MONITORENTER:
-                runtimeInterface.monitorEnter(frame.popObject());
-                break;
-            case Bytecodes.MONITOREXIT:
-                runtimeInterface.monitorExit(frame.popObject());
-                break;
-            case Bytecodes.WIDE:
-                assert false;
-                break;
-            case Bytecodes.MULTIANEWARRAY:
-                frame.pushObject(allocateMultiArray(frame, bs.readCPI(), bs.readUByte(bs.currentBCI() + 3)));
-                break;
-            case Bytecodes.IFNULL:
-                if (frame.popObject() == null) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.IFNONNULL:
-                if (frame.popObject() != null) {
-                    return BRANCH;
-                }
-                break;
-            case Bytecodes.BREAKPOINT:
-                assert false : "no breakpoints supported at this time.";
-                break; // nop
-        }
-        return NEXT;
-    }
-
-    private InterpreterFrame handleThrowable(InterpreterFrame root, InterpreterFrame frame, Throwable t) {
-        ExceptionHandler handler;
-        InterpreterFrame currentFrame = frame;
-        do {
-            handler = resolveExceptionHandlers(currentFrame, currentFrame.getBCI(), t);
-            if (handler == null) {
-                // no handler found pop frame
-                // and continue searching
-                currentFrame = popFrame(currentFrame);
-            } else {
-                // found a handler -> execute it
-                currentFrame.setBCI(handler.getHandlerBCI());
-                currentFrame.popStack();
-                currentFrame.pushObject(t);
-                return currentFrame;
-            }
-        } while (handler == null && currentFrame != root);
-
-        // will throw exception up the interpreter
-        return null;
-    }
-
-    private void updateStackTrace(InterpreterFrame frame, Throwable t) {
-        StackTraceElement[] elements = getBackTrace(frame, t);
-        if (elements != null) {
-            setStackTrace(frame, t, elements);
-            setBackTrace(frame, t, null);
-        } else {
-            setBackTrace(frame, t, createStackTraceElements(frame, runtimeInterface));
-        }
-    }
-
-    private void setStackTrace(InterpreterFrame frame, Throwable t, StackTraceElement[] stackTrace) {
-        runtimeInterface.setFieldObject(stackTrace, t, findThrowableField(frame, "stackTrace"));
-    }
-
-    private StackTraceElement[] getBackTrace(InterpreterFrame frame, Throwable t) {
-        Object value = runtimeInterface.getFieldObject(t, findThrowableField(frame, "backtrace"));
-        if (value instanceof StackTraceElement[]) {
-            return (StackTraceElement[]) value;
-        }
-        return null;
-    }
-
-    private void setBackTrace(InterpreterFrame frame, Throwable t, StackTraceElement[] backtrace) {
-        runtimeInterface.setFieldObject(backtrace, t, findThrowableField(frame, "backtrace"));
-    }
-
-    private ExceptionHandler resolveExceptionHandlers(InterpreterFrame frame, int bci, Throwable t) {
-        ExceptionHandler[] handlers = frame.getMethod().getExceptionHandlers();
-        for (int i = 0; i < handlers.length; i++) {
-            ExceptionHandler handler = handlers[i];
-            if (bci >= handler.getStartBCI() && bci <= handler.getEndBCI()) {
-                ResolvedJavaType catchType = null;
-                if (!handler.isCatchAll()) {
-                    // exception handlers are similar to instanceof bytecodes, so we pass instanceof
-                    catchType = resolveType(frame, Bytecodes.INSTANCEOF, (char) handler.catchTypeCPI());
-                }
-
-                if (catchType == null || catchType.isInstance(Constant.forObject(t))) {
-                    // the first found exception handler is our exception handler
-                    return handler;
-                }
-            }
-        }
-        return null;
-    }
-
-    private Class<?> mirror(ResolvedJavaType type) {
-        return runtimeInterface.getMirror(type);
-    }
-
-    private InterpreterFrame allocateFrame(InterpreterFrame frame, BytecodeStream bs) {
-        try {
-            InterpreterFrame nextFrame = this.callFrame;
-
-            assert nextFrame != null;
-            assert nextFrame.getParentFrame() == frame;
-
-            // store bci when leaving method
-            frame.setBCI(bs.currentBCI());
-
-            if (TRACE) {
-                traceCall(nextFrame, "Call");
-            }
-            if (Modifier.isSynchronized(nextFrame.getMethod().getModifiers())) {
-                if (TRACE) {
-                    traceOp(frame, "Method monitor enter");
-                }
-                if (Modifier.isStatic(nextFrame.getMethod().getModifiers())) {
-                    runtimeInterface.monitorEnter(mirror(nextFrame.getMethod().getDeclaringClass()));
-                } else {
-                    Object enterObject = nextFrame.getObject(frame.resolveLocalIndex(0));
-                    assert enterObject != null;
-                    runtimeInterface.monitorEnter(enterObject);
-                }
-            }
-
-            return nextFrame;
-        } finally {
-            callFrame = null;
-            bs.next();
-        }
-    }
-
-    private InterpreterFrame popFrame(InterpreterFrame frame) {
-        InterpreterFrame parent = frame.getParentFrame();
-        if (Modifier.isSynchronized(frame.getMethod().getModifiers())) {
-            if (TRACE) {
-                traceOp(frame, "Method monitor exit");
-            }
-            if (Modifier.isStatic(frame.getMethod().getModifiers())) {
-                runtimeInterface.monitorExit(mirror(frame.getMethod().getDeclaringClass()));
-            } else {
-                Object exitObject = frame.getObject(frame.resolveLocalIndex(0));
-                if (exitObject != null) {
-                    runtimeInterface.monitorExit(exitObject);
-                }
-            }
-        }
-        if (TRACE) {
-            traceCall(frame, "Ret");
-        }
-
-        frame.dispose();
-        return parent;
-    }
-
-    private void traceOp(InterpreterFrame frame, String opName) {
-        trace(frame.depth(), opName);
-    }
-
-    private void traceCall(InterpreterFrame frame, String type) {
-        trace(frame.depth(), type + " " + frame.getMethod() + " - " + frame.getMethod().getSignature());
-    }
-
-    private void trace(int level, String message) {
-        StringBuilder builder = new StringBuilder();
-        for (int i = 0; i < level; i++) {
-            builder.append("  ");
-        }
-        builder.append(message);
-        System.out.println(builder);
-    }
-
-    private void divInt(InterpreterFrame frame) {
-        int dividend = frame.popInt();
-        int divisor = frame.popInt();
-        frame.pushInt(divisor / dividend);
-    }
-
-    private void divLong(InterpreterFrame frame) {
-        long dividend = frame.popLong();
-        long divisor = frame.popLong();
-        frame.pushLong(divisor / dividend);
-    }
-
-    private void divFloat(InterpreterFrame frame) {
-        float dividend = frame.popFloat();
-        float divisor = frame.popFloat();
-        frame.pushFloat(divisor / dividend);
-    }
-
-    private void divDouble(InterpreterFrame frame) {
-        double dividend = frame.popDouble();
-        double divisor = frame.popDouble();
-        frame.pushDouble(divisor / dividend);
-    }
-
-    private void remInt(InterpreterFrame frame) {
-        int dividend = frame.popInt();
-        int divisor = frame.popInt();
-        frame.pushInt(divisor % dividend);
-    }
-
-    private void remLong(InterpreterFrame frame) {
-        long dividend = frame.popLong();
-        long divisor = frame.popLong();
-        frame.pushLong(divisor % dividend);
-    }
-
-    private void remFloat(InterpreterFrame frame) {
-        float dividend = frame.popFloat();
-        float divisor = frame.popFloat();
-        frame.pushFloat(divisor % dividend);
-    }
-
-    private void remDouble(InterpreterFrame frame) {
-        double dividend = frame.popDouble();
-        double divisor = frame.popDouble();
-        frame.pushDouble(divisor % dividend);
-    }
-
-    private void shiftLeftInt(InterpreterFrame frame) {
-        int bits = frame.popInt();
-        int value = frame.popInt();
-        frame.pushInt(value << bits);
-    }
-
-    private void shiftLeftLong(InterpreterFrame frame) {
-        int bits = frame.popInt();
-        long value = frame.popLong();
-        frame.pushLong(value << bits);
-    }
-
-    private void shiftRightSignedInt(InterpreterFrame frame) {
-        int bits = frame.popInt();
-        int value = frame.popInt();
-        frame.pushInt(value >> bits);
-    }
-
-    private void shiftRightSignedLong(InterpreterFrame frame) {
-        int bits = frame.popInt();
-        long value = frame.popLong();
-        frame.pushLong(value >> bits);
-    }
-
-    private void shiftRightUnsignedInt(InterpreterFrame frame) {
-        int bits = frame.popInt();
-        int value = frame.popInt();
-        frame.pushInt(value >>> bits);
-    }
-
-    private void shiftRightUnsignedLong(InterpreterFrame frame) {
-        int bits = frame.popInt();
-        long value = frame.popLong();
-        frame.pushLong(value >>> bits);
-    }
-
-    private int lookupSwitch(InterpreterFrame frame, BytecodeStream bs) {
-        return lookupSearch(new BytecodeLookupSwitch(bs, bs.currentBCI()), frame.popInt());
-    }
-
-    /**
-     * Binary search implementation for the lookup switch.
-     */
-    private int lookupSearch(BytecodeLookupSwitch switchHelper, int key) {
-        int low = 0;
-        int high = switchHelper.numberOfCases() - 1;
-        while (low <= high) {
-            int mid = (low + high) >>> 1;
-            int midVal = switchHelper.keyAt(mid);
-
-            if (midVal < key) {
-                low = mid + 1;
-            } else if (midVal > key) {
-                high = mid - 1;
-            } else {
-                return switchHelper.bci() + switchHelper.offsetAt(mid); // key found
-            }
-        }
-        return switchHelper.defaultTarget(); // key not found.
-    }
-
-    private int tableSwitch(InterpreterFrame frame, BytecodeStream bs) {
-        BytecodeTableSwitch switchHelper = new BytecodeTableSwitch(bs, bs.currentBCI());
-
-        int low = switchHelper.lowKey();
-        int high = switchHelper.highKey();
-
-        assert low <= high;
-
-        int index = frame.popInt();
-        if (index < low || index > high) {
-            return switchHelper.defaultTarget();
-        } else {
-            return switchHelper.targetAt(index - low);
-        }
-    }
-
-    private void checkCast(InterpreterFrame frame, char cpi) {
-        frame.pushObject(mirror(resolveType(frame, Bytecodes.CHECKCAST, cpi)).cast(frame.popObject()));
-    }
-
-    private ResolvedJavaType resolveType(InterpreterFrame frame, int opcode, char cpi) {
-        ConstantPool constantPool = frame.getConstantPool();
-        constantPool.loadReferencedType(cpi, opcode);
-        return constantPool.lookupType(cpi, opcode).resolve(frame.getMethod().getDeclaringClass());
-    }
-
-    private ResolvedJavaType resolveType(InterpreterFrame frame, Class<?> javaClass) {
-        return metaAccessProvider.lookupJavaType(javaClass).resolve(frame.getMethod().getDeclaringClass());
-    }
-
-    private ResolvedJavaMethod resolveMethod(InterpreterFrame frame, int opcode, char cpi) {
-        ConstantPool constantPool = frame.getConstantPool();
-        constantPool.loadReferencedType(cpi, opcode);
-        return (ResolvedJavaMethod) constantPool.lookupMethod(cpi, opcode);
-    }
-
-    private ResolvedJavaField resolveField(InterpreterFrame frame, int opcode, char cpi) {
-        ConstantPool constantPool = frame.getConstantPool();
-        constantPool.loadReferencedType(cpi, opcode);
-        return (ResolvedJavaField) constantPool.lookupField(cpi, opcode);
-    }
-
-    private void instanceOf(InterpreterFrame frame, char cpi) {
-        frame.pushInt(resolveType(frame, Bytecodes.INSTANCEOF, cpi).isInstance(Constant.forObject(frame.popObject())) ? 1 : 0);
-    }
-
-    private void pushCPConstant(InterpreterFrame frame, char cpi) {
-        ResolvedJavaMethod method = frame.getMethod();
-        Object constant = method.getConstantPool().lookupConstant(cpi);
-
-        if (constant instanceof Constant) {
-            Constant c = ((Constant) constant);
-            switch (c.getKind()) {
-                case Int:
-                    frame.pushInt(c.asInt());
-                    break;
-                case Float:
-                    frame.pushFloat(c.asFloat());
-                    break;
-                case Object:
-                    frame.pushObject(c.asObject());
-                    break;
-                case Double:
-                    frame.pushDouble(c.asDouble());
-                    break;
-                case Long:
-                    frame.pushLong(c.asLong());
-                    break;
-                default:
-                    assert false : "unspecified case";
-            }
-        } else if (constant instanceof JavaType) {
-            frame.pushObject(mirror(((JavaType) constant).resolve(method.getDeclaringClass())));
-        } else {
-            assert false : "unexpected case";
-        }
-    }
-
-    private void compareLong(InterpreterFrame frame) {
-        long y = frame.popLong();
-        long x = frame.popLong();
-        frame.pushInt((x < y) ? -1 : ((x == y) ? 0 : 1));
-    }
-
-    private void compareDoubleGreater(InterpreterFrame frame) {
-        double y = frame.popDouble();
-        double x = frame.popDouble();
-        frame.pushInt(x < y ? -1 : ((x == y) ? 0 : 1));
-    }
-
-    private void compareDoubleLess(InterpreterFrame frame) {
-        double y = frame.popDouble();
-        double x = frame.popDouble();
-        frame.pushInt(x > y ? 1 : ((x == y) ? 0 : -1));
-    }
-
-    private void compareFloatGreater(InterpreterFrame frame) {
-        float y = frame.popFloat();
-        float x = frame.popFloat();
-        frame.pushInt(x < y ? -1 : ((x == y) ? 0 : 1));
-    }
-
-    private void compareFloatLess(InterpreterFrame frame) {
-        float y = frame.popFloat();
-        float x = frame.popFloat();
-        frame.pushInt(x > y ? 1 : ((x == y) ? 0 : -1));
-    }
-
-    private Object nullCheck(Object value) {
-        if (value == null) {
-            throw new NullPointerException();
-        }
-        return value;
-    }
-
-    private InterpreterFrame invokeStatic(InterpreterFrame frame, char cpi) throws Throwable {
-        return invoke(frame, resolveMethod(frame, Bytecodes.INVOKESTATIC, cpi), null);
-    }
-
-    private InterpreterFrame invokeInterface(InterpreterFrame frame, char cpi) throws Throwable {
-        return resolveAndInvoke(frame, resolveMethod(frame, Bytecodes.INVOKEINTERFACE, cpi));
-    }
-
-    private InterpreterFrame resolveAndInvoke(InterpreterFrame parent, ResolvedJavaMethod m) throws Throwable {
-        Object receiver = nullCheck(parent.peekReceiver(m));
-
-        ResolvedJavaMethod method = resolveType(parent, receiver.getClass()).resolveMethod(m);
-
-        if (method == null) {
-            throw new AbstractMethodError();
-        }
-
-        return invoke(parent, method, receiver);
-    }
-
-    private InterpreterFrame invokeVirtual(InterpreterFrame frame, char cpi) throws Throwable {
-        ResolvedJavaMethod m = resolveMethod(frame, Bytecodes.INVOKEVIRTUAL, cpi);
-        if (Modifier.isFinal(m.getModifiers())) {
-            return invoke(frame, m, nullCheck(frame.peekReceiver(m)));
-        } else {
-            return resolveAndInvoke(frame, m);
-        }
-    }
-
-    private InterpreterFrame invokeSpecial(InterpreterFrame frame, char cpi) throws Throwable {
-        ResolvedJavaMethod m = resolveMethod(frame, Bytecodes.INVOKESPECIAL, cpi);
-        return invoke(frame, m, nullCheck(frame.peekReceiver(m)));
-    }
-
-    private Object[] popArgumentsAsObject(InterpreterFrame frame, ResolvedJavaMethod method, boolean hasReceiver) {
-        Signature signature = method.getSignature();
-        int argumentCount = method.getSignature().getParameterCount(hasReceiver);
-        Object[] parameters = new Object[argumentCount];
-
-        int lastSignatureIndex = hasReceiver ? 1 : 0;
-        for (int i = argumentCount - 1; i >= lastSignatureIndex; i--) {
-            ResolvedJavaType type = signature.getParameterType(i - lastSignatureIndex, method.getDeclaringClass()).resolve(method.getDeclaringClass());
-            parameters[i] = popAsObject(frame, type.getKind());
-        }
-
-        if (hasReceiver) {
-            parameters[0] = frame.popObject();
-        }
-        return parameters;
-    }
-
-    private InterpreterFrame invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object receiver) throws Throwable {
-        if (caller.depth() >= maxStackFrames) {
-            throw new StackOverflowError("Maximum callstack of " + maxStackFrames + " exceeded.");
-        }
-
-        if (Modifier.isNative(method.getModifiers())) {
-            return invokeNativeMethodViaVM(caller, method, receiver != null);
-        } else {
-            MethodRedirectionInfo redirectedMethod = methodDelegates.get(method);
-            if (redirectedMethod != null) {
-                return invokeRedirectedMethodViaVM(caller, method, redirectedMethod, receiver != null);
-            } else {
-                return invokeOptimized(caller, method, receiver != null);
-            }
-        }
-    }
-
-    private InterpreterFrame invokeNativeMethodViaVM(InterpreterFrame caller, ResolvedJavaMethod method, boolean hasReceiver) throws Throwable {
-        assert !methodDelegates.containsKey(method) : "must not be redirected";
-        if (TRACE) {
-            traceCall(caller, "Native " + method);
-        }
-
-        // mark the current thread as high level and execute the native method
-        Object[] parameters = popArgumentsAsObject(caller, method, hasReceiver);
-        Object returnValue = runtimeInterface.invoke(method, parameters);
-        pushAsObject(caller, method.getSignature().getReturnKind(), returnValue);
-
-        return null;
-    }
-
-    private InterpreterFrame invokeRedirectedMethodViaVM(InterpreterFrame caller, ResolvedJavaMethod originalMethod, MethodRedirectionInfo redirectionInfo, boolean hasReceiver) throws Throwable {
-        assert methodDelegates.containsKey(originalMethod) : "must be redirected";
-        if (TRACE) {
-            traceCall(caller, "Delegate " + originalMethod);
-        }
-
-        // current thread is low level and we also execute the target method in the low-level
-        // interpreter
-        Object[] originalCalleeParameters = popArgumentsAsObject(caller, originalMethod, hasReceiver);
-        Object[] parameters = new Object[]{caller, originalMethod, originalCalleeParameters};
-        Object returnValue = redirectionInfo.getTargetMethod().invoke(redirectionInfo.getReceiver(), parameters);
-        pushAsObject(caller, originalMethod.getSignature().getReturnKind(), returnValue);
-
-        return null;
-    }
-
-    private InterpreterFrame invokeOptimized(InterpreterFrame parent, ResolvedJavaMethod method, boolean hasReceiver) throws Throwable {
-        return parent.create(method, hasReceiver);
-    }
-
-    private Object allocateMultiArray(InterpreterFrame frame, char cpi, int dimension) {
-        ResolvedJavaType type = getLastDimensionType(resolveType(frame, Bytecodes.MULTIANEWARRAY, cpi));
-
-        int[] dimensions = new int[dimension];
-        for (int i = dimension - 1; i >= 0; i--) {
-            dimensions[i] = frame.popInt();
-        }
-        return Array.newInstance(mirror(type), dimensions);
-    }
-
-    private ResolvedJavaType getLastDimensionType(ResolvedJavaType type) {
-        ResolvedJavaType result = type;
-        while (result.isArray()) {
-            result = result.getComponentType();
-        }
-        return result;
-    }
-
-    private Object allocateArray(InterpreterFrame frame, char cpi) {
-        ResolvedJavaType type = resolveType(frame, Bytecodes.ANEWARRAY, cpi);
-        return Array.newInstance(runtimeInterface.getMirror(type), frame.popInt());
-    }
-
-    private Object allocateNativeArray(InterpreterFrame frame, byte cpi) {
-        // the constants for the cpi are loosely defined and no real cpi indices.
-        switch (cpi) {
-            case 4:
-                return new byte[frame.popInt()];
-            case 8:
-                return new byte[frame.popInt()];
-            case 5:
-                return new char[frame.popInt()];
-            case 7:
-                return new double[frame.popInt()];
-            case 6:
-                return new float[frame.popInt()];
-            case 10:
-                return new int[frame.popInt()];
-            case 11:
-                return new long[frame.popInt()];
-            case 9:
-                return new short[frame.popInt()];
-            default:
-                assert false : "unexpected case";
-                return null;
-        }
-    }
-
-    private Object allocateInstance(InterpreterFrame frame, char cpi) throws InstantiationException {
-        return runtimeInterface.newObject(resolveType(frame, Bytecodes.NEW, cpi));
-    }
-
-    private void iinc(InterpreterFrame frame, BytecodeStream bs) {
-        int index = frame.resolveLocalIndex(bs.readLocalIndex());
-        frame.setInt(index, frame.getInt(index) + bs.readIncrement());
-    }
-
-    private void putStatic(InterpreterFrame frame, char cpi) {
-        putFieldStatic(frame, resolveField(frame, Bytecodes.PUTSTATIC, cpi));
-    }
-
-    private void putField(InterpreterFrame frame, char cpi) {
-        putFieldVirtual(frame, resolveField(frame, Bytecodes.PUTFIELD, cpi));
-    }
-
-    private void putFieldStatic(InterpreterFrame frame, ResolvedJavaField field) {
-        switch (field.getKind()) {
-            case Boolean:
-            case Byte:
-            case Char:
-            case Short:
-            case Int:
-                runtimeInterface.setFieldInt(frame.popInt(), null, field);
-                break;
-            case Double:
-                runtimeInterface.setFieldDouble(frame.popDouble(), null, field);
-                break;
-            case Float:
-                runtimeInterface.setFieldFloat(frame.popFloat(), null, field);
-                break;
-            case Long:
-                runtimeInterface.setFieldLong(frame.popLong(), null, field);
-                break;
-            case Object:
-                runtimeInterface.setFieldObject(frame.popObject(), null, field);
-                break;
-            default:
-                assert false : "unexpected case";
-        }
-    }
-
-    private void putFieldVirtual(InterpreterFrame frame, ResolvedJavaField field) {
-        switch (field.getKind()) {
-            case Boolean:
-            case Byte:
-            case Char:
-            case Short:
-            case Int:
-                runtimeInterface.setFieldInt(frame.popInt(), nullCheck(frame.popObject()), field);
-                break;
-            case Double:
-                runtimeInterface.setFieldDouble(frame.popDouble(), nullCheck(frame.popObject()), field);
-                break;
-            case Float:
-                runtimeInterface.setFieldFloat(frame.popFloat(), nullCheck(frame.popObject()), field);
-                break;
-            case Long:
-                runtimeInterface.setFieldLong(frame.popLong(), nullCheck(frame.popObject()), field);
-                break;
-            case Object:
-                runtimeInterface.setFieldObject(frame.popObject(), nullCheck(frame.popObject()), field);
-                break;
-            default:
-                assert false : "unexpected case";
-        }
-    }
-
-    private void getField(InterpreterFrame frame, Object base, int opcode, char cpi) {
-        ResolvedJavaField field = resolveField(frame, opcode, cpi);
-        switch (field.getKind()) {
-            case Boolean:
-                frame.pushInt(runtimeInterface.getFieldBoolean(base, field) ? 1 : 0);
-                break;
-            case Byte:
-                frame.pushInt(runtimeInterface.getFieldByte(base, field));
-                break;
-            case Char:
-                frame.pushInt(runtimeInterface.getFieldChar(base, field));
-                break;
-            case Short:
-                frame.pushInt(runtimeInterface.getFieldShort(base, field));
-                break;
-            case Int:
-                frame.pushInt(runtimeInterface.getFieldInt(base, field));
-                break;
-            case Double:
-                frame.pushDouble(runtimeInterface.getFieldDouble(base, field));
-                break;
-            case Float:
-                frame.pushFloat(runtimeInterface.getFieldFloat(base, field));
-                break;
-            case Long:
-                frame.pushLong(runtimeInterface.getFieldLong(base, field));
-                break;
-            case Object:
-                frame.pushObject(runtimeInterface.getFieldObject(base, field));
-                break;
-            default:
-                assert false : "unexpected case";
-        }
-    }
-
-    private int pushAsObject(InterpreterFrame frame, Kind typeKind, Object value) {
-        switch (typeKind) {
-            case Int:
-                frame.pushInt((int) value);
-                break;
-            case Long:
-                frame.pushLong((long) value);
-                return 2;
-            case Boolean:
-                frame.pushInt(((boolean) value) ? 1 : 0);
-                break;
-            case Byte:
-                frame.pushInt((byte) value);
-                break;
-            case Char:
-                frame.pushInt((char) value);
-                break;
-            case Double:
-                frame.pushDouble((double) value);
-                return 2;
-            case Float:
-                frame.pushFloat((float) value);
-                break;
-            case Short:
-                frame.pushInt((short) value);
-                break;
-            case Object:
-                frame.pushObject(value);
-                break;
-            case Void:
-                return 0;
-            default:
-                assert false : "case not specified";
-        }
-        return 1;
-    }
-
-    private Object popAsObject(InterpreterFrame frame, Kind typeKind) {
-        switch (typeKind) {
-            case Boolean:
-                return frame.popInt() == 1 ? true : false;
-            case Byte:
-                return (byte) frame.popInt();
-            case Char:
-                return (char) frame.popInt();
-            case Double:
-                return frame.popDouble();
-            case Int:
-                return frame.popInt();
-            case Float:
-                return frame.popFloat();
-            case Long:
-                return frame.popLong();
-            case Short:
-                return (short) frame.popInt();
-            case Object:
-                return frame.popObject();
-            case Void:
-                return null;
-            default:
-                assert false : "unexpected case";
-        }
-        return null;
-    }
-
-    private ResolvedJavaMethod resolveRootMethod() {
-        try {
-            return metaAccessProvider.lookupJavaMethod(BytecodeInterpreter.class.getDeclaredMethod("execute", Method.class, Object[].class));
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    private static Method findMethod(Class<?> clazz, String name, Class<?>... parameters) {
-        try {
-            return clazz.getDeclaredMethod(name, parameters);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    private static StackTraceElement[] createStackTraceElements(InterpreterFrame frame, RuntimeInterpreterInterface runtimeInterface) {
-        InterpreterFrame tmp = frame;
-        List<StackTraceElement> elements = new ArrayList<>();
-        boolean first = false; // filter only first stack elements
-        while (tmp != null) {
-            if (first || !filterStackElement(tmp, runtimeInterface)) {
-                first = true;
-                elements.add(tmp.getMethod().asStackTraceElement(tmp.getBCI()));
-            }
-            tmp = tmp.getParentFrame();
-        }
-        return elements.toArray(new StackTraceElement[elements.size()]);
-    }
-
-    private static boolean filterStackElement(InterpreterFrame frame, RuntimeInterpreterInterface runtimeInterface) {
-        return Throwable.class.isAssignableFrom(runtimeInterface.getMirror(frame.getMethod().getDeclaringClass()));
-    }
-
-    private ResolvedJavaField findThrowableField(InterpreterFrame frame, String name) {
-        ResolvedJavaType throwableType = resolveType(frame, Throwable.class);
-        ResolvedJavaField[] fields = throwableType.getInstanceFields(false);
-        for (int i = 0; i < fields.length; i++) {
-            if (fields[i].getName().equals(name)) {
-                return fields[i];
-            }
-        }
-        assert false;
-        return null;
-    }
-
-    private class MethodRedirectionInfo {
-
-        private InterpreterCallable receiver;
-        private Method method;
-
-        public MethodRedirectionInfo(InterpreterCallable instance) {
-            this.receiver = instance;
-            this.method = resolveMethod(instance);
-        }
-
-        public InterpreterCallable getReceiver() {
-            return receiver;
-        }
-
-        public Method getTargetMethod() {
-            return method;
-        }
-
-        private Method resolveMethod(InterpreterCallable instance) {
-            try {
-                return instance.getClass().getMethod(InterpreterCallable.INTERPRETER_CALLABLE_INVOKE_NAME, InterpreterCallable.INTERPRETER_CALLABLE_INVOKE_SIGNATURE);
-            } catch (NoSuchMethodException e) {
-                throw new InterpreterException(e);
-            } catch (SecurityException e) {
-                throw new InterpreterException(e);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/Frame.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +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.interpreter;
-
-import java.lang.reflect.*;
-
-import sun.misc.*;
-
-public class Frame {
-
-    public static final Object[] EMPTY_ARRAY = new Object[0];
-    public static final int PARENT_FRAME_SLOT = 0;
-    public static final int MIN_FRAME_SIZE = 1;
-    private static final Unsafe unsafe = getUnsafe();
-
-    protected final Object[] locals;
-    protected final long[] primitiveLocals;
-
-    public Frame(int numLocals, Frame parent) {
-        assert numLocals >= MIN_FRAME_SIZE;
-        this.locals = new Object[numLocals];
-        this.locals[PARENT_FRAME_SLOT] = parent;
-        this.primitiveLocals = new long[numLocals];
-    }
-
-    public Frame(int numLocals) {
-        this(numLocals, null);
-    }
-
-    public Object getObject(int index) {
-        return locals[index];
-    }
-
-    public void setObject(int index, Object value) {
-        locals[index] = value;
-    }
-
-    public float getFloat(int index) {
-        return unsafe.getFloat(primitiveLocals, (long) index * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
-    }
-
-    public void setFloat(int index, float value) {
-        unsafe.putFloat(primitiveLocals, (long) index * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
-    }
-
-    public long getLong(int index) {
-        return unsafe.getLong(primitiveLocals, (long) index * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
-    }
-
-    public void setLong(int index, long value) {
-        unsafe.putLong(primitiveLocals, (long) index * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
-    }
-
-    public int getInt(int index) {
-        return unsafe.getInt(primitiveLocals, (long) index * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
-    }
-
-    public void setInt(int index, int value) {
-        unsafe.putInt(primitiveLocals, (long) index * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
-    }
-
-    public double getDouble(int index) {
-        return unsafe.getDouble(primitiveLocals, (long) index * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET);
-    }
-
-    public void setDouble(int index, double value) {
-        unsafe.putDouble(primitiveLocals, (long) index * Unsafe.ARRAY_LONG_INDEX_SCALE + Unsafe.ARRAY_LONG_BASE_OFFSET, value);
-    }
-
-    public static Frame getParentFrame(Frame frame, int level) {
-        assert level >= 0;
-        if (level == 0) {
-            return frame;
-        } else {
-            return getParentFrame((Frame) frame.getObject(PARENT_FRAME_SLOT), level - 1);
-        }
-    }
-
-    public static Frame getTopFrame(Frame frame) {
-        Frame parentFrame = (Frame) frame.getObject(PARENT_FRAME_SLOT);
-        if (parentFrame == null) {
-            return frame;
-        } else {
-            return getTopFrame(parentFrame);
-        }
-    }
-
-    public static Object[] getArguments(Frame frame, int argOffset) {
-        return (Object[]) frame.getObject(argOffset);
-    }
-
-    public int size() {
-        return locals.length;
-    }
-
-    @SuppressWarnings("unused")
-    private boolean indexExists(int index) {
-        return index >= 0 && index < locals.length;
-    }
-
-    private static Unsafe getUnsafe() {
-        try {
-            return Unsafe.getUnsafe();
-        } catch (SecurityException e) {
-        }
-        try {
-            Field theUnsafeInstance = Unsafe.class.getDeclaredField("theUnsafe");
-            theUnsafeInstance.setAccessible(true);
-            return (Unsafe) theUnsafeInstance.get(Unsafe.class);
-        } catch (Exception e) {
-            throw new RuntimeException("exception while trying to get Unsafe.theUnsafe via reflection:", e);
-        }
-    }
-}
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterCallable.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +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.interpreter;
-
-import com.oracle.graal.api.meta.*;
-
-public interface InterpreterCallable {
-
-    // static final fields
-    String INTERPRETER_CALLABLE_INVOKE_NAME = "invoke";
-    Class<?>[] INTERPRETER_CALLABLE_INVOKE_SIGNATURE = {InterpreterFrame.class, ResolvedJavaMethod.class, Object[].class};
-
-    // methods
-    Object invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object[] arguments) throws Throwable;
-}
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterException.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +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.interpreter;
-
-/**
- * Thrown if executed byte code caused an error in {@link BytecodeInterpreter}. The actual execution
- * exception is accessible using {@link #getCause()} or {@link #getExecutionThrowable()}.
- */
-public class InterpreterException extends RuntimeException {
-
-    private static final long serialVersionUID = 1L;
-
-    public InterpreterException(Throwable cause) {
-        super(cause);
-    }
-
-    public Throwable getExecutionThrowable() {
-        return getCause();
-    }
-
-}
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,353 +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.interpreter;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-public class InterpreterFrame extends Frame {
-
-    public static final int BASE_LENGTH = 3;
-
-    private static final int METHOD_FRAME_SLOT = 1;
-    private static final int BCI_FRAME_SLOT = 2;
-
-    private static final int DOUBLE = 2;
-    private static final int SINGLE = 1;
-
-    /** Pointer to the top-most stack frame element. */
-    private int depth;
-    private int tos;
-
-    public InterpreterFrame(ResolvedJavaMethod method, int additionalStackSpace) {
-        this(method, null, additionalStackSpace, 0);
-    }
-
-    private InterpreterFrame(ResolvedJavaMethod method, InterpreterFrame parent, int additionalStackSpace, int depth) {
-        super(method.getMaxLocals() + method.getMaxStackSize() + BASE_LENGTH + additionalStackSpace, parent);
-        setMethod(method);
-        setBCI(0);
-        this.depth = depth;
-        this.tos = BASE_LENGTH;
-    }
-
-    public InterpreterFrame create(ResolvedJavaMethod method, boolean hasReceiver) {
-        InterpreterFrame frame = new InterpreterFrame(method, this, 0, this.depth + 1);
-        int length = method.getSignature().getParameterSlots(hasReceiver);
-
-        frame.pushVoid(method.getMaxLocals());
-        if (length > 0) {
-            copyArguments(frame, length);
-            popVoid(length);
-        }
-
-        return frame;
-    }
-
-    public int resolveLocalIndex(int index) {
-        return BASE_LENGTH + index;
-    }
-
-    public int depth() {
-        return depth;
-    }
-
-    private int stackTos() {
-        return BASE_LENGTH + getMethod().getMaxLocals();
-    }
-
-    private void copyArguments(InterpreterFrame dest, int length) {
-        System.arraycopy(locals, tosSingle(length - 1), dest.locals, BASE_LENGTH, length);
-        System.arraycopy(primitiveLocals, tosSingle(length - 1), dest.primitiveLocals, BASE_LENGTH, length);
-    }
-
-    public Object peekReceiver(ResolvedJavaMethod method) {
-        return getObject(tosSingle(method.getSignature().getParameterSlots(false)));
-    }
-
-    public void pushBoth(Object oValue, int intValue) {
-        incrementTos(SINGLE);
-        setObject(tosSingle(0), oValue);
-        setInt(tosSingle(0), intValue);
-    }
-
-    public void pushBoth(Object oValue, long longValue) {
-        incrementTos(SINGLE);
-        setObject(tosSingle(0), oValue);
-        setLong(tosSingle(0), longValue);
-    }
-
-    public void pushObject(Object value) {
-        incrementTos(SINGLE);
-        setObject(tosSingle(0), value);
-    }
-
-    public void pushInt(int value) {
-        incrementTos(SINGLE);
-        setInt(tosSingle(0), value);
-    }
-
-    public void pushDouble(double value) {
-        incrementTos(DOUBLE);
-        setDouble(tosDouble(0), value);
-    }
-
-    public void pushFloat(float value) {
-        incrementTos(SINGLE);
-        setFloat(tosSingle(0), value);
-    }
-
-    public void pushLong(long value) {
-        incrementTos(DOUBLE);
-        setLong(tosDouble(0), value);
-    }
-
-    public int popInt() {
-        int value = getInt(tosSingle(0));
-        decrementTos(SINGLE);
-        return value;
-    }
-
-    public double popDouble() {
-        double value = getDouble(tosDouble(0));
-        decrementTos(DOUBLE);
-        return value;
-    }
-
-    public float popFloat() {
-        float value = getFloat(tosSingle(0));
-        decrementTos(SINGLE);
-        return value;
-    }
-
-    public long popLong() {
-        long value = getLong(tosDouble(0));
-        decrementTos(DOUBLE);
-        return value;
-    }
-
-    public Object popObject() {
-        Object value = getObject(tosSingle(0));
-        decrementTos(SINGLE);
-        return value;
-    }
-
-    public void swapSingle() {
-        int tmpInt = getInt(tosSingle(1));
-        Object tmpObject = getObject(tosSingle(1));
-
-        setInt(tosSingle(1), getInt(tosSingle(0)));
-        setObject(tosSingle(1), getObject(tosSingle(0)));
-
-        setInt(tosSingle(0), tmpInt);
-        setObject(tosSingle(0), tmpObject);
-    }
-
-    public void dupx1() {
-        long tosLong = getLong(tosSingle(0));
-        Object tosObject = getObject(tosSingle(0));
-
-        swapSingle();
-
-        pushBoth(tosObject, tosLong);
-    }
-
-    public void dup2x1() {
-        long tosLong2 = getLong(tosSingle(2));
-        Object tosObject2 = getObject(tosSingle(2));
-        long tosLong1 = getLong(tosSingle(1));
-        Object tosObject1 = getObject(tosSingle(1));
-        long tosLong0 = getLong(tosSingle(0));
-        Object tosObject0 = getObject(tosSingle(0));
-
-        popVoid(3);
-
-        pushBoth(tosObject1, tosLong1);
-        pushBoth(tosObject0, tosLong0);
-
-        pushBoth(tosObject2, tosLong2);
-
-        pushBoth(tosObject1, tosLong1);
-        pushBoth(tosObject0, tosLong0);
-    }
-
-    public void dup2x2() {
-        long tosLong3 = getLong(tosSingle(3));
-        Object tosObject3 = getObject(tosSingle(3));
-        long tosLong2 = getLong(tosSingle(2));
-        Object tosObject2 = getObject(tosSingle(2));
-        long tosLong1 = getLong(tosSingle(1));
-        Object tosObject1 = getObject(tosSingle(1));
-        long tosLong0 = getLong(tosSingle(0));
-        Object tosObject0 = getObject(tosSingle(0));
-
-        popVoid(4);
-
-        pushBoth(tosObject1, tosLong1);
-        pushBoth(tosObject0, tosLong0);
-
-        pushBoth(tosObject3, tosLong3);
-        pushBoth(tosObject2, tosLong2);
-
-        pushBoth(tosObject1, tosLong1);
-        pushBoth(tosObject0, tosLong0);
-    }
-
-    public void dupx2() {
-        long tosLong2 = getLong(tosSingle(2));
-        Object tosObject2 = getObject(tosSingle(2));
-        long tosLong1 = getLong(tosSingle(1));
-        Object tosObject1 = getObject(tosSingle(1));
-        long tosLong0 = getLong(tosSingle(0));
-        Object tosObject0 = getObject(tosSingle(0));
-
-        popVoid(3);
-
-        pushBoth(tosObject0, tosLong0);
-        pushBoth(tosObject2, tosLong2);
-        pushBoth(tosObject1, tosLong1);
-        pushBoth(tosObject0, tosLong0);
-    }
-
-    public void dup(int length) {
-        assert length > 0;
-        for (int i = 0; i < length; i++) {
-            long valueN1 = getLong(tosSingle(length - i - 1));
-            Object valueO1 = getObject(tosSingle(length - i - 1));
-
-            pushVoid(1);
-
-            setLong(tosSingle(0), valueN1);
-            setObject(tosSingle(0), valueO1);
-        }
-    }
-
-    private void incrementTos(int size) {
-        tos += size;
-    }
-
-    private void decrementTos(int size) {
-        assert tos - size >= stackTos();
-        tos -= size;
-    }
-
-    private int tosDouble(int offset) {
-        assert offset >= 0;
-        return tos - DOUBLE - (offset * DOUBLE);
-    }
-
-    private int tosSingle(int offset) {
-        assert offset >= 0;
-        return tos - SINGLE - offset;
-    }
-
-    public int getStackTop() {
-        return tos;
-    }
-
-    public void pushVoid(int count) {
-        incrementTos(count * SINGLE);
-    }
-
-    public void popVoid(int count) {
-        decrementTos(count * SINGLE);
-    }
-
-    public ConstantPool getConstantPool() {
-        return getMethod().getConstantPool();
-    }
-
-    private void setMethod(ResolvedJavaMethod method) {
-        setObject(METHOD_FRAME_SLOT, method);
-    }
-
-    public ResolvedJavaMethod getMethod() {
-        return (ResolvedJavaMethod) getObject(METHOD_FRAME_SLOT);
-    }
-
-    public void setBCI(int bci) {
-        setInt(BCI_FRAME_SLOT, bci);
-    }
-
-    public int getBCI() {
-        return getInt(BCI_FRAME_SLOT);
-    }
-
-    public void pushTo(InterpreterFrame childFrame, int argumentSlots) {
-        System.arraycopy(locals, tos - argumentSlots, childFrame.locals, InterpreterFrame.MIN_FRAME_SIZE, argumentSlots);
-
-        System.arraycopy(primitiveLocals, tos - argumentSlots, childFrame.primitiveLocals, InterpreterFrame.MIN_FRAME_SIZE, argumentSlots);
-        popVoid(argumentSlots);
-    }
-
-    public InterpreterFrame getParentFrame() {
-        return (InterpreterFrame) getObject(PARENT_FRAME_SLOT);
-    }
-
-    public void dispose() {
-        // Clear out references in locals array.
-        Arrays.fill(locals, null);
-    }
-
-    @Override
-    public String toString() {
-        ResolvedJavaMethod method = getMethod();
-        StringBuilder b = new StringBuilder(getMethod().asStackTraceElement(getBCI()).toString());
-        for (int i = 0; i < tos; i++) {
-            Object object = getObject(tosSingle(i));
-            long primitive = getLong(tosSingle(i));
-
-            String objectString = null;
-            if (object != null) {
-                objectString = object.getClass().getSimpleName() + "@" + Integer.toHexString(object.hashCode());
-            }
-            String primitiveString = "0x" + Long.toHexString(primitive).toUpperCase();
-            String typeString;
-
-            int index = tosSingle(i);
-            if (index == METHOD_FRAME_SLOT) {
-                typeString = "method";
-            } else if (index == BCI_FRAME_SLOT) {
-                typeString = "bci";
-            } else if (index == PARENT_FRAME_SLOT) {
-                typeString = "parent";
-            } else if (index < BASE_LENGTH + method.getMaxLocals()) {
-                typeString = "var " + (index - BASE_LENGTH);
-            } else {
-                typeString = "local";
-            }
-            b.append(String.format("%n [%d] %7s Primitive: %10s Object: %s", index, typeString, primitiveString, objectString));
-        }
-        if (getParentFrame() != null) {
-            b.append("\n").append(getParentFrame().toString());
-        }
-        return b.toString();
-    }
-
-    public void popStack() {
-        // TODO(chumer): prevent popping local variables.
-        popVoid(tos - stackTos());
-    }
-
-}
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Feb 05 15:27:40 2013 +0100
@@ -765,7 +765,7 @@
     private void genNewPrimitiveArray(int typeCode) {
         Class<?> clazz = arrayTypeCodeToClass(typeCode);
         ResolvedJavaType elementType = runtime.lookupJavaType(clazz);
-        NewPrimitiveArrayNode nta = currentGraph.add(new NewPrimitiveArrayNode(elementType, frameState.ipop(), true, false));
+        NewArrayNode nta = currentGraph.add(new NewArrayNode(elementType, frameState.ipop(), true, false));
         frameState.apush(append(nta));
     }
 
@@ -773,7 +773,7 @@
         JavaType type = lookupType(cpi, ANEWARRAY);
         ValueNode length = frameState.ipop();
         if (type instanceof ResolvedJavaType) {
-            NewArrayNode n = currentGraph.add(new NewObjectArrayNode((ResolvedJavaType) type, length, true, false));
+            NewArrayNode n = currentGraph.add(new NewArrayNode((ResolvedJavaType) type, length, true, false));
             frameState.apush(append(n));
         } else {
             append(currentGraph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.Unresolved)));
@@ -1143,6 +1143,19 @@
         return true;
     }
 
+    /**
+     * Helper function that sums up the probabilities of all keys that lead to a specific successor.
+     * 
+     * @return an array of size successorCount with the accumulated probability for each successor.
+     */
+    private static double[] successorProbabilites(int successorCount, int[] keySuccessors, double[] keyProbabilities) {
+        double[] probability = new double[successorCount];
+        for (int i = 0; i < keySuccessors.length; i++) {
+            probability[keySuccessors[i]] += keyProbabilities[i];
+        }
+        return probability;
+    }
+
     private void genSwitch(BytecodeSwitch bs) {
         int bci = bci();
         ValueNode value = frameState.ipop();
@@ -1185,7 +1198,7 @@
             }
         }
 
-        double[] successorProbabilities = IntegerSwitchNode.successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities);
+        double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities);
         IntegerSwitchNode switchNode = currentGraph.add(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors));
         for (int i = 0; i < actualSuccessors.size(); i++) {
             switchNode.setBlockSuccessor(i, createBlockTarget(successorProbabilities[i], actualSuccessors.get(i), frameState));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -323,6 +323,7 @@
             }
         }
         assert !ends.hasNext();
+        assert falseEnds.size() + trueEnds.size() == xs.length;
 
         connectEnds(falseEnds, phiValues, oldFalseSuccessor, merge, tool);
         connectEnds(trueEnds, phiValues, oldTrueSuccessor, merge, tool);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -58,6 +58,12 @@
         this.location = location;
     }
 
+    public AccessNode(ValueNode object, ValueNode location, Stamp stamp, ValueNode... dependencies) {
+        super(stamp, dependencies);
+        this.object = object;
+        this.location = location;
+    }
+
     @Override
     public Node node() {
         return this;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -49,7 +49,7 @@
      * @param keySuccessors the successor index for each key
      */
     public IntegerSwitchNode(ValueNode value, BeginNode[] successors, int[] keys, double[] keyProbabilities, int[] keySuccessors) {
-        super(value, successors, successorProbabilites(successors.length, keySuccessors, keyProbabilities), keySuccessors, keyProbabilities);
+        super(value, successors, keySuccessors, keyProbabilities);
         assert keySuccessors.length == keys.length + 1;
         assert keySuccessors.length == keyProbabilities.length;
         this.keys = keys;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import static com.oracle.graal.graph.FieldIntrospection.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
@@ -42,11 +41,12 @@
         super(object, object.graph().add(new LocationNode(locationIdentity, kind, displacement)), StampFactory.forKind(kind));
     }
 
-    private ReadNode(ValueNode object, ValueNode location) {
-        // Used by node intrinsics. Since the initial value for location is a parameter, i.e., a
-        // LocalNode, the
-        // constructor cannot use the declared type LocationNode
-        this(object, location, StampFactory.forNodeIntrinsic());
+    private ReadNode(ValueNode object, ValueNode location, ValueNode dependency) {
+        /*
+         * Used by node intrinsics. Since the initial value for location is a parameter, i.e., a
+         * LocalNode, the constructor cannot use the declared type LocationNode.
+         */
+        super(object, location, StampFactory.forNodeIntrinsic(), dependency);
     }
 
     @Override
@@ -59,60 +59,27 @@
         return canonicalizeRead(this, tool);
     }
 
-    /**
-     * Utility function for reading a value of this kind using a base address and a displacement.
-     * 
-     * @param base the base address from which the value is read
-     * @param displacement the displacement within the object in bytes
-     * @return the read value encapsulated in a {@link Constant} object
-     */
-    public static Constant readUnsafeConstant(Kind kind, Object base, long displacement) {
-        switch (kind) {
-            case Boolean:
-                return Constant.forBoolean(base == null ? unsafe.getByte(displacement) != 0 : unsafe.getBoolean(base, displacement));
-            case Byte:
-                return Constant.forByte(base == null ? unsafe.getByte(displacement) : unsafe.getByte(base, displacement));
-            case Char:
-                return Constant.forChar(base == null ? unsafe.getChar(displacement) : unsafe.getChar(base, displacement));
-            case Short:
-                return Constant.forShort(base == null ? unsafe.getShort(displacement) : unsafe.getShort(base, displacement));
-            case Int:
-                return Constant.forInt(base == null ? unsafe.getInt(displacement) : unsafe.getInt(base, displacement));
-            case Long:
-                return Constant.forLong(base == null ? unsafe.getLong(displacement) : unsafe.getLong(base, displacement));
-            case Float:
-                return Constant.forFloat(base == null ? unsafe.getFloat(displacement) : unsafe.getFloat(base, displacement));
-            case Double:
-                return Constant.forDouble(base == null ? unsafe.getDouble(displacement) : unsafe.getDouble(base, displacement));
-            case Object:
-                return Constant.forObject(unsafe.getObject(base, displacement));
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-
     public static ValueNode canonicalizeRead(Access read, CanonicalizerTool tool) {
         MetaAccessProvider runtime = tool.runtime();
-        if (runtime != null && read.object() != null && read.object().isConstant()/*
-                                                                                   * &&
-                                                                                   * read.object()
-                                                                                   * .kind() ==
-                                                                                   * Kind.Object
-                                                                                   */) {
+        if (runtime != null && read.object() != null && read.object().isConstant()) {
             if (read.location().locationIdentity() == LocationNode.FINAL_LOCATION && read.location().getClass() == LocationNode.class) {
                 long displacement = read.location().displacement();
                 Kind kind = read.location().getValueKind();
                 if (read.object().kind() == Kind.Object) {
                     Object base = read.object().asConstant().asObject();
                     if (base != null) {
-                        Constant constant = readUnsafeConstant(kind, base, displacement);
-                        return ConstantNode.forConstant(constant, runtime, read.node().graph());
+                        Constant constant = tool.runtime().readUnsafeConstant(kind, base, displacement);
+                        if (constant != null) {
+                            return ConstantNode.forConstant(constant, runtime, read.node().graph());
+                        }
                     }
                 } else if (read.object().kind() == Kind.Long || read.object().kind().getStackKind() == Kind.Int) {
                     long base = read.object().asConstant().asLong();
                     if (base != 0L) {
-                        Constant constant = readUnsafeConstant(kind, null, base + displacement);
-                        return ConstantNode.forConstant(constant, runtime, read.node().graph());
+                        Constant constant = tool.runtime().readUnsafeConstant(kind, null, base + displacement);
+                        if (constant != null) {
+                            return ConstantNode.forConstant(constant, runtime, read.node().graph());
+                        }
                     }
                 }
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -35,7 +35,6 @@
 public abstract class SwitchNode extends ControlSplitNode {
 
     @Successor protected final NodeSuccessorList<BeginNode> successors;
-    protected double[] successorProbabilities;
     @Input private ValueNode value;
     private double[] keyProbabilities;
     private int[] keySuccessors;
@@ -46,9 +45,8 @@
      * @param value the instruction that provides the value to be switched over
      * @param successors the list of successors of this switch
      */
-    public SwitchNode(ValueNode value, BeginNode[] successors, double[] successorProbabilities, int[] keySuccessors, double[] keyProbabilities) {
+    public SwitchNode(ValueNode value, BeginNode[] successors, int[] keySuccessors, double[] keyProbabilities) {
         super(StampFactory.forVoid());
-        this.successorProbabilities = successorProbabilities;
         assert keySuccessors.length == keyProbabilities.length;
         this.successors = new NodeSuccessorList<>(this, successors);
         this.value = value;
@@ -59,9 +57,9 @@
     @Override
     public double probability(BeginNode successor) {
         double sum = 0;
-        for (int i = 0; i < successors.size(); i++) {
-            if (successors.get(i) == successor) {
-                sum += successorProbabilities[i];
+        for (int i = 0; i < keySuccessors.length; i++) {
+            if (successors.get(keySuccessors[i]) == successor) {
+                sum += keyProbabilities[i];
             }
         }
         return sum;
@@ -133,23 +131,9 @@
         return defaultSuccessorIndex() == -1 ? null : successors.get(defaultSuccessorIndex());
     }
 
-    /**
-     * Helper function that sums up the probabilities of all keys that lead to a specific successor.
-     * 
-     * @return an array of size successorCount with the accumulated probability for each successor.
-     */
-    public static double[] successorProbabilites(int successorCount, int[] keySuccessors, double[] keyProbabilities) {
-        double[] probability = new double[successorCount];
-        for (int i = 0; i < keySuccessors.length; i++) {
-            probability[keySuccessors[i]] += keyProbabilities[i];
-        }
-        return probability;
-    }
-
     @Override
     public SwitchNode clone(Graph into) {
         SwitchNode newSwitch = (SwitchNode) super.clone(into);
-        newSwitch.successorProbabilities = Arrays.copyOf(successorProbabilities, successorProbabilities.length);
         newSwitch.keyProbabilities = Arrays.copyOf(keyProbabilities, keyProbabilities.length);
         newSwitch.keySuccessors = Arrays.copyOf(keySuccessors, keySuccessors.length);
         return newSwitch;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -131,10 +131,6 @@
         return this;
     }
 
-    public JavaType returnType() {
-        return returnType;
-    }
-
     @Override
     public Stamp returnStamp() {
         Kind returnKind = targetMethod.getSignature().getReturnKind();
@@ -145,6 +141,10 @@
         }
     }
 
+    public JavaType returnType() {
+        return returnType;
+    }
+
     @Override
     public String targetName() {
         if (targetMethod() == null) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -23,15 +23,16 @@
 package com.oracle.graal.nodes.java;
 
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
 
 /**
- * The {@code NewArrayNode} class is the base of all instructions that allocate arrays.
+ * The {@code NewArrayNode} is used for all 1-dimensional array allocations.
  */
-public abstract class NewArrayNode extends FixedWithNextNode implements Canonicalizable, Lowerable, VirtualizableAllocation, ArrayLengthProvider {
+public class NewArrayNode extends FixedWithNextNode implements Canonicalizable, Lowerable, VirtualizableAllocation, ArrayLengthProvider, Node.IterableNodeType {
 
     @Input private ValueNode length;
     private final ResolvedJavaType elementType;
@@ -53,7 +54,7 @@
      * @param fillContents determines whether the array elements should be initialized to zero/null.
      * @param locked determines whether the array should be locked immediately.
      */
-    protected NewArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents, boolean locked) {
+    public NewArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents, boolean locked) {
         super(StampFactory.exactNonNull(elementType.getArrayClass()));
         this.length = length;
         this.elementType = elementType;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 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.java;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.*;
-
-/**
- * The {@code NewObjectArrayNode} represents an allocation of an object array.
- */
-@NodeInfo(nameTemplate = "NewArray {p#elementType}")
-public final class NewObjectArrayNode extends NewArrayNode implements Node.IterableNodeType {
-
-    /**
-     * Constructs a new NewObjectArrayNode.
-     * 
-     * @param elementClass the class of elements in this array
-     * @param length the node producing the length of the array
-     * @param fillContents determines whether the array elements should be initialized to null.
-     * @param locked determines whether the array should be locked immediately.
-     */
-    public NewObjectArrayNode(ResolvedJavaType elementClass, ValueNode length, boolean fillContents, boolean locked) {
-        super(elementClass, length, fillContents, locked);
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, 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.java;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.*;
-
-/**
- * The {@code NewPrimitiveArrayNode} class definition.
- */
-@NodeInfo(nameTemplate = "NewArray {p#elementType}")
-public final class NewPrimitiveArrayNode extends NewArrayNode implements Node.IterableNodeType {
-
-    /**
-     * Constructs a new NewPrimitiveArrayNode.
-     * 
-     * @param elementType the type of elements in this array
-     * @param length the node producing the length of the array
-     * @param fillContents determines whether the array elements should be initialized to zero.
-     * @param locked determines whether the array should be locked immediately.
-     */
-    public NewPrimitiveArrayNode(ResolvedJavaType elementType, ValueNode length, boolean fillContents, boolean locked) {
-        super(elementType, length, fillContents, locked);
-    }
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -44,14 +44,14 @@
      * Constructs a type switch instruction. The keyProbabilities array contain key.length + 1
      * entries. The last entry in every array describes the default case.
      * 
-     * @param value the instruction producing the value being switched on
+     * @param value the instruction producing the value being switched on, the object hub
      * @param successors the list of successors
      * @param keys the list of types
      * @param keyProbabilities the probabilities of the keys
      * @param keySuccessors the successor index for each key
      */
-    public TypeSwitchNode(ValueNode value, BeginNode[] successors, double[] successorProbabilities, ResolvedJavaType[] keys, double[] keyProbabilities, int[] keySuccessors) {
-        super(value, successors, successorProbabilities, keySuccessors, keyProbabilities);
+    public TypeSwitchNode(ValueNode value, BeginNode[] successors, ResolvedJavaType[] keys, double[] keyProbabilities, int[] keySuccessors) {
+        super(value, successors, keySuccessors, keyProbabilities);
         assert successors.length <= keys.length + 1;
         assert keySuccessors.length == keyProbabilities.length;
         this.keys = keys;
@@ -63,8 +63,12 @@
     }
 
     @Override
-    public Constant keyAt(int i) {
-        return keys[i].getEncoding(Representation.ObjectHub);
+    public Constant keyAt(int index) {
+        return keys[index].getEncoding(Representation.ObjectHub);
+    }
+
+    public ResolvedJavaType typeAt(int index) {
+        return keys[index];
     }
 
     @Override
@@ -134,8 +138,6 @@
                         }
                     }
 
-                    double[] newSuccessorProbabilities = successorProbabilites(newSuccessors.size(), newKeySuccessors, newKeyProbabilities);
-
                     for (int i = 0; i < blockSuccessorCount(); i++) {
                         BeginNode successor = blockSuccessor(i);
                         if (!newSuccessors.contains(successor)) {
@@ -145,7 +147,7 @@
                     }
 
                     BeginNode[] successorsArray = newSuccessors.toArray(new BeginNode[newSuccessors.size()]);
-                    TypeSwitchNode newSwitch = graph().add(new TypeSwitchNode(value(), successorsArray, newSuccessorProbabilities, newKeys, newKeyProbabilities, newKeySuccessors));
+                    TypeSwitchNode newSwitch = graph().add(new TypeSwitchNode(value(), successorsArray, newKeys, newKeyProbabilities, newKeySuccessors));
                     ((FixedWithNextNode) predecessor()).setNext(newSwitch);
                     GraphUtil.killWithUnusedFloatingInputs(this);
                 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Tue Feb 05 15:27:40 2013 +0100
@@ -123,6 +123,7 @@
 
         for (Node n : workList) {
             processNode(n, graph);
+            Debug.dump(graph, "After processing %s", n);
         }
 
         graph.stopTrackingInputChange();
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ComputeProbabilityPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ComputeProbabilityPhase.java	Tue Feb 05 15:27:40 2013 +0100
@@ -60,63 +60,9 @@
         computeLoopFactors();
         Debug.dump(graph, "After computeLoopFactors");
         new PropagateLoopFrequency(graph.start()).apply();
-
-        if (GraalOptions.LoopFrequencyPropagationPolicy < 0) {
-            ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, true, false, false);
-            BitSet visitedBlocks = new BitSet(cfg.getBlocks().length);
-            for (Loop loop : cfg.getLoops()) {
-                if (loop.parent == null) {
-                    correctLoopFrequencies(loop, 1, visitedBlocks);
-                }
-            }
-        }
-
         new ComputeInliningRelevanceIterator(graph).apply();
     }
 
-    private void correctLoopFrequencies(Loop loop, double parentFrequency, BitSet visitedBlocks) {
-        LoopBeginNode loopBegin = ((LoopBeginNode) loop.header.getBeginNode());
-        double frequency = parentFrequency * loopBegin.loopFrequency();
-        if (frequency < 1) {
-            frequency = 1;
-        }
-        for (Loop child : loop.children) {
-            correctLoopFrequencies(child, frequency, visitedBlocks);
-        }
-
-        double factor = getCorrectionFactor(loopBegin.probability(), frequency);
-        for (Block block : loop.blocks) {
-            int blockId = block.getId();
-            if (!visitedBlocks.get(blockId)) {
-                visitedBlocks.set(blockId);
-
-                FixedNode node = block.getBeginNode();
-                while (node != block.getEndNode()) {
-                    node.setProbability(node.probability() * factor);
-                    node = ((FixedWithNextNode) node).next();
-                }
-                node.setProbability(node.probability() * factor);
-            }
-        }
-    }
-
-    private static double getCorrectionFactor(double probability, double frequency) {
-        switch (GraalOptions.LoopFrequencyPropagationPolicy) {
-            case -1:
-                return 1 / frequency;
-            case -2:
-                return (1 / frequency) * (Math.log(Math.E + frequency) - 1);
-            case -3:
-                double originalProbability = probability / frequency;
-                assert isRelativeProbability(originalProbability);
-                return (1 / frequency) * Math.max(1, Math.pow(originalProbability, 1.5) * Math.log10(frequency));
-            case -4:
-                return 1 / probability;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-
     private void computeLoopFactors() {
         for (LoopInfo info : loopInfos) {
             double frequency = info.loopFrequency();
@@ -330,124 +276,184 @@
 
     private class PropagateLoopFrequency extends PostOrderNodeIterator<LoopCount> {
 
-        private final FrequencyPropagationPolicy policy;
-
         public PropagateLoopFrequency(FixedNode start) {
             super(start, new LoopCount(1d));
-            this.policy = createFrequencyPropagationPolicy();
         }
 
         @Override
         protected void node(FixedNode node) {
-            node.setProbability(policy.compute(node.probability(), state.count));
+            node.setProbability(node.probability() * state.count);
         }
 
     }
 
-    private static FrequencyPropagationPolicy createFrequencyPropagationPolicy() {
-        switch (GraalOptions.LoopFrequencyPropagationPolicy) {
-            case -4:
-            case -3:
-            case -2:
-            case -1:
-            case 0:
-                return new FullFrequencyPropagation();
-            case 1:
-                return new NoFrequencyPropagation();
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-
-    private interface FrequencyPropagationPolicy {
-
-        double compute(double probability, double frequency);
-    }
-
-    private static class FullFrequencyPropagation implements FrequencyPropagationPolicy {
-
-        @Override
-        public double compute(double probability, double frequency) {
-            return probability * frequency;
-        }
-    }
-
-    private static class NoFrequencyPropagation implements FrequencyPropagationPolicy {
-
-        @Override
-        public double compute(double probability, double frequency) {
-            return probability;
-        }
-    }
-
     private static class ComputeInliningRelevanceIterator extends ScopedPostOrderNodeIterator {
 
-        private final HashMap<FixedNode, Double> lowestPathProbabilities;
+        private final HashMap<FixedNode, Scope> scopes;
         private double currentProbability;
+        private double parentRelevance;
 
         public ComputeInliningRelevanceIterator(StructuredGraph graph) {
             super(graph);
-            this.lowestPathProbabilities = computeLowestPathProbabilities(graph);
+            this.scopes = computeLowestPathProbabilities(computeScopeInformation(graph));
         }
 
         @Override
         protected void initializeScope() {
-            currentProbability = lowestPathProbabilities.get(currentScope);
+            Scope scope = scopes.get(currentScopeStart);
+            parentRelevance = getParentScopeRelevance(scope);
+            currentProbability = scope.minPathProbability;
+        }
+
+        private static double getParentScopeRelevance(Scope scope) {
+            if (scope.start instanceof LoopBeginNode) {
+                assert scope.parent != null;
+                double parentProbability = 0;
+                for (EndNode end : ((LoopBeginNode) scope.start).forwardEnds()) {
+                    parentProbability += end.probability();
+                }
+                return parentProbability / scope.parent.minPathProbability;
+            } else {
+                assert scope.parent == null;
+                return 1.0;
+            }
         }
 
         @Override
         protected void invoke(Invoke invoke) {
             assert !Double.isNaN(invoke.probability());
-            invoke.setInliningRelevance(invoke.probability() / currentProbability);
+            invoke.setInliningRelevance((invoke.probability() / currentProbability) * Math.min(1.0, parentRelevance));
+            assert !Double.isNaN(invoke.inliningRelevance());
         }
 
-        private HashMap<FixedNode, Double> computeLowestPathProbabilities(StructuredGraph graph) {
-            HashMap<FixedNode, Double> result = new HashMap<>();
-            Deque<FixedNode> scopes = getScopes(graph);
+        private static Scope[] computeScopeInformation(StructuredGraph graph) {
+            ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, true, false, false);
+
+            Loop[] loops = cfg.getLoops();
+            HashMap<Loop, Scope> processedScopes = new HashMap<>();
+            Scope[] scopes = new Scope[loops.length + 1];
+            Scope methodScope = new Scope(graph.start(), null);
+            processedScopes.put(null, methodScope);
+
+            scopes[0] = methodScope;
+            for (int i = 0; i < loops.length; i++) {
+                scopes[i + 1] = createScope(loops[i], processedScopes);
+            }
+
+            return scopes;
+        }
 
-            while (!scopes.isEmpty()) {
-                FixedNode scopeBegin = scopes.pop();
-                double probability = computeLowestPathProbability(scopeBegin);
-                result.put(scopeBegin, probability);
+        private static Scope createScope(Loop loop, HashMap<Loop, Scope> processedLoops) {
+            Scope parent = processedLoops.get(loop.parent);
+            if (parent == null) {
+                parent = createScope(loop, processedLoops);
+            }
+            Scope result = new Scope(loop.loopBegin(), parent);
+            processedLoops.put(loop, result);
+            return result;
+        }
+
+        private static HashMap<FixedNode, Scope> computeLowestPathProbabilities(Scope[] scopes) {
+            HashMap<FixedNode, Scope> result = new HashMap<>();
+
+            for (Scope scope : scopes) {
+                double lowestPathProbability = computeLowestPathProbability(scope);
+                scope.minPathProbability = Math.max(EPSILON, lowestPathProbability);
+                result.put(scope.start, scope);
             }
 
             return result;
         }
 
-        private static double computeLowestPathProbability(FixedNode scopeStart) {
+        private static double computeLowestPathProbability(Scope scope) {
+            FixedNode scopeStart = scope.start;
+            ArrayList<FixedNode> pathBeginNodes = new ArrayList<>();
+            pathBeginNodes.add(scopeStart);
             double minPathProbability = scopeStart.probability();
-            Node current = scopeStart;
+            boolean isLoopScope = scopeStart instanceof LoopBeginNode;
 
-            while (current != null) {
-                if (current instanceof ControlSplitNode) {
-                    ControlSplitNode controlSplit = (ControlSplitNode) current;
-                    current = getMaxProbabilitySux(controlSplit);
-                    if (((FixedNode) current).probability() < minPathProbability) {
-                        minPathProbability = ((FixedNode) current).probability();
+            do {
+                Node current = pathBeginNodes.remove(pathBeginNodes.size() - 1);
+                do {
+                    if (isLoopScope && current instanceof LoopExitNode && ((LoopBeginNode) scopeStart).loopExits().contains((LoopExitNode) current)) {
+                        return minPathProbability;
+                    } else if (current instanceof LoopBeginNode && current != scopeStart) {
+                        current = getMaxProbabilityLoopExit((LoopBeginNode) current, pathBeginNodes);
+                        minPathProbability = getMinPathProbability((FixedNode) current, minPathProbability);
+                    } else if (current instanceof ControlSplitNode) {
+                        current = getMaxProbabilitySux((ControlSplitNode) current, pathBeginNodes);
+                        minPathProbability = getMinPathProbability((FixedNode) current, minPathProbability);
+                    } else {
+                        assert current.successors().count() <= 1;
+                        current = current.successors().first();
                     }
-                } else {
-                    assert current.successors().count() <= 1;
-                    current = current.successors().first();
-                }
-            }
+                } while (current != null);
+            } while (!pathBeginNodes.isEmpty());
 
             return minPathProbability;
         }
 
-        private static Node getMaxProbabilitySux(ControlSplitNode controlSplit) {
+        private static double getMinPathProbability(FixedNode current, double minPathProbability) {
+            if (current != null && current.probability() < minPathProbability) {
+                return current.probability();
+            }
+            return minPathProbability;
+        }
+
+        private static Node getMaxProbabilitySux(ControlSplitNode controlSplit, ArrayList<FixedNode> pathBeginNodes) {
             Node maxSux = null;
             double maxProbability = 0.0;
+            int pathBeginCount = pathBeginNodes.size();
 
-            // TODO: process recursively if we have multiple successors with same probability
             for (Node sux : controlSplit.successors()) {
                 double probability = controlSplit.probability((BeginNode) sux);
                 if (probability > maxProbability) {
                     maxProbability = probability;
                     maxSux = sux;
+                    truncate(pathBeginNodes, pathBeginCount);
+                } else if (probability == maxProbability) {
+                    pathBeginNodes.add((FixedNode) sux);
                 }
             }
 
             return maxSux;
         }
+
+        private static Node getMaxProbabilityLoopExit(LoopBeginNode loopBegin, ArrayList<FixedNode> pathBeginNodes) {
+            Node maxSux = null;
+            double maxProbability = 0.0;
+            int pathBeginCount = pathBeginNodes.size();
+
+            for (LoopExitNode sux : loopBegin.loopExits()) {
+                double probability = sux.probability();
+                if (probability > maxProbability) {
+                    maxProbability = probability;
+                    maxSux = sux;
+                    truncate(pathBeginNodes, pathBeginCount);
+                } else if (probability == maxProbability) {
+                    pathBeginNodes.add(sux);
+                }
+            }
+
+            return maxSux;
+        }
+
+        public static void truncate(ArrayList<FixedNode> pathBeginNodes, int pathBeginCount) {
+            for (int i = pathBeginNodes.size() - pathBeginCount; i > 0; i--) {
+                pathBeginNodes.remove(pathBeginNodes.size() - 1);
+            }
+        }
+    }
+
+    private static class Scope {
+
+        public final FixedNode start;
+        public final Scope parent;
+        public double minPathProbability;
+
+        public Scope(FixedNode start, Scope parent) {
+            this.start = start;
+            this.parent = parent;
+        }
     }
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Tue Feb 05 15:27:40 2013 +0100
@@ -30,6 +30,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.PhiNode.PhiType;
 import com.oracle.graal.nodes.calc.*;
+import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
@@ -38,16 +39,24 @@
 
 public class ConditionalEliminationPhase extends Phase {
 
-    private static final DebugMetric metricInstanceOfRegistered = Debug.metric("InstanceOfRegistered");
-    private static final DebugMetric metricNullCheckRegistered = Debug.metric("NullCheckRegistered");
+    private static final DebugMetric metricConditionRegistered = Debug.metric("ConditionRegistered");
+    private static final DebugMetric metricTypeRegistered = Debug.metric("TypeRegistered");
+    private static final DebugMetric metricNullnessRegistered = Debug.metric("NullnessRegistered");
+    private static final DebugMetric metricObjectEqualsRegistered = Debug.metric("ObjectEqualsRegistered");
     private static final DebugMetric metricCheckCastRemoved = Debug.metric("CheckCastRemoved");
     private static final DebugMetric metricInstanceOfRemoved = Debug.metric("InstanceOfRemoved");
     private static final DebugMetric metricNullCheckRemoved = Debug.metric("NullCheckRemoved");
-    private static final DebugMetric metricNullCheckGuardRemoved = Debug.metric("NullCheckGuardRemoved");
-    private static final DebugMetric metricGuardsReplaced = Debug.metric("GuardsReplaced");
+    private static final DebugMetric metricObjectEqualsRemoved = Debug.metric("ObjectEqualsRemoved");
+    private static final DebugMetric metricGuardsRemoved = Debug.metric("GuardsRemoved");
+
+    private final MetaAccessProvider metaAccessProvider;
 
     private StructuredGraph graph;
 
+    public ConditionalEliminationPhase(MetaAccessProvider metaAccessProvider) {
+        this.metaAccessProvider = metaAccessProvider;
+    }
+
     @Override
     protected void run(StructuredGraph inputGraph) {
         graph = inputGraph;
@@ -57,14 +66,14 @@
     public static class State implements MergeableState<State> {
 
         private IdentityHashMap<ValueNode, ResolvedJavaType> knownTypes;
-        private HashSet<ValueNode> knownNotNull;
+        private HashSet<ValueNode> knownNonNull;
         private HashSet<ValueNode> knownNull;
         private IdentityHashMap<BooleanNode, ValueNode> trueConditions;
         private IdentityHashMap<BooleanNode, ValueNode> falseConditions;
 
         public State() {
             this.knownTypes = new IdentityHashMap<>();
-            this.knownNotNull = new HashSet<>();
+            this.knownNonNull = new HashSet<>();
             this.knownNull = new HashSet<>();
             this.trueConditions = new IdentityHashMap<>();
             this.falseConditions = new IdentityHashMap<>();
@@ -72,7 +81,7 @@
 
         public State(State other) {
             this.knownTypes = new IdentityHashMap<>(other.knownTypes);
-            this.knownNotNull = new HashSet<>(other.knownNotNull);
+            this.knownNonNull = new HashSet<>(other.knownNonNull);
             this.knownNull = new HashSet<>(other.knownNull);
             this.trueConditions = new IdentityHashMap<>(other.trueConditions);
             this.falseConditions = new IdentityHashMap<>(other.falseConditions);
@@ -81,11 +90,16 @@
         @Override
         public boolean merge(MergeNode merge, List<State> withStates) {
             IdentityHashMap<ValueNode, ResolvedJavaType> newKnownTypes = new IdentityHashMap<>();
-            HashSet<ValueNode> newKnownNotNull = new HashSet<>();
-            HashSet<ValueNode> newKnownNull = new HashSet<>();
             IdentityHashMap<BooleanNode, ValueNode> newTrueConditions = new IdentityHashMap<>();
             IdentityHashMap<BooleanNode, ValueNode> newFalseConditions = new IdentityHashMap<>();
 
+            HashSet<ValueNode> newKnownNull = new HashSet<>(knownNull);
+            HashSet<ValueNode> newKnownNonNull = new HashSet<>(knownNonNull);
+            for (State state : withStates) {
+                newKnownNull.retainAll(state.knownNull);
+                newKnownNonNull.retainAll(state.knownNonNull);
+            }
+
             for (Map.Entry<ValueNode, ResolvedJavaType> entry : knownTypes.entrySet()) {
                 ValueNode node = entry.getKey();
                 ResolvedJavaType type = entry.getValue();
@@ -101,30 +115,7 @@
                     newKnownTypes.put(node, type);
                 }
             }
-            for (ValueNode node : knownNotNull) {
-                boolean notNull = true;
-                for (State other : withStates) {
-                    if (!other.knownNotNull.contains(node)) {
-                        notNull = false;
-                        break;
-                    }
-                }
-                if (notNull) {
-                    newKnownNotNull.add(node);
-                }
-            }
-            for (ValueNode node : knownNull) {
-                boolean isNull = true;
-                for (State other : withStates) {
-                    if (!other.knownNull.contains(node)) {
-                        isNull = false;
-                        break;
-                    }
-                }
-                if (isNull) {
-                    newKnownNull.add(node);
-                }
-            }
+
             for (Map.Entry<BooleanNode, ValueNode> entry : trueConditions.entrySet()) {
                 BooleanNode check = entry.getKey();
                 ValueNode guard = entry.getValue();
@@ -162,14 +153,13 @@
                 }
             }
 
-            // this piece of code handles phis (merges the types and knownNull/knownNotNull of the
-            // values)
+            // this piece of code handles phis
             if (!(merge instanceof LoopBeginNode)) {
                 for (PhiNode phi : merge.phis()) {
                     if (phi.type() == PhiType.Value && phi.kind() == Kind.Object) {
                         ValueNode firstValue = phi.valueAt(0);
                         ResolvedJavaType type = getNodeType(firstValue);
-                        boolean notNull = knownNotNull.contains(firstValue);
+                        boolean nonNull = knownNonNull.contains(firstValue);
                         boolean isNull = knownNull.contains(firstValue);
 
                         for (int i = 0; i < withStates.size(); i++) {
@@ -177,14 +167,14 @@
                             ValueNode value = phi.valueAt(i + 1);
                             ResolvedJavaType otherType = otherState.getNodeType(value);
                             type = widen(type, otherType);
-                            notNull &= otherState.knownNotNull.contains(value);
+                            nonNull &= otherState.knownNonNull.contains(value);
                             isNull &= otherState.knownNull.contains(value);
                         }
                         if (type != null) {
                             newKnownTypes.put(phi, type);
                         }
-                        if (notNull) {
-                            newKnownNotNull.add(phi);
+                        if (nonNull) {
+                            newKnownNonNull.add(phi);
                         }
                         if (isNull) {
                             newKnownNull.add(phi);
@@ -194,7 +184,7 @@
             }
 
             this.knownTypes = newKnownTypes;
-            this.knownNotNull = newKnownNotNull;
+            this.knownNonNull = newKnownNonNull;
             this.knownNull = newKnownNull;
             this.trueConditions = newTrueConditions;
             this.falseConditions = newFalseConditions;
@@ -206,6 +196,14 @@
             return result == null ? node.objectStamp().type() : result;
         }
 
+        public boolean isNull(ValueNode value) {
+            return value.objectStamp().alwaysNull() || knownNull.contains(value);
+        }
+
+        public boolean isNonNull(ValueNode value) {
+            return value.objectStamp().nonNull() || knownNonNull.contains(value);
+        }
+
         @Override
         public void loopBegin(LoopBeginNode loopBegin) {
         }
@@ -222,6 +220,52 @@
         public State clone() {
             return new State(this);
         }
+
+        /**
+         * Adds information about a condition. If isTrue is true then the condition is known to
+         * hold, otherwise the condition is known not to hold.
+         */
+        public void addCondition(boolean isTrue, BooleanNode condition, ValueNode anchor) {
+            if (isTrue) {
+                if (!trueConditions.containsKey(condition)) {
+                    trueConditions.put(condition, anchor);
+                    metricConditionRegistered.increment();
+                }
+            } else {
+                if (!falseConditions.containsKey(condition)) {
+                    falseConditions.put(condition, anchor);
+                    metricConditionRegistered.increment();
+                }
+            }
+        }
+
+        /**
+         * Adds information about the nullness of a value. If isNull is true then the value is known
+         * to be null, otherwise the value is known to be non-null.
+         */
+        public void addNullness(boolean isNull, ValueNode value) {
+            if (isNull) {
+                if (!isNull(value)) {
+                    metricNullnessRegistered.increment();
+                    knownNull.add(value);
+                }
+            } else {
+                if (!isNonNull(value)) {
+                    metricNullnessRegistered.increment();
+                    knownNonNull.add(value);
+                }
+            }
+        }
+
+        public void addType(ResolvedJavaType type, ValueNode value) {
+            ResolvedJavaType knownType = getNodeType(value);
+            ResolvedJavaType newType = tighten(type, knownType);
+
+            if (newType != knownType) {
+                knownTypes.put(value, newType);
+                metricTypeRegistered.increment();
+            }
+        }
     }
 
     public static ResolvedJavaType widen(ResolvedJavaType a, ResolvedJavaType b) {
@@ -241,8 +285,6 @@
             return a;
         } else if (a == b) {
             return a;
-        } else if (b.isAssignableFrom(a)) {
-            return a;
         } else if (a.isAssignableFrom(b)) {
             return b;
         } else {
@@ -252,131 +294,219 @@
 
     public class ConditionalElimination extends PostOrderNodeIterator<State> {
 
-        private BeginNode lastBegin = null;
+        private final BooleanNode trueConstant;
+        private final BooleanNode falseConstant;
 
         public ConditionalElimination(FixedNode start, State initialState) {
             super(start, initialState);
+            this.trueConstant = ConstantNode.forBoolean(true, graph);
+            this.falseConstant = ConstantNode.forBoolean(false, graph);
+        }
+
+        private void registerCondition(boolean isTrue, BooleanNode condition, ValueNode anchor) {
+            state.addCondition(isTrue, condition, anchor);
+
+            if (isTrue && condition instanceof InstanceOfNode) {
+                InstanceOfNode instanceOf = (InstanceOfNode) condition;
+                ValueNode object = instanceOf.object();
+                state.addNullness(false, object);
+                state.addType(instanceOf.type(), object);
+            } else if (condition instanceof IsNullNode) {
+                IsNullNode nullCheck = (IsNullNode) condition;
+                state.addNullness(isTrue, nullCheck.object());
+            } else if (condition instanceof ObjectEqualsNode) {
+                ObjectEqualsNode equals = (ObjectEqualsNode) condition;
+                ValueNode x = equals.x();
+                ValueNode y = equals.y();
+                if (isTrue) {
+                    if (state.isNull(x) && !state.isNull(y)) {
+                        metricObjectEqualsRegistered.increment();
+                        state.addNullness(true, y);
+                    } else if (!state.isNull(x) && state.isNull(y)) {
+                        metricObjectEqualsRegistered.increment();
+                        state.addNullness(true, x);
+                    }
+                    if (state.isNonNull(x) && !state.isNonNull(y)) {
+                        metricObjectEqualsRegistered.increment();
+                        state.addNullness(false, y);
+                    } else if (!state.isNonNull(x) && state.isNonNull(y)) {
+                        metricObjectEqualsRegistered.increment();
+                        state.addNullness(false, x);
+                    }
+                } else {
+                    if (state.isNull(x) && !state.isNonNull(y)) {
+                        metricObjectEqualsRegistered.increment();
+                        state.addNullness(true, y);
+                    } else if (!state.isNonNull(x) && state.isNull(y)) {
+                        metricObjectEqualsRegistered.increment();
+                        state.addNullness(true, x);
+                    }
+                }
+            }
+        }
+
+        private void registerControlSplitInfo(Node pred, BeginNode begin) {
+            assert pred != null && begin != null;
+
+            if (pred instanceof IfNode) {
+                IfNode ifNode = (IfNode) pred;
+
+                if (!(ifNode.condition() instanceof ConstantNode)) {
+                    registerCondition(begin == ifNode.trueSuccessor(), ifNode.condition(), begin);
+                }
+            } else if (pred instanceof TypeSwitchNode) {
+                TypeSwitchNode typeSwitch = (TypeSwitchNode) pred;
+
+                if (typeSwitch.value() instanceof LoadHubNode) {
+                    LoadHubNode loadHub = (LoadHubNode) typeSwitch.value();
+                    ResolvedJavaType type = null;
+                    for (int i = 0; i < typeSwitch.keyCount(); i++) {
+                        if (typeSwitch.keySuccessor(i) == begin) {
+                            if (type == null) {
+                                type = typeSwitch.typeAt(i);
+                            } else {
+                                type = widen(type, typeSwitch.typeAt(i));
+                            }
+                        }
+                    }
+                    if (type != null) {
+                        state.addNullness(false, loadHub.object());
+                        state.addType(type, loadHub.object());
+                    }
+                }
+            }
+        }
+
+        private void registerGuard(GuardNode guard) {
+            BooleanNode condition = guard.condition();
+
+            ValueNode existingGuards = guard.negated() ? state.falseConditions.get(condition) : state.trueConditions.get(condition);
+            if (existingGuards != null) {
+                guard.replaceAtUsages(existingGuards);
+                GraphUtil.killWithUnusedFloatingInputs(guard);
+                metricGuardsRemoved.increment();
+            } else {
+                BooleanNode replacement = evaluateCondition(condition, trueConstant, falseConstant);
+                if (replacement != null) {
+                    guard.setCondition(replacement);
+                    if (condition.usages().isEmpty()) {
+                        GraphUtil.killWithUnusedFloatingInputs(condition);
+                    }
+                    metricGuardsRemoved.increment();
+                } else {
+                    registerCondition(!guard.negated(), condition, guard);
+                }
+            }
+        }
+
+        /**
+         * Determines if, at the current point in the control flow, the condition is known to be
+         * true, false or unknown. In case of true or false the corresponding value is returned,
+         * otherwise null.
+         */
+        private <T extends ValueNode> T evaluateCondition(BooleanNode condition, T trueValue, T falseValue) {
+            if (state.trueConditions.containsKey(condition)) {
+                return trueValue;
+            } else if (state.falseConditions.containsKey(condition)) {
+                return falseValue;
+            } else {
+                if (condition instanceof InstanceOfNode) {
+                    InstanceOfNode instanceOf = (InstanceOfNode) condition;
+                    ValueNode object = instanceOf.object();
+                    if (state.isNull(object)) {
+                        metricInstanceOfRemoved.increment();
+                        return falseValue;
+                    } else if (state.isNonNull(object)) {
+                        ResolvedJavaType type = state.getNodeType(object);
+                        if (type != null && instanceOf.type().isAssignableFrom(type)) {
+                            metricInstanceOfRemoved.increment();
+                            return trueValue;
+                        }
+                    }
+                } else if (condition instanceof IsNullNode) {
+                    IsNullNode isNull = (IsNullNode) condition;
+                    ValueNode object = isNull.object();
+                    if (state.isNull(object)) {
+                        metricNullCheckRemoved.increment();
+                        return trueValue;
+                    } else if (state.isNonNull(object)) {
+                        metricNullCheckRemoved.increment();
+                        return falseValue;
+                    }
+                } else if (condition instanceof ObjectEqualsNode) {
+                    ObjectEqualsNode equals = (ObjectEqualsNode) condition;
+                    ValueNode x = equals.x();
+                    ValueNode y = equals.y();
+                    if (state.isNull(x) && state.isNonNull(y) || state.isNonNull(x) && state.isNull(y)) {
+                        metricObjectEqualsRemoved.increment();
+                        return falseValue;
+                    } else if (state.isNull(x) && state.isNull(y)) {
+                        metricObjectEqualsRemoved.increment();
+                        return trueValue;
+                    }
+                }
+            }
+            return null;
         }
 
         @Override
         protected void node(FixedNode node) {
             if (node instanceof BeginNode) {
                 BeginNode begin = (BeginNode) node;
-                lastBegin = begin;
                 Node pred = node.predecessor();
-                if (pred != null && pred instanceof IfNode) {
-                    IfNode ifNode = (IfNode) pred;
-                    if (!(ifNode.condition() instanceof ConstantNode)) {
-                        boolean isTrue = (node == ifNode.trueSuccessor());
-                        if (isTrue) {
-                            state.trueConditions.put(ifNode.condition(), begin);
-                        } else {
-                            state.falseConditions.put(ifNode.condition(), begin);
-                        }
-                    }
-                    if (ifNode.condition() instanceof InstanceOfNode) {
-                        InstanceOfNode instanceOf = (InstanceOfNode) ifNode.condition();
-                        if ((node == ifNode.trueSuccessor())) {
-                            ValueNode object = instanceOf.object();
-                            state.knownNotNull.add(object);
-                            state.knownTypes.put(object, tighten(instanceOf.type(), state.getNodeType(object)));
-                            metricInstanceOfRegistered.increment();
-                        }
-                    } else if (ifNode.condition() instanceof IsNullNode) {
-                        IsNullNode nullCheck = (IsNullNode) ifNode.condition();
-                        boolean isNull = (node == ifNode.trueSuccessor());
-                        if (isNull) {
-                            state.knownNull.add(nullCheck.object());
-                        } else {
-                            state.knownNotNull.add(nullCheck.object());
-                        }
-                        metricNullCheckRegistered.increment();
-                    }
+
+                if (pred != null) {
+                    registerControlSplitInfo(pred, begin);
                 }
                 for (GuardNode guard : begin.guards().snapshot()) {
-                    BooleanNode condition = guard.condition();
-                    ValueNode existingGuards = guard.negated() ? state.falseConditions.get(condition) : state.trueConditions.get(condition);
-                    if (existingGuards != null) {
-                        guard.replaceAtUsages(existingGuards);
-                        GraphUtil.killWithUnusedFloatingInputs(guard);
-                        metricGuardsReplaced.increment();
-                    } else {
-                        boolean removeCheck = false;
-                        if (condition instanceof IsNullNode) {
-                            IsNullNode isNull = (IsNullNode) condition;
-                            if (guard.negated() && state.knownNotNull.contains(isNull.object())) {
-                                removeCheck = true;
-                            } else if (!guard.negated() && state.knownNull.contains(isNull.object())) {
-                                removeCheck = true;
-                            }
-                            if (removeCheck) {
-                                metricNullCheckGuardRemoved.increment();
-                            }
-                        }
-                        if (removeCheck) {
-                            guard.replaceAtUsages(begin);
-                            GraphUtil.killWithUnusedFloatingInputs(guard);
-                        } else {
-                            if (guard.negated()) {
-                                state.falseConditions.put(condition, guard);
-                            } else {
-                                state.trueConditions.put(condition, guard);
-                            }
-                        }
-                    }
+                    registerGuard(guard);
                 }
             } else if (node instanceof CheckCastNode) {
                 CheckCastNode checkCast = (CheckCastNode) node;
-                ResolvedJavaType type = state.getNodeType(checkCast.object());
-                if (type != null && checkCast.type().isAssignableFrom(type)) {
+                ValueNode object = checkCast.object();
+                boolean isNull = state.isNull(object);
+                ResolvedJavaType type = state.getNodeType(object);
+                if (isNull || (type != null && checkCast.type().isAssignableFrom(type))) {
+                    boolean nonNull = state.isNonNull(object);
+                    ValueAnchorNode anchor = graph.add(new ValueAnchorNode());
                     PiNode piNode;
-                    boolean nonNull = state.knownNotNull.contains(checkCast.object());
-                    piNode = graph.unique(new PiNode(checkCast.object(), lastBegin, nonNull ? StampFactory.declaredNonNull(type) : StampFactory.declared(type)));
+                    if (isNull) {
+                        ConstantNode nullObject = ConstantNode.forObject(null, metaAccessProvider, graph);
+                        piNode = graph.unique(new PiNode(nullObject, anchor, StampFactory.forConstant(nullObject.value, metaAccessProvider)));
+                    } else {
+                        piNode = graph.unique(new PiNode(object, anchor, StampFactory.declared(type, nonNull)));
+                    }
                     checkCast.replaceAtUsages(piNode);
-                    graph.removeFixed(checkCast);
+                    graph.replaceFixedWithFixed(checkCast, anchor);
                     metricCheckCastRemoved.increment();
                 }
             } else if (node instanceof IfNode) {
                 IfNode ifNode = (IfNode) node;
-                BooleanNode replaceWith = null;
                 BooleanNode compare = ifNode.condition();
+                BooleanNode replacement = evaluateCondition(compare, trueConstant, falseConstant);
 
-                if (state.trueConditions.containsKey(compare)) {
-                    replaceWith = ConstantNode.forBoolean(true, graph);
-                } else if (state.falseConditions.containsKey(compare)) {
-                    replaceWith = ConstantNode.forBoolean(false, graph);
-                } else {
-                    if (compare instanceof InstanceOfNode) {
-                        InstanceOfNode instanceOf = (InstanceOfNode) compare;
-                        ValueNode object = instanceOf.object();
-                        if (state.knownNull.contains(object)) {
-                            replaceWith = ConstantNode.forBoolean(false, graph);
-                        } else if (state.knownNotNull.contains(object)) {
-                            ResolvedJavaType type = state.getNodeType(object);
-                            if (type != null && instanceOf.type().isAssignableFrom(type)) {
-                                replaceWith = ConstantNode.forBoolean(true, graph);
+                if (replacement != null) {
+                    ifNode.setCondition(replacement);
+                    if (compare.usages().isEmpty()) {
+                        GraphUtil.killWithUnusedFloatingInputs(compare);
+                    }
+                }
+            } else if (node instanceof EndNode) {
+                EndNode endNode = (EndNode) node;
+                for (PhiNode phi : endNode.merge().phis()) {
+                    int index = endNode.merge().phiPredecessorIndex(endNode);
+                    ValueNode value = phi.valueAt(index);
+                    if (value instanceof MaterializeNode) {
+                        MaterializeNode materialize = (MaterializeNode) value;
+                        BooleanNode compare = materialize.condition();
+                        ValueNode replacement = evaluateCondition(compare, materialize.trueValue(), materialize.falseValue());
+
+                        if (replacement != null) {
+                            phi.setValueAt(index, replacement);
+                            if (materialize.usages().isEmpty()) {
+                                GraphUtil.killWithUnusedFloatingInputs(materialize);
                             }
                         }
-                        if (replaceWith != null) {
-                            metricInstanceOfRemoved.increment();
-                        }
-                    } else if (compare instanceof IsNullNode) {
-                        IsNullNode isNull = (IsNullNode) compare;
-                        ValueNode object = isNull.object();
-                        if (state.knownNull.contains(object)) {
-                            replaceWith = ConstantNode.forBoolean(true, graph);
-                        } else if (state.knownNotNull.contains(object)) {
-                            replaceWith = ConstantNode.forBoolean(false, graph);
-                        }
-                        if (replaceWith != null) {
-                            metricNullCheckRemoved.increment();
-                        }
-                    }
-                }
-                if (replaceWith != null) {
-                    ifNode.setCondition(replaceWith);
-                    if (compare.usages().isEmpty()) {
-                        GraphUtil.killWithUnusedFloatingInputs(compare);
                     }
                 }
             }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GlobalValueNumberingPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011, 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.phases.common;
-
-import com.oracle.graal.debug.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.phases.*;
-
-public class GlobalValueNumberingPhase extends Phase {
-
-    public static final DebugMetric metricGlobalValueNumberingHits = Debug.metric("GlobalValueNumberingHits");
-
-    @Override
-    protected void run(StructuredGraph graph) {
-        NodeBitMap visited = graph.createNodeBitMap();
-        for (Node n : graph.getNodes()) {
-            apply(n, visited, graph);
-        }
-    }
-
-    private void apply(Node n, NodeBitMap visited, StructuredGraph compilerGraph) {
-        if (!visited.isMarked(n)) {
-            visited.mark(n);
-            for (Node input : n.inputs()) {
-                apply(input, visited, compilerGraph);
-            }
-            if (n.getNodeClass().valueNumberable()) {
-                Node newNode = compilerGraph.findDuplicate(n);
-                if (newNode != null) {
-                    assert !(n instanceof FixedNode || newNode instanceof FixedNode);
-                    n.replaceAtUsages(newNode);
-                    n.safeDelete();
-                    metricGlobalValueNumberingHits.increment();
-                    Debug.log("GVN applied and new node is %1s", newNode);
-                }
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Tue Feb 05 15:27:40 2013 +0100
@@ -32,9 +32,11 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
-import com.oracle.graal.phases.PhasePlan.*;
+import com.oracle.graal.phases.PhasePlan.PhasePosition;
 import com.oracle.graal.phases.common.CanonicalizerPhase.CustomCanonicalizer;
-import com.oracle.graal.phases.common.InliningUtil.*;
+import com.oracle.graal.phases.common.InliningUtil.InlineInfo;
+import com.oracle.graal.phases.common.InliningUtil.InliningCallback;
+import com.oracle.graal.phases.common.InliningUtil.InliningPolicy;
 
 public class InliningPhase extends Phase implements InliningCallback {
 
@@ -52,6 +54,7 @@
     private final Assumptions assumptions;
     private final GraphCache cache;
     private final InliningPolicy inliningPolicy;
+    private final OptimisticOptimizations optimisticOpts;
     private CustomCanonicalizer customCanonicalizer;
 
     // Metrics
@@ -62,20 +65,22 @@
 
     public InliningPhase(TargetDescription target, GraalCodeCacheProvider runtime, Collection<Invoke> hints, Assumptions assumptions, GraphCache cache, PhasePlan plan,
                     OptimisticOptimizations optimisticOpts) {
-        this(target, runtime, assumptions, cache, plan, createInliningPolicy(assumptions, optimisticOpts, hints));
+        this(target, runtime, assumptions, cache, plan, createInliningPolicy(runtime, assumptions, optimisticOpts, hints), optimisticOpts);
     }
 
     public void setCustomCanonicalizer(CustomCanonicalizer customCanonicalizer) {
         this.customCanonicalizer = customCanonicalizer;
     }
 
-    public InliningPhase(TargetDescription target, GraalCodeCacheProvider runtime, Assumptions assumptions, GraphCache cache, PhasePlan plan, InliningPolicy inliningPolicy) {
+    public InliningPhase(TargetDescription target, GraalCodeCacheProvider runtime, Assumptions assumptions, GraphCache cache, PhasePlan plan, InliningPolicy inliningPolicy,
+                    OptimisticOptimizations optimisticOpts) {
         this.target = target;
         this.runtime = runtime;
         this.assumptions = assumptions;
         this.cache = cache;
         this.plan = plan;
         this.inliningPolicy = inliningPolicy;
+        this.optimisticOpts = optimisticOpts;
     }
 
     @Override
@@ -96,14 +101,12 @@
                         candidate.inline(graph, runtime, this, assumptions);
                         Debug.dump(graph, "after %s", candidate);
                         Iterable<Node> newNodes = graph.getNewNodes(mark);
+                        inliningPolicy.scanInvokes(newNodes);
                         if (GraalOptions.OptCanonicalizer) {
                             new CanonicalizerPhase(target, runtime, assumptions, invokeUsages, mark, customCanonicalizer).apply(graph);
                         }
                         metricInliningPerformed.increment();
-
-                        inliningPolicy.scanInvokes(newNodes);
                     } catch (BailoutException bailout) {
-                        // TODO determine if we should really bail out of the whole compilation.
                         throw bailout;
                     } catch (AssertionError e) {
                         throw new GraalInternalError(e).addContext(candidate.toString());
@@ -112,6 +115,8 @@
                     } catch (GraalInternalError e) {
                         throw e.addContext(candidate.toString());
                     }
+                } else if (optimisticOpts.devirtualizeInvokes()) {
+                    candidate.tryToDevirtualizeInvoke(graph, runtime, assumptions);
                 }
             }
         }
@@ -153,171 +158,174 @@
         boolean isWorthInlining(InlineInfo info);
     }
 
-    private abstract static class AbstractInliningDecision implements InliningDecision {
-
-        protected static boolean decideSizeBasedInlining(InlineInfo info, double maxSize) {
-            assert !Double.isNaN(info.weight()) && !Double.isNaN(maxSize);
-            boolean success = info.weight() <= maxSize;
-            if (GraalOptions.Debug) {
-                String formatterString = success ? "(size %f <= %f)" : "(too large %f > %f)";
-                InliningUtil.logInliningDecision(info, success, formatterString, info.weight(), maxSize);
-            }
-            return success;
-        }
+    private static class GreedySizeBasedInliningDecision implements InliningDecision {
 
-        protected static boolean checkCompiledCodeSize(InlineInfo info) {
-            if (GraalOptions.SmallCompiledCodeSize >= 0 && info.compiledCodeSize() > GraalOptions.SmallCompiledCodeSize) {
-                InliningUtil.logNotInlinedMethod(info, "(CompiledCodeSize %d > %d)", info.compiledCodeSize(), GraalOptions.SmallCompiledCodeSize);
-                return false;
-            }
-            return true;
-        }
-
-        protected static double getRelevance(Invoke invoke) {
-            if (GraalOptions.UseRelevanceBasedInlining) {
-                return invoke.inliningRelevance();
-            } else {
-                return invoke.probability();
-            }
-        }
-    }
-
-    private static class C1StaticSizeBasedInliningDecision extends AbstractInliningDecision {
-
-        @Override
-        public boolean isWorthInlining(InlineInfo info) {
-            double maxSize = Math.max(GraalOptions.MaximumTrivialSize, Math.pow(GraalOptions.NestedInliningSizeRatio, info.level()) * GraalOptions.MaximumInlineSize);
-            return decideSizeBasedInlining(info, maxSize);
-        }
-    }
+        private final GraalCodeCacheProvider runtime;
+        private final Collection<Invoke> hints;
 
-    private static class MinimumCodeSizeBasedInliningDecision extends AbstractInliningDecision {
-
-        @Override
-        public boolean isWorthInlining(InlineInfo info) {
-            assert GraalOptions.ProbabilityAnalysis;
-            if (!checkCompiledCodeSize(info)) {
-                return false;
-            }
-
-            double inlineWeight = Math.min(GraalOptions.RatioCapForInlining, getRelevance(info.invoke()));
-            double maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level()) * GraalOptions.MaximumInlineSize * inlineWeight;
-            maxSize = Math.max(GraalOptions.MaximumTrivialSize, maxSize);
-
-            return decideSizeBasedInlining(info, maxSize);
+        public GreedySizeBasedInliningDecision(GraalCodeCacheProvider runtime, Collection<Invoke> hints) {
+            this.runtime = runtime;
+            this.hints = hints;
         }
-    }
-
-    private static class DynamicSizeBasedInliningDecision extends AbstractInliningDecision {
-
-        @Override
-        public boolean isWorthInlining(InlineInfo info) {
-            assert GraalOptions.ProbabilityAnalysis;
-            if (!checkCompiledCodeSize(info)) {
-                return false;
-            }
-
-            double relevance = getRelevance(info.invoke());
-            double inlineBoost = Math.min(GraalOptions.RatioCapForInlining, relevance) + Math.log10(Math.max(1, relevance - GraalOptions.RatioCapForInlining + 1));
-            double maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level()) * GraalOptions.MaximumInlineSize;
-            maxSize = maxSize + maxSize * inlineBoost;
-            maxSize = Math.min(GraalOptions.MaximumGreedyInlineSize, Math.max(GraalOptions.MaximumTrivialSize, maxSize));
-
-            return decideSizeBasedInlining(info, maxSize);
-        }
-    }
-
-    private static class GreedySizeBasedInliningDecision extends AbstractInliningDecision {
 
         @Override
         public boolean isWorthInlining(InlineInfo info) {
             assert GraalOptions.ProbabilityAnalysis;
-            if (!checkCompiledCodeSize(info)) {
-                return false;
+            /*
+             * TODO (chaeubl): invoked methods that are on important paths but not yet compiled ->
+             * will be compiled anyways and it is likely that we are the only caller... might be
+             * useful to inline those methods but increases bootstrap time (maybe those methods are
+             * also getting queued in the compilation queue concurrently)
+             */
+
+            if (GraalOptions.AlwaysInlineIntrinsics && onlyIntrinsics(info)) {
+                return InliningUtil.logInlinedMethod(info, "intrinsic");
             }
 
-            double maxSize = GraalOptions.MaximumGreedyInlineSize;
-            if (GraalOptions.InliningBonusPerTransferredValue != 0) {
-                Signature signature = info.invoke().methodCallTarget().targetMethod().getSignature();
-                int transferredValues = signature.getParameterCount(!Modifier.isStatic(info.invoke().methodCallTarget().targetMethod().getModifiers()));
-                if (signature.getReturnKind() != Kind.Void) {
-                    transferredValues++;
+            int bytecodeSize = bytecodeCodeSize(info);
+            int complexity = compilationComplexity(info);
+            int compiledCodeSize = compiledCodeSize(info);
+            double relevance = info.invoke().inliningRelevance();
+
+            /*
+             * as long as the compiled code size is small enough (or the method was not yet
+             * compiled), we can do a pretty general inlining that suits most situations
+             */
+            if (compiledCodeSize < GraalOptions.SmallCompiledCodeSize) {
+                if (isTrivialInlining(bytecodeSize, complexity, compiledCodeSize)) {
+                    return InliningUtil.logInlinedMethod(info, "trivial (bytecodes=%d, complexity=%d, codeSize=%d)", bytecodeSize, complexity, compiledCodeSize);
                 }
-                maxSize += transferredValues * GraalOptions.InliningBonusPerTransferredValue;
+
+                if (canInlineRelevanceBased(relevance, bytecodeSize, complexity, compiledCodeSize)) {
+                    return InliningUtil.logInlinedMethod(info, "relevance-based (relevance=%f, bytecodes=%d, complexity=%d, codeSize=%d)", relevance, bytecodeSize, complexity, compiledCodeSize);
+                }
             }
 
-            double inlineRatio = Math.min(GraalOptions.RatioCapForInlining, getRelevance(info.invoke()));
-            maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level()) * maxSize * inlineRatio;
-            maxSize = Math.max(maxSize, GraalOptions.MaximumTrivialSize);
+            /*
+             * the normal inlining did not fit this invoke, so check if we have any reason why we
+             * should still do the inlining
+             */
+            double probability = info.invoke().probability();
+            int transferredValues = numberOfTransferredValues(info);
+            int invokeUsages = countInvokeUsages(info);
+            int moreSpecificArguments = countMoreSpecificArgumentInfo(info);
+            int level = info.level();
+            boolean preferredInvoke = hints != null && hints.contains(info.invoke());
 
-            return decideSizeBasedInlining(info, maxSize);
+            // TODO (chaeubl): compute metric that is used to check if this method should be inlined
+
+            return InliningUtil.logNotInlinedMethod(info,
+                            "(relevance=%f, bytecodes=%d, complexity=%d, codeSize=%d, probability=%f, transferredValues=%d, invokeUsages=%d, moreSpecificArguments=%d, level=%d, preferred=%b)",
+                            relevance, bytecodeSize, complexity, compiledCodeSize, probability, transferredValues, invokeUsages, moreSpecificArguments, level, preferredInvoke);
         }
-    }
+
+        private static boolean isTrivialInlining(int bytecodeSize, int complexity, int compiledCodeSize) {
+            return bytecodeSize < GraalOptions.TrivialBytecodeSize || complexity < GraalOptions.TrivialComplexity || compiledCodeSize > 0 && compiledCodeSize < GraalOptions.TrivialCompiledCodeSize;
+        }
 
-    private static class GreedyMachineCodeInliningDecision extends AbstractInliningDecision {
+        private static boolean canInlineRelevanceBased(double relevance, int bytecodeSize, int complexity, int compiledCodeSize) {
+            return bytecodeSize < computeMaximumSize(relevance, GraalOptions.NormalBytecodeSize) || complexity < computeMaximumSize(relevance, GraalOptions.NormalComplexity) || compiledCodeSize > 0 &&
+                            compiledCodeSize < computeMaximumSize(relevance, GraalOptions.NormalCompiledCodeSize);
+        }
 
-        @Override
-        public boolean isWorthInlining(InlineInfo info) {
-            assert GraalOptions.ProbabilityAnalysis;
+        private static double computeMaximumSize(double relevance, int configuredMaximum) {
+            double inlineRatio = Math.min(GraalOptions.RelevanceCapForInlining, relevance);
+            return configuredMaximum * inlineRatio;
+        }
+
+        private static int numberOfTransferredValues(InlineInfo info) {
+            Signature signature = info.invoke().methodCallTarget().targetMethod().getSignature();
+            int transferredValues = signature.getParameterCount(!Modifier.isStatic(info.invoke().methodCallTarget().targetMethod().getModifiers()));
+            if (signature.getReturnKind() != Kind.Void) {
+                transferredValues++;
+            }
+            return transferredValues;
+        }
 
-            double maxSize = GraalOptions.MaximumGreedyInlineSize;
-            double inlineRatio = Math.min(GraalOptions.RatioCapForInlining, getRelevance(info.invoke()));
-            maxSize = Math.pow(GraalOptions.NestedInliningSizeRatio, info.level()) * maxSize * inlineRatio;
-            maxSize = Math.max(maxSize, GraalOptions.MaximumTrivialSize);
-
-            return decideSizeBasedInlining(info, maxSize);
+        private static int countInvokeUsages(InlineInfo info) {
+            // inlining calls with lots of usages simplifies the caller
+            int usages = 0;
+            for (Node n : info.invoke().node().usages()) {
+                if (!(n instanceof FrameState)) {
+                    usages++;
+                }
+            }
+            return usages;
         }
-    }
 
-    private static class BytecodeSizeBasedWeightComputationPolicy implements WeightComputationPolicy {
+        private int countMoreSpecificArgumentInfo(InlineInfo info) {
+            /*
+             * inlining invokes where the caller has very specific information about the passed
+             * argument simplifies the callee
+             */
+            int moreSpecificArgumentInfo = 0;
+            boolean isStatic = info.invoke().methodCallTarget().isStatic();
+            int signatureOffset = isStatic ? 0 : 1;
+            NodeInputList arguments = info.invoke().methodCallTarget().arguments();
+            ResolvedJavaMethod targetMethod = info.invoke().methodCallTarget().targetMethod();
+            ResolvedJavaType methodHolderClass = targetMethod.getDeclaringClass();
+            Signature signature = targetMethod.getSignature();
 
-        @Override
-        public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) {
-            if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) {
-                return 0;
+            for (int i = 0; i < arguments.size(); i++) {
+                Node n = arguments.get(i);
+                if (n instanceof ConstantNode) {
+                    moreSpecificArgumentInfo++;
+                } else if (n instanceof ValueNode && !((ValueNode) n).kind().isPrimitive()) {
+                    ResolvedJavaType actualType = ((ValueNode) n).stamp().javaType(runtime);
+                    JavaType declaredType;
+                    if (i == 0 && !isStatic) {
+                        declaredType = methodHolderClass;
+                    } else {
+                        declaredType = signature.getParameterType(i - signatureOffset, methodHolderClass);
+                    }
+
+                    if (declaredType instanceof ResolvedJavaType && !actualType.equals(declaredType) && ((ResolvedJavaType) declaredType).isAssignableFrom(actualType)) {
+                        moreSpecificArgumentInfo++;
+                    }
+                }
+
             }
 
-            double codeSize = method.getCodeSize();
-            if (preferredInvoke) {
-                codeSize = codeSize / GraalOptions.BoostInliningForEscapeAnalysis;
-            }
-            return codeSize;
+            return moreSpecificArgumentInfo;
         }
-    }
 
-    private static class ComplexityBasedWeightComputationPolicy implements WeightComputationPolicy {
-
-        @Override
-        public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) {
-            if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) {
-                return 0;
+        private static int bytecodeCodeSize(InlineInfo info) {
+            int result = 0;
+            for (int i = 0; i < info.numberOfMethods(); i++) {
+                result += info.methodAt(i).getCodeSize();
             }
+            return result;
+        }
 
-            double complexity = method.getCompilationComplexity();
-            if (preferredInvoke) {
-                complexity = complexity / GraalOptions.BoostInliningForEscapeAnalysis;
+        private static int compilationComplexity(InlineInfo info) {
+            int result = 0;
+            for (int i = 0; i < info.numberOfMethods(); i++) {
+                result += info.methodAt(i).getCompilationComplexity();
             }
-            return complexity;
+            return result;
         }
-    }
 
-    private static class CompiledCodeSizeWeightComputationPolicy implements WeightComputationPolicy {
+        private static int compiledCodeSize(InlineInfo info) {
+            int result = 0;
+            for (int i = 0; i < info.numberOfMethods(); i++) {
+                result += info.methodAt(i).getCompiledCodeSize();
+            }
+            return result;
+        }
 
-        @Override
-        public double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke) {
-            if (GraalOptions.AlwaysInlineIntrinsics && InliningUtil.canIntrinsify(method)) {
-                return 0;
+        private static boolean onlyIntrinsics(InlineInfo info) {
+            for (int i = 0; i < info.numberOfMethods(); i++) {
+                if (!InliningUtil.canIntrinsify(info.methodAt(i))) {
+                    return false;
+                }
             }
-
-            int compiledCodeSize = method.getCompiledCodeSize();
-            return compiledCodeSize > 0 ? compiledCodeSize : method.getCodeSize() * 10;
+            return true;
         }
     }
 
     private static class CFInliningPolicy implements InliningPolicy {
 
         private final InliningDecision inliningDecision;
-        private final WeightComputationPolicy weightComputationPolicy;
         private final Collection<Invoke> hints;
         private final Assumptions assumptions;
         private final OptimisticOptimizations optimisticOpts;
@@ -325,10 +333,8 @@
         private NodeBitMap visitedFixedNodes;
         private FixedNode invokePredecessor;
 
-        public CFInliningPolicy(InliningDecision inliningPolicy, WeightComputationPolicy weightComputationPolicy, Collection<Invoke> hints, Assumptions assumptions,
-                        OptimisticOptimizations optimisticOpts) {
+        public CFInliningPolicy(InliningDecision inliningPolicy, Collection<Invoke> hints, Assumptions assumptions, OptimisticOptimizations optimisticOpts) {
             this.inliningDecision = inliningPolicy;
-            this.weightComputationPolicy = weightComputationPolicy;
             this.hints = hints;
             this.assumptions = assumptions;
             this.optimisticOpts = optimisticOpts;
@@ -347,7 +353,7 @@
 
         public InlineInfo next() {
             Invoke invoke = sortedInvokes.pop();
-            InlineInfo info = InliningUtil.getInlineInfo(invoke, assumptions, this, optimisticOpts);
+            InlineInfo info = InliningUtil.getInlineInfo(invoke, assumptions, optimisticOpts);
             if (info != null) {
                 invokePredecessor = (FixedNode) info.invoke().predecessor();
                 assert invokePredecessor.isAlive();
@@ -368,171 +374,105 @@
         }
 
         public void scanInvokes(Iterable<? extends Node> newNodes) {
-            scanGraphForInvokes(invokePredecessor);
+            assert invokePredecessor.isAlive();
+            int invokes = scanGraphForInvokes(invokePredecessor);
+            assert invokes == countInvokes(newNodes);
         }
 
-        private void scanGraphForInvokes(FixedNode start) {
+        private int scanGraphForInvokes(FixedNode start) {
             ArrayList<Invoke> invokes = new InliningIterator(start, visitedFixedNodes).apply();
 
             // insert the newly found invokes in their correct control-flow order
             for (int i = invokes.size() - 1; i >= 0; i--) {
-                sortedInvokes.addFirst(invokes.get(i));
-            }
-        }
-
-        public double inliningWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke) {
-            boolean preferredInvoke = hints != null && hints.contains(invoke);
-            return weightComputationPolicy.computeWeight(caller, method, invoke, preferredInvoke);
-        }
-    }
-
-    private static class PriorityInliningPolicy implements InliningPolicy {
+                Invoke invoke = invokes.get(i);
+                assert !sortedInvokes.contains(invoke);
+                sortedInvokes.addFirst(invoke);
 
-        private final InliningDecision inliningDecision;
-        private final WeightComputationPolicy weightComputationPolicy;
-        private final Collection<Invoke> hints;
-        private final Assumptions assumptions;
-        private final OptimisticOptimizations optimisticOpts;
-        private final PriorityQueue<InlineInfo> sortedCandidates;
-
-        public PriorityInliningPolicy(InliningDecision inliningPolicy, WeightComputationPolicy weightComputationPolicy, Collection<Invoke> hints, Assumptions assumptions,
-                        OptimisticOptimizations optimisticOpts) {
-            this.inliningDecision = inliningPolicy;
-            this.weightComputationPolicy = weightComputationPolicy;
-            this.hints = hints;
-            this.assumptions = assumptions;
-            this.optimisticOpts = optimisticOpts;
-            sortedCandidates = new PriorityQueue<>();
-        }
-
-        public boolean continueInlining(StructuredGraph graph) {
-            if (graph.getNodeCount() >= GraalOptions.MaximumDesiredSize) {
-                InliningUtil.logInliningDecision("inlining is cut off by MaximumDesiredSize");
-                metricInliningStoppedByMaxDesiredSize.increment();
-                return false;
             }
 
-            return !sortedCandidates.isEmpty();
+            return invokes.size();
         }
 
-        public InlineInfo next() {
-            // refresh cached info before using it (it might have been in the queue for a long time)
-            InlineInfo info = sortedCandidates.remove();
-            return InliningUtil.getInlineInfo(info.invoke(), assumptions, this, optimisticOpts);
-        }
-
-        @Override
-        public boolean isWorthInlining(InlineInfo info) {
-            return inliningDecision.isWorthInlining(info);
-        }
-
-        @SuppressWarnings("unchecked")
-        public void initialize(StructuredGraph graph) {
-            if (hints == null) {
-                scanInvokes(graph.getNodes(InvokeNode.class));
-                scanInvokes(graph.getNodes(InvokeWithExceptionNode.class));
-            } else {
-                scanInvokes((Iterable<? extends Node>) (Iterable<?>) hints);
-            }
-        }
-
-        public void scanInvokes(Iterable<? extends Node> nodes) {
-            for (Node node : nodes) {
-                if (node != null) {
-                    if (node instanceof Invoke) {
-                        Invoke invoke = (Invoke) node;
-                        scanInvoke(invoke);
-                    }
-                    for (Node usage : node.usages().filterInterface(Invoke.class).snapshot()) {
-                        scanInvoke((Invoke) usage);
-                    }
+        private static int countInvokes(Iterable<? extends Node> nodes) {
+            int count = 0;
+            for (Node n : nodes) {
+                if (n instanceof Invoke) {
+                    count++;
                 }
             }
-        }
-
-        private void scanInvoke(Invoke invoke) {
-            InlineInfo info = InliningUtil.getInlineInfo(invoke, assumptions, this, optimisticOpts);
-            if (info != null) {
-                sortedCandidates.add(info);
-            }
-        }
-
-        @Override
-        public double inliningWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke) {
-            boolean preferredInvoke = hints != null && hints.contains(invoke);
-            return weightComputationPolicy.computeWeight(caller, method, invoke, preferredInvoke);
+            return count;
         }
     }
 
     private static class InliningIterator {
 
         private final FixedNode start;
-        private final NodeBitMap processedNodes;
-
         private final Deque<FixedNode> nodeQueue;
         private final NodeBitMap queuedNodes;
 
         public InliningIterator(FixedNode start, NodeBitMap visitedFixedNodes) {
             this.start = start;
-            this.processedNodes = visitedFixedNodes;
-
             this.nodeQueue = new ArrayDeque<>();
-            this.queuedNodes = visitedFixedNodes.copy();
-
+            this.queuedNodes = visitedFixedNodes;
             assert start.isAlive();
         }
 
         public ArrayList<Invoke> apply() {
             ArrayList<Invoke> invokes = new ArrayList<>();
-            FixedNode current = start;
-            do {
+            FixedNode current;
+            forcedQueue(start);
+
+            while ((current = nextQueuedNode()) != null) {
                 assert current.isAlive();
-                processedNodes.mark(current);
 
-                if (current instanceof InvokeWithExceptionNode || current instanceof InvokeNode) {
-                    invokes.add((Invoke) current);
+                if (current instanceof Invoke) {
+                    if (current != start) {
+                        invokes.add((Invoke) current);
+                    }
                     queueSuccessors(current);
-                    current = nextQueuedNode();
                 } else if (current instanceof LoopBeginNode) {
-                    current = ((LoopBeginNode) current).next();
-                    assert current != null;
+                    queueSuccessors(current);
                 } else if (current instanceof LoopEndNode) {
-                    current = nextQueuedNode();
+                    // nothing todo
                 } else if (current instanceof MergeNode) {
-                    current = ((MergeNode) current).next();
-                    assert current != null;
+                    queueSuccessors(current);
                 } else if (current instanceof FixedWithNextNode) {
                     queueSuccessors(current);
-                    current = nextQueuedNode();
                 } else if (current instanceof EndNode) {
                     queueMerge((EndNode) current);
-                    current = nextQueuedNode();
                 } else if (current instanceof DeoptimizeNode) {
-                    current = nextQueuedNode();
+                    // nothing todo
                 } else if (current instanceof ReturnNode) {
-                    current = nextQueuedNode();
+                    // nothing todo
                 } else if (current instanceof UnwindNode) {
-                    current = nextQueuedNode();
+                    // nothing todo
                 } else if (current instanceof ControlSplitNode) {
                     queueSuccessors(current);
-                    current = nextQueuedNode();
                 } else {
                     assert false : current;
                 }
-            } while (current != null);
+            }
 
             return invokes;
         }
 
         private void queueSuccessors(FixedNode x) {
             for (Node node : x.successors()) {
-                if (node != null && !queuedNodes.isMarked(node)) {
-                    queuedNodes.mark(node);
-                    nodeQueue.addFirst((FixedNode) node);
-                }
+                queue(node);
             }
         }
 
+        private void queue(Node node) {
+            if (node != null && !queuedNodes.isMarked(node)) {
+                forcedQueue(node);
+            }
+        }
+
+        private void forcedQueue(Node node) {
+            queuedNodes.mark(node);
+            nodeQueue.addFirst((FixedNode) node);
+        }
+
         private FixedNode nextQueuedNode() {
             if (nodeQueue.isEmpty()) {
                 return null;
@@ -553,7 +493,7 @@
 
         private boolean visitedAllEnds(MergeNode merge) {
             for (int i = 0; i < merge.forwardEndCount(); i++) {
-                if (!processedNodes.isMarked(merge.forwardEndAt(i))) {
+                if (!queuedNodes.isMarked(merge.forwardEndAt(i))) {
                     return false;
                 }
             }
@@ -561,49 +501,8 @@
         }
     }
 
-    private static InliningPolicy createInliningPolicy(Assumptions assumptions, OptimisticOptimizations optimisticOpts, Collection<Invoke> hints) {
-        switch (GraalOptions.InliningPolicy) {
-            case 0:
-                return new CFInliningPolicy(createInliningDecision(), createWeightComputationPolicy(), hints, assumptions, optimisticOpts);
-            case 1:
-                return new PriorityInliningPolicy(createInliningDecision(), createWeightComputationPolicy(), hints, assumptions, optimisticOpts);
-            default:
-                GraalInternalError.shouldNotReachHere();
-                return null;
-        }
-    }
-
-    private static InliningDecision createInliningDecision() {
-        switch (GraalOptions.InliningDecision) {
-            case 1:
-                return new C1StaticSizeBasedInliningDecision();
-            case 2:
-                return new MinimumCodeSizeBasedInliningDecision();
-            case 3:
-                return new DynamicSizeBasedInliningDecision();
-            case 4:
-                return new GreedySizeBasedInliningDecision();
-            case 5:
-                return new GreedyMachineCodeInliningDecision();
-            default:
-                GraalInternalError.shouldNotReachHere();
-                return null;
-        }
-    }
-
-    private static WeightComputationPolicy createWeightComputationPolicy() {
-        switch (GraalOptions.WeightComputationPolicy) {
-            case 0:
-                throw new GraalInternalError("removed because of invokation counter changes");
-            case 1:
-                return new BytecodeSizeBasedWeightComputationPolicy();
-            case 2:
-                return new ComplexityBasedWeightComputationPolicy();
-            case 3:
-                return new CompiledCodeSizeWeightComputationPolicy();
-            default:
-                GraalInternalError.shouldNotReachHere();
-                return null;
-        }
+    private static InliningPolicy createInliningPolicy(GraalCodeCacheProvider runtime, Assumptions assumptions, OptimisticOptimizations optimisticOpts, Collection<Invoke> hints) {
+        InliningDecision inliningDecision = new GreedySizeBasedInliningDecision(runtime, hints);
+        return new CFInliningPolicy(inliningDecision, hints, assumptions, optimisticOpts);
     }
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Tue Feb 05 15:27:40 2013 +0100
@@ -70,18 +70,13 @@
 
         void scanInvokes(Iterable<? extends Node> newNodes);
 
-        double inliningWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke);
-
         boolean isWorthInlining(InlineInfo info);
     }
 
-    public interface WeightComputationPolicy {
+    public static boolean logNotInlinedMethod(InlineInfo info, String msg, Object... args) {
 
-        double computeWeight(ResolvedJavaMethod caller, ResolvedJavaMethod method, Invoke invoke, boolean preferredInvoke);
-    }
-
-    public static void logNotInlinedMethod(InlineInfo info, String msg, Object... args) {
         logInliningDecision(info, false, msg, args);
+        return false;
     }
 
     public static void logInliningDecision(InlineInfo info, boolean success, String msg, final Object... args) {
@@ -99,6 +94,11 @@
         });
     }
 
+    public static boolean logInlinedMethod(InlineInfo info, String string, Object... args) {
+        logInliningDecision(info, true, string, args);
+        return true;
+    }
+
     private static boolean logNotInlinedMethodAndReturnFalse(Invoke invoke, String msg) {
         if (shouldLogInliningDecision()) {
             String methodString = invoke.toString() + (invoke.callTarget() == null ? " callTarget=null" : invoke.callTarget().targetName());
@@ -135,7 +135,7 @@
         logInliningDecision(inliningMsg, args);
     }
 
-    private static boolean shouldLogInliningDecision() {
+    public static boolean shouldLogInliningDecision() {
         return Debug.scope(inliningDecisionsScopeString, new Callable<Boolean>() {
 
             public Boolean call() {
@@ -178,49 +178,43 @@
      * The weight is the amortized weight of the additional code - so smaller is better. The level
      * is the number of nested inlinings that lead to this invoke.
      */
-    public interface InlineInfo extends Comparable<InlineInfo> {
+    public interface InlineInfo {
 
         Invoke invoke();
 
-        double weight();
-
         int level();
 
-        int compiledCodeSize();
+        int numberOfMethods();
 
-        int compareTo(InlineInfo o);
+        ResolvedJavaMethod methodAt(int index);
 
         /**
          * Performs the inlining described by this object and returns the node that represents the
          * return value of the inlined method (or null for void methods and methods that have no
          * non-exceptional exit).
+         **/
+        void inline(StructuredGraph graph, GraalCodeCacheProvider runtime, InliningCallback callback, Assumptions assumptions);
+
+        /**
+         * Try to make the call static bindable to avoid interface and virtual method calls.
          */
-        void inline(StructuredGraph graph, GraalCodeCacheProvider runtime, InliningCallback callback, Assumptions assumptions);
+        void tryToDevirtualizeInvoke(StructuredGraph graph, GraalCodeCacheProvider runtime, Assumptions assumptions);
     }
 
     public abstract static class AbstractInlineInfo implements InlineInfo {
 
         protected final Invoke invoke;
-        protected final double weight;
 
-        public AbstractInlineInfo(Invoke invoke, double weight) {
+        public AbstractInlineInfo(Invoke invoke) {
             this.invoke = invoke;
-            this.weight = weight;
         }
 
         @Override
-        public int compareTo(InlineInfo o) {
-            return (weight < o.weight()) ? -1 : (weight > o.weight()) ? 1 : 0;
-        }
-
         public Invoke invoke() {
             return invoke;
         }
 
-        public double weight() {
-            return weight;
-        }
-
+        @Override
         public int level() {
             return computeInliningLevel(invoke);
         }
@@ -260,7 +254,7 @@
             }
         }
 
-        private static StructuredGraph getGraph(final ResolvedJavaMethod concrete, final InliningCallback callback) {
+        protected static StructuredGraph getGraph(final ResolvedJavaMethod concrete, final InliningCallback callback) {
             return Debug.scope("GetInliningGraph", concrete, new Callable<StructuredGraph>() {
 
                 @Override
@@ -270,6 +264,12 @@
                 }
             });
         }
+
+        protected void replaceInvokeCallTarget(StructuredGraph graph, InvokeKind invokeKind, ResolvedJavaMethod targetMethod) {
+            MethodCallTargetNode oldCallTarget = invoke.methodCallTarget();
+            MethodCallTargetNode newCallTarget = graph.add(new MethodCallTargetNode(invokeKind, targetMethod, oldCallTarget.arguments().toArray(new ValueNode[0]), oldCallTarget.returnType()));
+            invoke.node().replaceFirstInput(oldCallTarget, newCallTarget);
+        }
     }
 
     /**
@@ -280,8 +280,8 @@
 
         public final ResolvedJavaMethod concrete;
 
-        public ExactInlineInfo(Invoke invoke, double weight, ResolvedJavaMethod concrete) {
-            super(invoke, weight);
+        public ExactInlineInfo(Invoke invoke, ResolvedJavaMethod concrete) {
+            super(invoke);
             this.concrete = concrete;
         }
 
@@ -291,8 +291,19 @@
         }
 
         @Override
-        public int compiledCodeSize() {
-            return InliningUtil.compiledCodeSize(concrete);
+        public void tryToDevirtualizeInvoke(StructuredGraph graph, GraalCodeCacheProvider runtime, Assumptions assumptions) {
+            // nothing todo, can already be bound statically
+        }
+
+        @Override
+        public int numberOfMethods() {
+            return 1;
+        }
+
+        @Override
+        public ResolvedJavaMethod methodAt(int index) {
+            assert index == 0;
+            return concrete;
         }
 
         @Override
@@ -311,20 +322,36 @@
         public final ResolvedJavaMethod concrete;
         public final ResolvedJavaType type;
 
-        public TypeGuardInlineInfo(Invoke invoke, double weight, ResolvedJavaMethod concrete, ResolvedJavaType type) {
-            super(invoke, weight);
+        public TypeGuardInlineInfo(Invoke invoke, ResolvedJavaMethod concrete, ResolvedJavaType type) {
+            super(invoke);
             this.concrete = concrete;
             this.type = type;
         }
 
         @Override
-        public int compiledCodeSize() {
-            return InliningUtil.compiledCodeSize(concrete);
+        public int numberOfMethods() {
+            return 1;
+        }
+
+        @Override
+        public ResolvedJavaMethod methodAt(int index) {
+            assert index == 0;
+            return concrete;
         }
 
         @Override
         public void inline(StructuredGraph graph, GraalCodeCacheProvider runtime, InliningCallback callback, Assumptions assumptions) {
-            // receiver null check must be before the type check
+            createGuard(graph, runtime);
+            inline(invoke, concrete, callback, assumptions, false);
+        }
+
+        @Override
+        public void tryToDevirtualizeInvoke(StructuredGraph graph, GraalCodeCacheProvider runtime, Assumptions assumptions) {
+            createGuard(graph, runtime);
+            replaceInvokeCallTarget(graph, InvokeKind.Special, concrete);
+        }
+
+        private void createGuard(StructuredGraph graph, GraalCodeCacheProvider runtime) {
             InliningUtil.receiverNullCheck(invoke);
             ValueNode receiver = invoke.methodCallTarget().receiver();
             ConstantNode typeHub = ConstantNode.forConstant(type.getEncoding(Representation.ObjectHub), runtime, graph);
@@ -340,8 +367,6 @@
             graph.addBeforeFixed(invoke.node(), receiverHub);
             graph.addBeforeFixed(invoke.node(), guard);
             graph.addBeforeFixed(invoke.node(), anchor);
-
-            inline(invoke, concrete, callback, assumptions, false);
         }
 
         @Override
@@ -362,8 +387,8 @@
         public final int[] typesToConcretes;
         public final double notRecordedTypeProbability;
 
-        public MultiTypeGuardInlineInfo(Invoke invoke, double weight, ArrayList<ResolvedJavaMethod> concretes, ArrayList<ProfiledType> ptypes, int[] typesToConcretes, double notRecordedTypeProbability) {
-            super(invoke, weight);
+        public MultiTypeGuardInlineInfo(Invoke invoke, ArrayList<ResolvedJavaMethod> concretes, ArrayList<ProfiledType> ptypes, int[] typesToConcretes, double notRecordedTypeProbability) {
+            super(invoke);
             assert concretes.size() > 0 && concretes.size() <= ptypes.size() : "must have at least one method but no more than types methods";
             assert ptypes.size() == typesToConcretes.length : "array lengths must match";
 
@@ -374,33 +399,37 @@
         }
 
         @Override
-        public int compiledCodeSize() {
-            int result = 0;
-            for (ResolvedJavaMethod m : concretes) {
-                result += InliningUtil.compiledCodeSize(m);
-            }
-            return result;
+        public int numberOfMethods() {
+            return concretes.size();
+        }
+
+        @Override
+        public ResolvedJavaMethod methodAt(int index) {
+            assert index >= 0 && index < concretes.size();
+            return concretes.get(index);
         }
 
         @Override
         public void inline(StructuredGraph graph, GraalCodeCacheProvider runtime, InliningCallback callback, Assumptions assumptions) {
-            int numberOfMethods = concretes.size();
-            boolean hasReturnValue = invoke.node().kind() != Kind.Void;
-
             // receiver null check must be the first node
             InliningUtil.receiverNullCheck(invoke);
-            if (numberOfMethods > 1 || shouldFallbackToInvoke()) {
-                inlineMultipleMethods(graph, callback, assumptions, numberOfMethods, hasReturnValue);
+            if (hasSingleMethod()) {
+                inlineSingleMethod(graph, callback, assumptions);
             } else {
-                inlineSingleMethod(graph, callback, assumptions);
+                inlineMultipleMethods(graph, callback, assumptions);
             }
         }
 
+        private boolean hasSingleMethod() {
+            return concretes.size() == 1 && !shouldFallbackToInvoke();
+        }
+
         private boolean shouldFallbackToInvoke() {
             return notRecordedTypeProbability > 0;
         }
 
-        private void inlineMultipleMethods(StructuredGraph graph, InliningCallback callback, Assumptions assumptions, int numberOfMethods, boolean hasReturnValue) {
+        private void inlineMultipleMethods(StructuredGraph graph, InliningCallback callback, Assumptions assumptions) {
+            int numberOfMethods = concretes.size();
             FixedNode continuation = invoke.next();
 
             ValueNode originalReceiver = invoke.methodCallTarget().receiver();
@@ -410,7 +439,7 @@
             returnMerge.setStateAfter(invoke.stateAfter().duplicate(invoke.stateAfter().bci));
 
             PhiNode returnValuePhi = null;
-            if (hasReturnValue) {
+            if (invoke.node().kind() != Kind.Void) {
                 returnValuePhi = graph.unique(new PhiNode(invoke.node().kind(), returnMerge));
             }
 
@@ -465,16 +494,13 @@
             assert invoke.node().isAlive();
 
             // replace the invoke with a switch on the type of the actual receiver
-            Kind hubKind = invoke.methodCallTarget().targetMethod().getDeclaringClass().getEncoding(Representation.ObjectHub).getKind();
-            LoadHubNode receiverHub = graph.add(new LoadHubNode(invoke.methodCallTarget().receiver(), hubKind));
-            graph.addBeforeFixed(invoke.node(), receiverHub);
-            FixedNode dispatchOnType = createDispatchOnType(graph, receiverHub, successors);
+            createDispatchOnTypeBeforeInvoke(graph, successors, false);
 
             assert invoke.next() == continuation;
             invoke.setNext(null);
             returnMerge.setNext(continuation);
             invoke.node().replaceAtUsages(returnValuePhi);
-            invoke.node().replaceAndDelete(dispatchOnType);
+            invoke.node().replaceAndDelete(null);
 
             ArrayList<PiNode> replacements = new ArrayList<>();
 
@@ -544,46 +570,52 @@
             return commonType;
         }
 
+        private ResolvedJavaType getLeastCommonType() {
+            ResolvedJavaType result = getLeastCommonType(0);
+            for (int i = 1; i < concretes.size(); i++) {
+                result = result.findLeastCommonAncestor(getLeastCommonType(i));
+            }
+            return result;
+        }
+
         private void inlineSingleMethod(StructuredGraph graph, InliningCallback callback, Assumptions assumptions) {
             assert concretes.size() == 1 && ptypes.size() > 1 && !shouldFallbackToInvoke() && notRecordedTypeProbability == 0;
 
             BeginNode calleeEntryNode = graph.add(new BeginNode());
             calleeEntryNode.setProbability(invoke.probability());
-            Kind hubKind = invoke.methodCallTarget().targetMethod().getDeclaringClass().getEncoding(Representation.ObjectHub).getKind();
-            LoadHubNode receiverHub = graph.add(new LoadHubNode(invoke.methodCallTarget().receiver(), hubKind));
-            graph.addBeforeFixed(invoke.node(), receiverHub);
 
-            BeginNode unknownTypeSux = BeginNode.begin(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated)));
+            BeginNode unknownTypeSux = createUnknownTypeSuccessor(graph);
             BeginNode[] successors = new BeginNode[]{calleeEntryNode, unknownTypeSux};
-            FixedNode dispatchOnType = createDispatchOnType(graph, receiverHub, successors);
+            createDispatchOnTypeBeforeInvoke(graph, successors, false);
 
-            FixedWithNextNode pred = (FixedWithNextNode) invoke.node().predecessor();
-            pred.setNext(dispatchOnType);
             calleeEntryNode.setNext(invoke.node());
 
             ResolvedJavaMethod concrete = concretes.get(0);
             inline(invoke, concrete, callback, assumptions, false);
         }
 
-        private FixedNode createDispatchOnType(StructuredGraph graph, LoadHubNode hub, BeginNode[] successors) {
+        private void createDispatchOnTypeBeforeInvoke(StructuredGraph graph, BeginNode[] successors, boolean invokeIsOnlySuccessor) {
             assert ptypes.size() > 1;
 
+            Kind hubKind = invoke.methodCallTarget().targetMethod().getDeclaringClass().getEncoding(Representation.ObjectHub).getKind();
+            LoadHubNode hub = graph.add(new LoadHubNode(invoke.methodCallTarget().receiver(), hubKind));
+            graph.addBeforeFixed(invoke.node(), hub);
+
             ResolvedJavaType[] keys = new ResolvedJavaType[ptypes.size()];
             double[] keyProbabilities = new double[ptypes.size() + 1];
             int[] keySuccessors = new int[ptypes.size() + 1];
             for (int i = 0; i < ptypes.size(); i++) {
                 keys[i] = ptypes.get(i).getType();
                 keyProbabilities[i] = ptypes.get(i).getProbability();
-                keySuccessors[i] = typesToConcretes[i];
+                keySuccessors[i] = invokeIsOnlySuccessor ? 0 : typesToConcretes[i];
                 assert keySuccessors[i] < successors.length - 1 : "last successor is the unknownTypeSux";
             }
             keyProbabilities[keyProbabilities.length - 1] = notRecordedTypeProbability;
             keySuccessors[keySuccessors.length - 1] = successors.length - 1;
 
-            double[] successorProbabilities = SwitchNode.successorProbabilites(successors.length, keySuccessors, keyProbabilities);
-            TypeSwitchNode typeSwitch = graph.add(new TypeSwitchNode(hub, successors, successorProbabilities, keys, keyProbabilities, keySuccessors));
-
-            return typeSwitch;
+            TypeSwitchNode typeSwitch = graph.add(new TypeSwitchNode(hub, successors, keys, keyProbabilities, keySuccessors));
+            FixedWithNextNode pred = (FixedWithNextNode) invoke.node().predecessor();
+            pred.setNext(typeSwitch);
         }
 
         private static BeginNode createInvocationBlock(StructuredGraph graph, Invoke invoke, MergeNode returnMerge, PhiNode returnValuePhi, MergeNode exceptionMerge, PhiNode exceptionObjectPhi,
@@ -646,6 +678,56 @@
         }
 
         @Override
+        public void tryToDevirtualizeInvoke(StructuredGraph graph, GraalCodeCacheProvider runtime, Assumptions assumptions) {
+            if (hasSingleMethod()) {
+                tryToDevirtualizeSingleMethod(graph);
+            } else {
+                tryToDevirtualizeMultipleMethods(graph);
+            }
+        }
+
+        private void tryToDevirtualizeSingleMethod(StructuredGraph graph) {
+            devirtualizeWithTypeSwitch(graph, InvokeKind.Special, concretes.get(0));
+        }
+
+        private void tryToDevirtualizeMultipleMethods(StructuredGraph graph) {
+            MethodCallTargetNode methodCallTarget = invoke.methodCallTarget();
+            if (methodCallTarget.invokeKind() == InvokeKind.Interface) {
+                ResolvedJavaMethod targetMethod = methodCallTarget.targetMethod();
+                ResolvedJavaType leastCommonType = getLeastCommonType();
+                // check if we have a common base type that implements the interface -> in that case
+// we have a vtable entry for the interface method and can use a less expensive virtual call
+                if (!leastCommonType.isInterface() && targetMethod.getDeclaringClass().isAssignableFrom(leastCommonType)) {
+                    ResolvedJavaMethod baseClassTargetMethod = leastCommonType.resolveMethod(targetMethod);
+                    if (baseClassTargetMethod != null) {
+                        devirtualizeWithTypeSwitch(graph, InvokeKind.Virtual, leastCommonType.resolveMethod(targetMethod));
+                    }
+                }
+            }
+        }
+
+        private void devirtualizeWithTypeSwitch(StructuredGraph graph, InvokeKind kind, ResolvedJavaMethod target) {
+            InliningUtil.receiverNullCheck(invoke);
+
+            BeginNode invocationEntry = graph.add(new BeginNode());
+            invocationEntry.setProbability(invoke.probability());
+
+            BeginNode unknownTypeSux = createUnknownTypeSuccessor(graph);
+            BeginNode[] successors = new BeginNode[]{invocationEntry, unknownTypeSux};
+            createDispatchOnTypeBeforeInvoke(graph, successors, true);
+
+            invocationEntry.setNext(invoke.node());
+            ValueNode receiver = invoke.methodCallTarget().receiver();
+            PiNode anchoredReceiver = createAnchoredReceiver(graph, invocationEntry, target.getDeclaringClass(), receiver, false);
+            invoke.callTarget().replaceFirstInput(receiver, anchoredReceiver);
+            replaceInvokeCallTarget(graph, kind, target);
+        }
+
+        private static BeginNode createUnknownTypeSuccessor(StructuredGraph graph) {
+            return BeginNode.begin(graph.add(new DeoptimizeNode(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.TypeCheckedInliningViolated)));
+        }
+
+        @Override
         public String toString() {
             StringBuilder builder = new StringBuilder(shouldFallbackToInvoke() ? "megamorphic" : "polymorphic");
             builder.append(", ");
@@ -675,8 +757,8 @@
 
         private final Assumption takenAssumption;
 
-        public AssumptionInlineInfo(Invoke invoke, double weight, ResolvedJavaMethod concrete, Assumption takenAssumption) {
-            super(invoke, weight, concrete);
+        public AssumptionInlineInfo(Invoke invoke, ResolvedJavaMethod concrete, Assumption takenAssumption) {
+            super(invoke, concrete);
             this.takenAssumption = takenAssumption;
         }
 
@@ -689,6 +771,12 @@
         }
 
         @Override
+        public void tryToDevirtualizeInvoke(StructuredGraph graph, GraalCodeCacheProvider runtime, Assumptions assumptions) {
+            assumptions.record(takenAssumption);
+            replaceInvokeCallTarget(graph, InvokeKind.Special, concrete);
+        }
+
+        @Override
         public String toString() {
             return "assumption " + MetaUtil.format("%H.%n(%p):%r", concrete);
         }
@@ -698,10 +786,9 @@
      * Determines if inlining is possible at the given invoke node.
      * 
      * @param invoke the invoke that should be inlined
-     * @param inliningPolicy used to determine the weight of a specific inlining
      * @return an instance of InlineInfo, or null if no inlining is possible at the given invoke
      */
-    public static InlineInfo getInlineInfo(Invoke invoke, Assumptions assumptions, InliningPolicy inliningPolicy, OptimisticOptimizations optimisticOpts) {
+    public static InlineInfo getInlineInfo(Invoke invoke, Assumptions assumptions, OptimisticOptimizations optimisticOpts) {
         if (!checkInvokeConditions(invoke)) {
             return null;
         }
@@ -710,7 +797,7 @@
         ResolvedJavaMethod targetMethod = callTarget.targetMethod();
 
         if (callTarget.invokeKind() == InvokeKind.Special || targetMethod.canBeStaticallyBound()) {
-            return getExactInlineInfo(invoke, inliningPolicy, optimisticOpts, caller, targetMethod);
+            return getExactInlineInfo(invoke, optimisticOpts, targetMethod);
         }
 
         assert callTarget.invokeKind() == InvokeKind.Virtual || callTarget.invokeKind() == InvokeKind.Interface;
@@ -725,57 +812,49 @@
                 holder = receiverType;
                 if (receiverStamp.isExactType()) {
                     assert targetMethod.getDeclaringClass().isAssignableFrom(holder) : holder + " subtype of " + targetMethod.getDeclaringClass() + " for " + targetMethod;
-                    return getExactInlineInfo(invoke, inliningPolicy, optimisticOpts, caller, holder.resolveMethod(targetMethod));
+                    return getExactInlineInfo(invoke, optimisticOpts, holder.resolveMethod(targetMethod));
                 }
             }
         }
 
         if (holder.isArray()) {
             // arrays can be treated as Objects
-            return getExactInlineInfo(invoke, inliningPolicy, optimisticOpts, caller, holder.resolveMethod(targetMethod));
+            return getExactInlineInfo(invoke, optimisticOpts, holder.resolveMethod(targetMethod));
         }
 
-        // TODO (chaeubl): we could also use the type determined after assumptions for the
-        // type-checked inlining case as it might have an effect on type filtering
         if (assumptions.useOptimisticAssumptions()) {
             ResolvedJavaType uniqueSubtype = holder.findUniqueConcreteSubtype();
             if (uniqueSubtype != null) {
-                return getAssumptionInlineInfo(invoke, inliningPolicy, optimisticOpts, caller, uniqueSubtype.resolveMethod(targetMethod), new Assumptions.ConcreteSubtype(holder, uniqueSubtype));
+                return getAssumptionInlineInfo(invoke, optimisticOpts, uniqueSubtype.resolveMethod(targetMethod), new Assumptions.ConcreteSubtype(holder, uniqueSubtype));
             }
 
             ResolvedJavaMethod concrete = holder.findUniqueConcreteMethod(targetMethod);
             if (concrete != null) {
-                return getAssumptionInlineInfo(invoke, inliningPolicy, optimisticOpts, caller, concrete, new Assumptions.ConcreteMethod(targetMethod, holder, concrete));
+                return getAssumptionInlineInfo(invoke, optimisticOpts, concrete, new Assumptions.ConcreteMethod(targetMethod, holder, concrete));
             }
-
-            // TODO (chaeubl): C1 has one more assumption in the case of interfaces
         }
 
         // type check based inlining
-        return getTypeCheckedInlineInfo(invoke, inliningPolicy, caller, holder, targetMethod, optimisticOpts);
+        return getTypeCheckedInlineInfo(invoke, caller, holder, targetMethod, optimisticOpts);
     }
 
-    private static InlineInfo getAssumptionInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, OptimisticOptimizations optimisticOpts, ResolvedJavaMethod caller, ResolvedJavaMethod concrete,
-                    Assumption takenAssumption) {
+    private static InlineInfo getAssumptionInlineInfo(Invoke invoke, OptimisticOptimizations optimisticOpts, ResolvedJavaMethod concrete, Assumption takenAssumption) {
         assert !Modifier.isAbstract(concrete.getModifiers());
         if (!checkTargetConditions(invoke, concrete, optimisticOpts)) {
             return null;
         }
-        double weight = inliningPolicy.inliningWeight(caller, concrete, invoke);
-        return new AssumptionInlineInfo(invoke, weight, concrete, takenAssumption);
+        return new AssumptionInlineInfo(invoke, concrete, takenAssumption);
     }
 
-    private static InlineInfo getExactInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, OptimisticOptimizations optimisticOpts, ResolvedJavaMethod caller, ResolvedJavaMethod targetMethod) {
+    private static InlineInfo getExactInlineInfo(Invoke invoke, OptimisticOptimizations optimisticOpts, ResolvedJavaMethod targetMethod) {
         assert !Modifier.isAbstract(targetMethod.getModifiers());
         if (!checkTargetConditions(invoke, targetMethod, optimisticOpts)) {
             return null;
         }
-        double weight = inliningPolicy.inliningWeight(caller, targetMethod, invoke);
-        return new ExactInlineInfo(invoke, weight, targetMethod);
+        return new ExactInlineInfo(invoke, targetMethod);
     }
 
-    private static InlineInfo getTypeCheckedInlineInfo(Invoke invoke, InliningPolicy inliningPolicy, ResolvedJavaMethod caller, ResolvedJavaType holder, ResolvedJavaMethod targetMethod,
-                    OptimisticOptimizations optimisticOpts) {
+    private static InlineInfo getTypeCheckedInlineInfo(Invoke invoke, ResolvedJavaMethod caller, ResolvedJavaType holder, ResolvedJavaMethod targetMethod, OptimisticOptimizations optimisticOpts) {
         ProfilingInfo profilingInfo = caller.getProfilingInfo();
         JavaTypeProfile typeProfile = profilingInfo.getTypeProfile(invoke.bci());
         if (typeProfile == null) {
@@ -799,8 +878,7 @@
             if (!checkTargetConditions(invoke, concrete, optimisticOpts)) {
                 return null;
             }
-            double weight = inliningPolicy.inliningWeight(caller, concrete, invoke);
-            return new TypeGuardInlineInfo(invoke, weight, concrete, type);
+            return new TypeGuardInlineInfo(invoke, concrete, type);
         } else {
             invoke.setPolymorphic(true);
 
@@ -814,14 +892,6 @@
                                 notRecordedTypeProbability * 100);
             }
 
-            // TODO (chaeubl) inlining of multiple methods should work differently
-            // 1. check which methods can be inlined
-            // 2. for those methods, use weight and probability to compute which of them should be
-            // inlined
-            // 3. do the inlining
-            // a) all seen methods can be inlined -> do so and guard with deopt
-            // b) some methods can be inlined -> inline them and fall back to invocation if violated
-
             // determine concrete methods and map type to specific method
             ArrayList<ResolvedJavaMethod> concreteMethods = new ArrayList<>();
             int[] typesToConcretes = new int[ptypes.size()];
@@ -836,14 +906,12 @@
                 typesToConcretes[i] = index;
             }
 
-            double totalWeight = 0;
             for (ResolvedJavaMethod concrete : concreteMethods) {
                 if (!checkTargetConditions(invoke, concrete, optimisticOpts)) {
                     return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "it is a polymorphic method call and at least one invoked method cannot be inlined");
                 }
-                totalWeight += inliningPolicy.inliningWeight(caller, concrete, invoke);
             }
-            return new MultiTypeGuardInlineInfo(invoke, totalWeight, concreteMethods, ptypes, typesToConcretes, notRecordedTypeProbability);
+            return new MultiTypeGuardInlineInfo(invoke, concreteMethods, ptypes, typesToConcretes, notRecordedTypeProbability);
         }
     }
 
@@ -1034,7 +1102,7 @@
                 if (node instanceof Invoke) {
                     Invoke newInvoke = (Invoke) node;
                     double newRelevance = newInvoke.inliningRelevance() * invoke.inliningRelevance();
-                    if (GraalOptions.LimitInlinedProbability) {
+                    if (GraalOptions.LimitInlinedRelevance) {
                         newRelevance = Math.min(newRelevance, invoke.inliningRelevance());
                     }
                     newInvoke.setInliningRelevance(newRelevance);
@@ -1106,14 +1174,6 @@
         return (StructuredGraph) target.getCompilerStorage().get(Graph.class);
     }
 
-    private static int compiledCodeSize(ResolvedJavaMethod target) {
-        if (GraalOptions.AlwaysInlineIntrinsics && canIntrinsify(target)) {
-            return 0;
-        } else {
-            return target.getCompiledCodeSize();
-        }
-    }
-
     public static Class<? extends FixedWithNextNode> getMacroNodeClass(ResolvedJavaMethod target) {
         Object result = target.getCompilerStorage().get(Node.class);
         return result == null ? null : ((Class<?>) result).asSubclass(FixedWithNextNode.class);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Tue Feb 05 15:27:40 2013 +0100
@@ -46,7 +46,7 @@
     @Override
     protected void run(StructuredGraph graph) {
         Set<Node> canonicalizationRoots = new HashSet<>();
-        ConditionalEliminationPhase eliminate = new ConditionalEliminationPhase();
+        ConditionalEliminationPhase eliminate = new ConditionalEliminationPhase(runtime);
         Listener listener = new Listener(canonicalizationRoots);
         while (true) {
             graph.trackInputChange(listener);
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Tue Feb 05 15:27:40 2013 +0100
@@ -43,30 +43,24 @@
            static boolean InlineMonomorphicCalls             = true;
            static boolean InlinePolymorphicCalls             = true;
            static boolean InlineMegamorphicCalls             = ____;
-    public static int     InliningPolicy                     = 1;
-    public static int     InliningDecision                   = 4;
-    public static int     WeightComputationPolicy            = 2;
-    public static int     MaximumTrivialSize                 = 10;
     public static int     MaximumInlineLevel                 = 30;
-    public static int     MaximumDesiredSize                 = 3000;
+    public static int     MaximumDesiredSize                 = 5000;
     public static int     MaximumRecursiveInlining           = 1;
-    public static int     SmallCompiledCodeSize              = 2200;
     public static boolean LimitInlinedProbability            = ____;
-    public static boolean UseRelevanceBasedInlining          = ____;
-    // WeightBasedInliningPolicy (0)
-    public static float   InliningSizePenaltyExp             = 20;
-    public static float   MaximumInlineWeight                = 1.25f;
-    public static float   InliningSizePenalty                = 1;
-    // StaticSizeBasedInliningPolicy (1), MinimumCodeSizeBasedInlining (2),
-    // DynamicSizeBasedInliningPolicy (3)
-    public static int     MaximumInlineSize                  = 35;
-    // GreedySizeBasedInlining (4)
-    public static int     MaximumGreedyInlineSize            = 100;
-    public static int     InliningBonusPerTransferredValue   = 10;
-    // Common options for inlining policies 1 to 4
-    public static float   NestedInliningSizeRatio            = 1f;
+    public static boolean LimitInlinedRelevance              = true;
     public static float   BoostInliningForEscapeAnalysis     = 2f;
-    public static float   RatioCapForInlining                = 1f;
+    public static float   RelevanceCapForInlining            = 1f;
+
+    public static int     TrivialBytecodeSize                = 10;
+    public static int     NormalBytecodeSize                 = 150;
+    public static int     MaximumBytecodeSize                = 500;
+    public static int     TrivialComplexity                  = 10;
+    public static int     NormalComplexity                   = 60;
+    public static int     MaximumComplexity                  = 400;
+    public static int     TrivialCompiledCodeSize            = 150;
+    public static int     NormalCompiledCodeSize             = 750;
+    public static int     MaximumCompiledCodeSize            = 4000;
+    public static int     SmallCompiledCodeSize              = 1000;
 
     // escape analysis settings
     public static boolean PartialEscapeAnalysis              = true;
@@ -80,7 +74,6 @@
 
     // absolute probability analysis
     public static boolean ProbabilityAnalysis                = true;
-    public static int     LoopFrequencyPropagationPolicy     = -2;
 
     // profiling information
     public static int     DeoptsToDisableOptimisticOptimization = 40;
@@ -201,6 +194,7 @@
     public static boolean OptTailDuplication                 = true;
     public static boolean OptEliminatePartiallyRedundantGuards = true;
     public static boolean OptFilterProfiledTypes             = true;
+    public static boolean OptDevirtualizeInvokesOptimistically = true;
 
     // Intrinsification settings
     public static boolean IntrinsifyArrayCopy                = true;
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java	Tue Feb 05 15:27:40 2013 +0100
@@ -52,9 +52,10 @@
         if (checkDeoptimizations(method.getProfilingInfo(), deoptReason)) {
             enabledOpts.add(optimization);
         } else {
-            // TODO (chaeubl): change to Debug.log when we are sure that optimistic optimizations
-            // are not disabled
-            // unnecessarily
+            /*
+             * TODO (chaeubl): see GRAAL-75 (remove when we are sure that optimistic optimizations
+             * are not disabled unnecessarily
+             */
             TTY.println("WARN: deactivated optimistic optimization %s for %s", optimization.name(), MetaUtil.format("%H.%n(%p)", method));
             disabledOptimisticOptsMetric.increment();
         }
@@ -84,6 +85,10 @@
         return GraalOptions.InlineMegamorphicCalls && enabledOpts.contains(Optimization.UseTypeCheckedInlining);
     }
 
+    public boolean devirtualizeInvokes() {
+        return GraalOptions.OptDevirtualizeInvokesOptimistically && enabledOpts.contains(Optimization.UseTypeCheckedInlining);
+    }
+
     public boolean useExceptionProbability() {
         return GraalOptions.UseExceptionProbability && enabledOpts.contains(Optimization.UseExceptionProbability);
     }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScopedPostOrderNodeIterator.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScopedPostOrderNodeIterator.java	Tue Feb 05 15:27:40 2013 +0100
@@ -30,15 +30,13 @@
 
 public abstract class ScopedPostOrderNodeIterator {
 
-    private final NodeBitMap processedNodes;
     private final Deque<FixedNode> nodeQueue;
     private final NodeBitMap queuedNodes;
     private final Deque<FixedNode> scopes;
 
-    protected FixedNode currentScope;
+    protected FixedNode currentScopeStart;
 
     public ScopedPostOrderNodeIterator(StructuredGraph graph) {
-        this.processedNodes = graph.createNodeBitMap();
         this.queuedNodes = graph.createNodeBitMap();
         this.nodeQueue = new ArrayDeque<>();
         this.scopes = getScopes(graph);
@@ -46,64 +44,57 @@
 
     public void apply() {
         while (!scopes.isEmpty()) {
-            processedNodes.clearAll();
             queuedNodes.clearAll();
-            this.currentScope = scopes.pop();
+            this.currentScopeStart = scopes.pop();
             initializeScope();
             processScope();
         }
     }
 
     public void processScope() {
-        FixedNode current = currentScope;
-        do {
+        FixedNode current;
+        queue(currentScopeStart);
+
+        while ((current = nextQueuedNode()) != null) {
             assert current.isAlive();
-            processedNodes.mark(current);
 
             if (current instanceof Invoke) {
                 invoke((Invoke) current);
                 queueSuccessors(current);
-                current = nextQueuedNode();
             } else if (current instanceof LoopBeginNode) {
                 queueLoopBeginSuccessors((LoopBeginNode) current);
-                current = nextQueuedNode();
             } else if (current instanceof LoopExitNode) {
                 queueLoopExitSuccessors((LoopExitNode) current);
-                current = nextQueuedNode();
             } else if (current instanceof LoopEndNode) {
-                current = nextQueuedNode();
+                // nothing todo
             } else if (current instanceof MergeNode) {
-                current = ((MergeNode) current).next();
-                assert current != null;
+                queueSuccessors(current);
             } else if (current instanceof FixedWithNextNode) {
                 queueSuccessors(current);
-                current = nextQueuedNode();
             } else if (current instanceof EndNode) {
                 queueMerge((EndNode) current);
-                current = nextQueuedNode();
             } else if (current instanceof DeoptimizeNode) {
-                current = nextQueuedNode();
+                // nothing todo
             } else if (current instanceof ReturnNode) {
-                current = nextQueuedNode();
+                // nothing todo
             } else if (current instanceof UnwindNode) {
-                current = nextQueuedNode();
+                // nothing todo
             } else if (current instanceof ControlSplitNode) {
                 queueSuccessors(current);
-                current = nextQueuedNode();
             } else {
                 assert false : current;
             }
-        } while (current != null);
+        }
     }
 
     protected void queueLoopBeginSuccessors(LoopBeginNode node) {
-        if (currentScope == node) {
+        if (currentScopeStart == node) {
             queue(node.next());
-        } else if (currentScope instanceof LoopBeginNode) {
+        } else if (currentScopeStart instanceof LoopBeginNode) {
             // so we are currently processing loop A and found another loop B
             // -> queue all loop exits of B except those that also exit loop A
             for (LoopExitNode loopExit : node.loopExits()) {
-                if (!((LoopBeginNode) currentScope).loopExits().contains(loopExit)) {
+                if (!((LoopBeginNode) currentScopeStart).loopExits().contains(loopExit)) {
                     queue(loopExit);
                 }
             }
@@ -113,7 +104,7 @@
     }
 
     protected void queueLoopExitSuccessors(LoopExitNode node) {
-        if (!(currentScope instanceof LoopBeginNode) || !((LoopBeginNode) currentScope).loopExits().contains(node)) {
+        if (!(currentScopeStart instanceof LoopBeginNode) || !((LoopBeginNode) currentScopeStart).loopExits().contains(node)) {
             queueSuccessors(node);
         }
     }
@@ -157,14 +148,13 @@
     private void queueMerge(EndNode end) {
         MergeNode merge = end.merge();
         if (!queuedNodes.isMarked(merge) && visitedAllEnds(merge)) {
-            queuedNodes.mark(merge);
-            nodeQueue.add(merge);
+            queue(merge);
         }
     }
 
     private boolean visitedAllEnds(MergeNode merge) {
         for (int i = 0; i < merge.forwardEndCount(); i++) {
-            if (!processedNodes.isMarked(merge.forwardEndAt(i))) {
+            if (!queuedNodes.isMarked(merge.forwardEndAt(i))) {
                 return false;
             }
         }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java	Tue Feb 05 15:27:40 2013 +0100
@@ -77,7 +77,8 @@
         boolean isStatic() default true;
 
         /**
-         * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the original method.
+         * Gets the {@linkplain MetaUtil#signatureToMethodDescriptor signature} of the original
+         * method.
          * <p>
          * If the default value is specified for this element, then the signature of the original
          * method is the same as the substitute method.
@@ -110,7 +111,7 @@
         boolean isStatic() default true;
 
         /**
-         * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the substituted
+         * Gets the {@linkplain MetaUtil#signatureToMethodDescriptor signature} of the substituted
          * method.
          * <p>
          * If the default value is specified for this element, then the signature of the substituted
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializeObjectNode.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializeObjectNode.java	Tue Feb 05 15:27:40 2013 +0100
@@ -94,12 +94,7 @@
             VirtualArrayNode virtual = (VirtualArrayNode) virtualObject;
 
             ResolvedJavaType element = virtual.componentType();
-            NewArrayNode newArray;
-            if (element.getKind() == Kind.Object) {
-                newArray = graph.add(new NewObjectArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), defaultValuesOnly, lockCount > 0));
-            } else {
-                newArray = graph.add(new NewPrimitiveArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), defaultValuesOnly, lockCount > 0));
-            }
+            NewArrayNode newArray = graph.add(new NewArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), defaultValuesOnly, lockCount > 0));
             this.replaceAtUsages(newArray);
             graph.addBeforeFixed(this, newArray);
 
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java	Tue Feb 05 15:27:40 2013 +0100
@@ -119,6 +119,22 @@
      * Compares this Signed with the specified value.
      * 
      * @param val value to which this Signed is to be compared.
+     * @return {@code this == val}
+     */
+    boolean equal(Signed val);
+
+    /**
+     * Compares this Signed with the specified value.
+     * 
+     * @param val value to which this Signed is to be compared.
+     * @return {@code this != val}
+     */
+    boolean notEqual(Signed val);
+
+    /**
+     * Compares this Signed with the specified value.
+     * 
+     * @param val value to which this Signed is to be compared.
      * @return {@code this < val}
      */
     boolean lessThan(Signed val);
@@ -234,6 +250,22 @@
      * Compares this Signed with the specified value.
      * 
      * @param val value to which this Signed is to be compared.
+     * @return {@code this == val}
+     */
+    boolean equal(int val);
+
+    /**
+     * Compares this Signed with the specified value.
+     * 
+     * @param val value to which this Signed is to be compared.
+     * @return {@code this != val}
+     */
+    boolean notEqual(int val);
+
+    /**
+     * Compares this Signed with the specified value.
+     * 
+     * @param val value to which this Signed is to be compared.
      * @return {@code this < val}
      */
     boolean lessThan(int val);
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java	Tue Feb 05 15:27:40 2013 +0100
@@ -115,6 +115,22 @@
      * Compares this Unsigned with the specified value.
      * 
      * @param val value to which this Unsigned is to be compared.
+     * @return {@code this == val}
+     */
+    boolean equal(Unsigned val);
+
+    /**
+     * Compares this Unsigned with the specified value.
+     * 
+     * @param val value to which this Unsigned is to be compared.
+     * @return {@code this != val}
+     */
+    boolean notEqual(Unsigned val);
+
+    /**
+     * Compares this Unsigned with the specified value.
+     * 
+     * @param val value to which this Unsigned is to be compared.
      * @return {@code this < val}
      */
     boolean belowThan(Unsigned val);
@@ -260,6 +276,28 @@
      * Therefore, the result is only well-defined for positive right operands.
      * 
      * @param val value to which this Unsigned is to be compared.
+     * @return {@code this == val}
+     */
+    boolean equal(int val);
+
+    /**
+     * Compares this Unsigned with the specified value.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
+     * @param val value to which this Unsigned is to be compared.
+     * @return {@code this != val}
+     */
+    boolean notEqual(int val);
+
+    /**
+     * Compares this Unsigned with the specified value.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
+     * @param val value to which this Unsigned is to be compared.
      * @return {@code this < val}
      */
     boolean belowThan(int val);
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Tue Feb 05 15:27:40 2013 +0100
@@ -25,9 +25,9 @@
 import static com.oracle.graal.graph.UnsafeAccess.*;
 
 import java.lang.annotation.*;
-import java.util.concurrent.*;
 
 import com.oracle.graal.api.code.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 
@@ -415,6 +415,52 @@
     }
 
     @Override
+    @Operation(opcode = Opcode.COMPARISON, condition = Condition.EQ)
+    public boolean equal(Signed val) {
+        return equal((Word) val);
+    }
+
+    @Override
+    @Operation(opcode = Opcode.COMPARISON, condition = Condition.EQ)
+    public boolean equal(Unsigned val) {
+        return equal((Word) val);
+    }
+
+    @Override
+    @Operation(opcode = Opcode.COMPARISON, condition = Condition.EQ)
+    public boolean equal(int val) {
+        return equal(intParam(val));
+    }
+
+    @Operation(opcode = Opcode.COMPARISON, condition = Condition.EQ)
+    public boolean equal(Word val) {
+        return unbox() == val.unbox();
+    }
+
+    @Override
+    @Operation(opcode = Opcode.COMPARISON, condition = Condition.NE)
+    public boolean notEqual(Signed val) {
+        return notEqual((Word) val);
+    }
+
+    @Override
+    @Operation(opcode = Opcode.COMPARISON, condition = Condition.NE)
+    public boolean notEqual(Unsigned val) {
+        return notEqual((Word) val);
+    }
+
+    @Override
+    @Operation(opcode = Opcode.COMPARISON, condition = Condition.NE)
+    public boolean notEqual(int val) {
+        return notEqual(intParam(val));
+    }
+
+    @Operation(opcode = Opcode.COMPARISON, condition = Condition.NE)
+    public boolean notEqual(Word val) {
+        return unbox() != val.unbox();
+    }
+
+    @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.LT)
     public boolean lessThan(Signed val) {
         return lessThan((Word) val);
@@ -815,6 +861,21 @@
     public void writeObject(int offset, Object val) {
         writeObject(signed(offset), val);
     }
+
+    @Override
+    public final boolean equals(Object obj) {
+        throw GraalInternalError.shouldNotReachHere("equals must not be called on words");
+    }
+
+    @Override
+    public final int hashCode() {
+        throw GraalInternalError.shouldNotReachHere("hashCode must not be called on words");
+    }
+
+    @Override
+    public String toString() {
+        throw GraalInternalError.shouldNotReachHere("toString must not be called on words");
+    }
 }
 
 final class HostedWord extends Word {
@@ -823,7 +884,6 @@
     private static final int SMALL_TO = 100;
 
     private static final HostedWord[] smallCache = new HostedWord[SMALL_TO - SMALL_FROM + 1];
-    private static final ConcurrentHashMap<Long, HostedWord> cache = new ConcurrentHashMap<>();
 
     static {
         for (int i = SMALL_FROM; i <= SMALL_TO; i++) {
@@ -841,18 +901,16 @@
         if (val >= SMALL_FROM && val <= SMALL_TO) {
             return smallCache[(int) val - SMALL_FROM];
         }
-        Long key = val;
-        HostedWord result = cache.get(key);
-        if (result != null) {
-            return result;
-        }
-        HostedWord newValue = new HostedWord(val);
-        HostedWord oldValue = cache.putIfAbsent(key, newValue);
-        return oldValue == null ? newValue : oldValue;
+        return new HostedWord(val);
     }
 
     @Override
     protected long unbox() {
         return rawValue;
     }
+
+    @Override
+    public String toString() {
+        return "Word<" + rawValue + ">";
+    }
 }
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java	Tue Feb 05 15:27:40 2013 +0100
@@ -95,12 +95,13 @@
             if (x.kind() == wordKind || y.kind() == wordKind) {
                 assert x.kind() == wordKind;
                 assert y.kind() == wordKind;
-                graph.replaceFloating(objectEqualsNode, graph.unique(new IntegerEqualsNode(x, y)));
+
+                // TODO Remove the whole iteration of ObjectEqualsNodes when we are sure that there
+                // is no more code where this triggers.
+                throw GraalInternalError.shouldNotReachHere("Comparison of words with == and != is no longer supported");
             }
         }
 
-        // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are
-        // words
         for (LoadIndexedNode load : graph.getNodes().filter(LoadIndexedNode.class).snapshot()) {
             if (isWord(load)) {
                 load.setStamp(StampFactory.forKind(wordKind));
@@ -284,7 +285,19 @@
     }
 
     public boolean isWord(ValueNode node) {
+        /*
+         * If we already know that we have a word type, we do not need to infer the stamp. This
+         * avoids exceptions in inferStamp when the inputs have already been rewritten to word,
+         * i.e., when the expected input is no longer an object.
+         */
+        if (isWord0(node)) {
+            return true;
+        }
         node.inferStamp();
+        return isWord0(node);
+    }
+
+    private boolean isWord0(ValueNode node) {
         if (node.stamp() == StampFactory.forWord()) {
             return true;
         }
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java	Tue Feb 05 15:27:40 2013 +0100
@@ -97,10 +97,8 @@
                         }
                     }
                 } else if (usage instanceof ObjectEqualsNode) {
-                    ObjectEqualsNode compare = (ObjectEqualsNode) usage;
-                    if (compare.x() == node || compare.y() == node) {
-                        verify(isWord(compare.x()) == isWord(compare.y()), node, compare.usages().first(), "cannot mixed word and non-word type in use of '==' or '!='");
-                    }
+                    verify(!isWord(node) || ((ObjectEqualsNode) usage).x() != node, node, usage, "cannot use word type in comparison");
+                    verify(!isWord(node) || ((ObjectEqualsNode) usage).y() != node, node, usage, "cannot use word type in comparison");
                 } else if (usage instanceof ArrayLengthNode) {
                     verify(!isWord(node) || ((ArrayLengthNode) usage).array() != node, node, usage, "cannot get array length from word value");
                 } else if (usage instanceof PhiNode) {
@@ -148,7 +146,7 @@
             return buf.toString();
         } else {
             String loc = GraphUtil.approxSourceLocation(n);
-            return loc == null ? "<unknown>" : loc;
+            return loc == null ? MetaUtil.format("method %h.%n", ((StructuredGraph) n.graph()).method()) : loc;
         }
     }
 }
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java	Tue Feb 05 15:27:40 2013 +0100
@@ -41,12 +41,12 @@
  * </p>
  * 
  * <p>
- * There are five primitive types for slots available: {@link java.lang.Boolean}, @{link
- * java.lang.Integer}, {@link java.lang.Long}, {@link java.lang.Float}, and {@link java.lang.Double}
- * . It is encouraged to use those types whenever possible. Dynamically typed languages can
- * speculate on the type of a value fitting into a primitive (see
+ * There are five primitive types for slots available: {@link java.lang.Boolean},
+ * {@link java.lang.Integer}, {@link java.lang.Long}, {@link java.lang.Float}, and
+ * {@link java.lang.Double} . It is encouraged to use those types whenever possible. Dynamically
+ * typed languages can speculate on the type of a value fitting into a primitive (see
  * {@link FrameSlotTypeSpecializationTest}). When a frame slot is of one of those particular
- * primitive types, its value may only be accessed with the repectively typed getter method (
+ * primitive types, its value may only be accessed with the respectively typed getter method (
  * {@link Frame#getBoolean}, {@link Frame#getInt}, {@link Frame#getLong}, {@link Frame#getFloat}, or
  * {@link Frame#getDouble}) or setter method ({@link Frame#setBoolean}, {@link Frame#setInt},
  * {@link Frame#setLong}, {@link Frame#setFloat}, or {@link Frame#setDouble}) in the {@link Frame}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Log.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Log.java	Tue Feb 05 15:27:40 2013 +0100
@@ -33,6 +33,8 @@
  */
 public class Log {
 
+    public static final boolean DEBUG = false;
+
     private final ProcessingEnvironment processingEnv;
 
     public Log(ProcessingEnvironment env) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationValue.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationValue.java	Tue Feb 05 15:27:40 2013 +0100
@@ -31,22 +31,16 @@
 
     private final Object value;
 
-    // @formatter:off
     public CodeAnnotationValue(Object value) {
         Objects.requireNonNull(value);
-        if ((value instanceof AnnotationMirror) || (value instanceof List< ? >)
-                        || (value instanceof Boolean) || (value instanceof Byte)
-                        || (value instanceof Character) || (value instanceof Double)
-                        || (value instanceof VariableElement) || (value instanceof Float)
-                        || (value instanceof Integer) || (value instanceof Long)
-                        || (value instanceof Short) || (value instanceof String)
-                        || (value instanceof TypeMirror)) {
+        if ((value instanceof AnnotationMirror) || (value instanceof List<?>) || (value instanceof Boolean) || (value instanceof Byte) || (value instanceof Character) || (value instanceof Double) ||
+                        (value instanceof VariableElement) || (value instanceof Float) || (value instanceof Integer) || (value instanceof Long) || (value instanceof Short) ||
+                        (value instanceof String) || (value instanceof TypeMirror)) {
             this.value = value;
         } else {
             throw new IllegalArgumentException("Invalid annotation value type " + value.getClass().getName());
         }
     }
-    // @formatter:on
 
     @Override
     public Object getValue() {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/AbstractCodeWriter.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/AbstractCodeWriter.java	Tue Feb 05 15:27:40 2013 +0100
@@ -434,16 +434,6 @@
         }
     }
 
-    // @Override
-    // public void visitParameter(CodeVariableElement e) {
-    // for (CodeAnnotationMirror annotation : e.getAnnotationMirrors()) {
-    // annotation.accept(this);
-    // }
-    // write(typeSimpleName(e.getType()));
-    // write(" ");
-    // write(e.getSimpleName());
-    // }
-
     @Override
     public Void visitExecutable(CodeExecutableElement e, Void p) {
         for (AnnotationMirror annotation : e.getAnnotationMirrors()) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java	Tue Feb 05 15:27:40 2013 +0100
@@ -653,13 +653,13 @@
             if (specialization.getExceptions().length > 0) {
                 for (SpecializationThrowsData exception : specialization.getExceptions()) {
                     builder.end().startCatchBlock(exception.getJavaClass(), "ex");
-                    buildThrowSpecialize(builder, exception.getTransitionTo(), null);
+                    buildThrowSpecialize(builder, specialization, exception.getTransitionTo(), null);
                 }
                 builder.end();
             }
             if (specialization.hasDynamicGuards()) {
                 builder.end().startElseBlock();
-                buildThrowSpecialize(builder, specialization.findNextSpecialization(), null);
+                buildThrowSpecialize(builder, specialization, specialization.findNextSpecialization(), null);
                 builder.end();
             }
         }
@@ -737,7 +737,7 @@
                         execute = true;
                     }
                 }
-                buildThrowSpecialize(builder, specialization.findNextSpecialization(), param.getSpecification());
+                buildThrowSpecialize(builder, specialization, specialization.findNextSpecialization(), param.getSpecification());
                 builder.end(); // catch block
             }
 
@@ -785,7 +785,7 @@
             }
         }
 
-        private void buildThrowSpecialize(CodeTreeBuilder builder, SpecializationData nextSpecialization, ParameterSpec exceptionSpec) {
+        private void buildThrowSpecialize(CodeTreeBuilder builder, SpecializationData currentSpecialization, SpecializationData nextSpecialization, ParameterSpec exceptionSpec) {
             boolean canThrowUnexpected = Utils.canThrowType(builder.findMethod().getThrownTypes(), getContext().getTruffleTypes().getUnexpectedValueException());
 
             CodeTreeBuilder specializeCall = CodeTreeBuilder.createBuilder();
@@ -795,10 +795,12 @@
             specializeCall.end().end();
 
             if (canThrowUnexpected) {
-                builder.startThrow();
-                builder.startNew(getContext().getTruffleTypes().getUnexpectedValueException());
+                builder.startReturn();
+                TypeData expectedType = currentSpecialization.getReturnType().getActualTypeData(currentSpecialization.getNode().getTypeSystem());
+                startCallTypeSystemMethod(context, builder, currentSpecialization.getNode(), TypeSystemCodeGenerator.expectTypeMethodName(expectedType));
                 builder.tree(specializeCall.getRoot());
                 builder.end().end();
+                builder.end(); // return
             } else {
                 builder.startReturn();
                 builder.tree(specializeCall.getRoot());
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java	Tue Feb 05 15:27:40 2013 +0100
@@ -133,7 +133,8 @@
         } else {
             ExecutableTypeData execType = null;
             for (ExecutableTypeData type : types) {
-                if (!type.getReturnType().getActualTypeData(getTypeSystem()).isVoid()) {
+                TypeData returnType = type.getReturnType().getActualTypeData(getTypeSystem());
+                if (!returnType.isVoid()) {
                     if (execType != null) {
                         // multiple generic types not allowed
                         return null;
@@ -280,25 +281,12 @@
         return specializations;
     }
 
-    // @formatter:off
     public String dump() {
         StringBuilder b = new StringBuilder();
-        b.append(String.format("[name = %s\n" +
-                        "  typeSystem = %s\n" +
-                        "  fields = %s\n" +
-                        "  types = %s\n" +
-                        "  specializations = %s\n" +
-                        "  guards = %s\n" +
-                        "]", Utils.getQualifiedName(getTemplateType()),
-                            getTypeSystem(),
-                            dumpList(fields),
-                            dumpList(getExecutableTypes()),
-                            dumpList(getSpecializations()),
-                            dumpList(guards)
-                        ));
+        b.append(String.format("[name = %s\n" + "  typeSystem = %s\n" + "  fields = %s\n" + "  types = %s\n" + "  specializations = %s\n" + "  guards = %s\n" + "]",
+                        Utils.getQualifiedName(getTemplateType()), getTypeSystem(), dumpList(fields), dumpList(getExecutableTypes()), dumpList(getSpecializations()), dumpList(guards)));
         return b.toString();
     }
-    // @formatter:on
 
     private static String dumpList(Object[] array) {
         if (array == null) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeParser.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeParser.java	Tue Feb 05 15:27:40 2013 +0100
@@ -44,8 +44,6 @@
     public static final List<Class<? extends Annotation>> ANNOTATIONS = Arrays.asList(Generic.class, GuardCheck.class, TypeSystemReference.class, ShortCircuit.class, Specialization.class,
                     SpecializationGuard.class, SpecializationListener.class, SpecializationThrows.class);
 
-    private static final boolean DEBUG = false;
-
     private Map<String, NodeData> parsedNodes;
     private TypeElement originalType;
 
@@ -62,7 +60,7 @@
 
             return parseInnerClassHierarchy((TypeElement) element);
         } finally {
-            if (DEBUG) {
+            if (Log.DEBUG) {
                 NodeData parsed = parsedNodes.get(Utils.getQualifiedName(originalType));
                 if (parsed != null) {
                     String dump = parsed.dump();
@@ -149,7 +147,7 @@
         nodeData.setExecutableTypes(executableTypes.toArray(new ExecutableTypeData[executableTypes.size()]));
 
         parsedNodes.put(Utils.getQualifiedName(type), nodeData); // node fields will resolve node
-                                                                 // types, to avoid endless loops
+// types, to avoid endless loops
 
         NodeFieldData[] fields = parseFields(nodeData, elements, typeHierarchy);
         if (fields == null) {
@@ -319,6 +317,19 @@
                 filteredExecutableTypes.add(t1);
             }
         }
+
+        Collections.sort(filteredExecutableTypes, new Comparator<ExecutableTypeData>() {
+
+            @Override
+            public int compare(ExecutableTypeData o1, ExecutableTypeData o2) {
+                int index1 = o1.getTypeSystem().findType(o1.getType());
+                int index2 = o2.getTypeSystem().findType(o2.getType());
+                if (index1 == -1 || index2 == -1) {
+                    return 0;
+                }
+                return index1 - index2;
+            }
+        });
         return filteredExecutableTypes;
     }
 
@@ -425,7 +436,8 @@
                 context.getLog().error(errorElement, "Node type '%s' is invalid.", Utils.getQualifiedName(nodeType));
                 return null;
             } else if (fieldNodeData.findGenericExecutableType(context) == null) {
-                context.getLog().error(errorElement, "No executable generic type found for node '%s'.", Utils.getQualifiedName(nodeType));
+                // TODO better error handling for (no or multiple?)
+                context.getLog().error(errorElement, "No or multiple executable generic types found for node '%s'.", Utils.getQualifiedName(nodeType));
                 return null;
             }
         }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationMethodParser.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationMethodParser.java	Tue Feb 05 15:27:40 2013 +0100
@@ -144,7 +144,8 @@
                 ParameterSpec spec = param.getSpecification();
                 expectedParameterSpecs.add(new ParameterSpec(spec.getName(), param.getActualType(), false));
             }
-            String expectedSignature = TemplateMethodParser.createExpectedSignature(specializationGuard.getGuardMethod(), returnTypeSpec, expectedParameterSpecs);
+            List<TypeDef> typeDefs = createTypeDefinitions(returnTypeSpec, expectedParameterSpecs);
+            String expectedSignature = TemplateMethodParser.createExpectedSignature(specializationGuard.getGuardMethod(), returnTypeSpec, expectedParameterSpecs, typeDefs);
             AnnotationValue value = Utils.getAnnotationValue(mirror, "methodName");
             getContext().getLog().error(specialization.getMethod(), mirror, value, "No guard with signature '%s' found in type system.", expectedSignature);
             return null;
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethodParser.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethodParser.java	Tue Feb 05 15:27:40 2013 +0100
@@ -120,6 +120,8 @@
             return null;
         }
 
+        List<TypeDef> typeDefs = createTypeDefinitions(methodSpecification.getReturnType(), methodSpecification.getParameters());
+
         ParameterSpec returnTypeSpec = methodSpecification.getReturnType();
         List<ParameterSpec> parameterSpecs = new ArrayList<>();
         parameterSpecs.addAll(methodSpecification.getParameters());
@@ -127,11 +129,11 @@
         ActualParameter returnTypeMirror = resolveTypeMirror(returnTypeSpec, method.getReturnType(), template);
         if (returnTypeMirror == null) {
             if (isEmitErrors()) {
-                String expectedReturnType = createTypeSignature(returnTypeSpec, true);
+                String expectedReturnType = createTypeSignature(returnTypeSpec, typeDefs, true);
                 String actualReturnType = Utils.getSimpleName(method.getReturnType());
 
                 String message = String.format("The provided return type \"%s\" does not match expected return type \"%s\".\nExpected signature: \n %s", actualReturnType, expectedReturnType,
-                                createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
+                                createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs, typeDefs));
 
                 context.getLog().error(method, annotation, message);
             }
@@ -160,10 +162,10 @@
                 } else if (!specification.isOptional()) {
                     if (isEmitErrors()) {
                         // non option type specification found -> argument missing
-                        String expectedType = createTypeSignature(specification, false);
+                        String expectedType = createTypeSignature(specification, typeDefs, false);
 
                         String message = String.format("Missing argument \"%s\".\nExpected signature: \n %s", expectedType,
-                                        createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
+                                        createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs, typeDefs));
 
                         context.getLog().error(method, message);
                     }
@@ -184,11 +186,11 @@
                 }
 
                 if (isEmitErrors()) {
-                    String expectedReturnType = createTypeSignature(specification, false);
+                    String expectedReturnType = createTypeSignature(specification, typeDefs, false);
                     String actualReturnType = Utils.getSimpleName(parameter.asType()) + " " + parameter.getSimpleName();
 
                     String message = String.format("The provided argument type \"%s\" does not match expected type \"%s\".\nExpected signature: \n %s", actualReturnType, expectedReturnType,
-                                    createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
+                                    createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs, typeDefs));
 
                     context.getLog().error(parameter, message);
                 }
@@ -208,7 +210,7 @@
             if (isEmitErrors()) {
                 String actualReturnType = Utils.getSimpleName(parameter.asType()) + " " + parameter.getSimpleName();
                 String message = String.format("No argument expected but found \"%s\".\nExpected signature: \n %s", actualReturnType,
-                                createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
+                                createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs, typeDefs));
 
                 context.getLog().error(parameter, message);
             }
@@ -231,11 +233,67 @@
         return new ActualParameter(specification, resolvedType);
     }
 
-    public static String createExpectedSignature(String methodName, ParameterSpec returnType, List<? extends ParameterSpec> parameters) {
+    protected static List<TypeDef> createTypeDefinitions(ParameterSpec returnType, List<? extends ParameterSpec> parameters) {
+        List<TypeDef> typeDefs = new ArrayList<>();
+
+        TypeMirror[] types = returnType.getAllowedTypes();
+        List<ParameterSpec> allParams = new ArrayList<>();
+        allParams.add(returnType);
+        allParams.addAll(parameters);
+
+        int defIndex = 0;
+        for (ParameterSpec spec : allParams) {
+            TypeMirror[] allowedTypes = spec.getAllowedTypes();
+            if (types != null && allowedTypes.length > 1) {
+                TypeDef foundDef = null;
+                for (TypeDef def : typeDefs) {
+                    if (Arrays.equals(spec.getAllowedTypes(), def.getTypes())) {
+                        foundDef = def;
+                        break;
+                    }
+                }
+                if (foundDef == null) {
+                    foundDef = new TypeDef(types, "Types" + defIndex);
+                    typeDefs.add(foundDef);
+                    defIndex++;
+                }
+
+                foundDef.getParameters().add(spec);
+            }
+        }
+
+        return typeDefs;
+    }
+
+    protected static class TypeDef {
+
+        private final TypeMirror[] types;
+        private final String name;
+        private final List<ParameterSpec> parameters = new ArrayList<>();
+
+        public TypeDef(TypeMirror[] types, String name) {
+            this.types = types;
+            this.name = name;
+        }
+
+        public List<ParameterSpec> getParameters() {
+            return parameters;
+        }
+
+        public TypeMirror[] getTypes() {
+            return types;
+        }
+
+        public String getName() {
+            return name;
+        }
+    }
+
+    public static String createExpectedSignature(String methodName, ParameterSpec returnType, List<? extends ParameterSpec> parameters, List<TypeDef> typeDefs) {
         StringBuilder b = new StringBuilder();
 
         b.append("    ");
-        b.append(createTypeSignature(returnType, true));
+        b.append(createTypeSignature(returnType, typeDefs, true));
 
         b.append(" ");
         b.append(methodName);
@@ -250,7 +308,7 @@
                 b.append("{");
             }
 
-            b.append(createTypeSignature(specification, false));
+            b.append(createTypeSignature(specification, typeDefs, false));
 
             if (specification.isOptional()) {
                 b.append("]");
@@ -268,34 +326,40 @@
 
         b.append(")");
 
-        TypeMirror[] types = null;
+        if (!typeDefs.isEmpty()) {
+            b.append("\n\n");
 
-        // TODO allowed types may differ so different <Any> must be generated.
-        if (returnType.getAllowedTypes().length > 1) {
-            types = returnType.getAllowedTypes();
-        }
-        for (ParameterSpec param : parameters) {
-            if (param.getAllowedTypes().length > 1) {
-                types = param.getAllowedTypes();
+            String lineSep = "";
+            for (TypeDef def : typeDefs) {
+                b.append(lineSep);
+                b.append("    <").append(def.getName()).append(">");
+                b.append(" = {");
+                String separator = "";
+                for (TypeMirror type : def.getTypes()) {
+                    b.append(separator).append(Utils.getSimpleName(type));
+                    separator = ", ";
+                }
+                b.append("}");
+                lineSep = "\n";
+
             }
         }
-        if (types != null) {
-            b.append("\n\n    ");
-            b.append("<Any> = {");
-            String separator = "";
-            for (TypeMirror type : types) {
-                b.append(separator).append(Utils.getSimpleName(type));
-                separator = ", ";
-            }
-            b.append("}");
-        }
         return b.toString();
     }
 
-    private static String createTypeSignature(ParameterSpec spec, boolean typeOnly) {
+    private static String createTypeSignature(ParameterSpec spec, List<TypeDef> typeDefs, boolean typeOnly) {
         StringBuilder builder = new StringBuilder();
         if (spec.getAllowedTypes().length > 1) {
-            builder.append("<Any>");
+            TypeDef foundTypeDef = null;
+            for (TypeDef typeDef : typeDefs) {
+                if (typeDef.getParameters().contains(spec)) {
+                    foundTypeDef = typeDef;
+                    break;
+                }
+            }
+            if (foundTypeDef != null) {
+                builder.append("<" + foundTypeDef.getName() + ">");
+            }
         } else if (spec.getAllowedTypes().length == 1) {
             builder.append(Utils.getSimpleName(spec.getAllowedTypes()[0]));
         } else {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java	Tue Feb 05 15:27:32 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java	Tue Feb 05 15:27:40 2013 +0100
@@ -114,6 +114,10 @@
         return types[index];
     }
 
+    public int findType(TypeData typeData) {
+        return findType(typeData.getPrimitiveType());
+    }
+
     public int findType(TypeMirror type) {
         for (int i = 0; i < types.length; i++) {
             if (Utils.typeEquals(types[i].getPrimitiveType(), type)) {
--- a/mx/projects	Tue Feb 05 15:27:32 2013 +0100
+++ b/mx/projects	Tue Feb 05 15:27:40 2013 +0100
@@ -55,13 +55,6 @@
 project@com.oracle.graal.api.code@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.api.code@javaCompliance=1.7
 
-# graal.api.interpreter
-project@com.oracle.graal.api.interpreter@subDir=graal
-project@com.oracle.graal.api.interpreter@sourceDirs=src
-project@com.oracle.graal.api.interpreter@dependencies=com.oracle.graal.api.meta
-project@com.oracle.graal.api.interpreter@checkstyle=com.oracle.graal.graph
-project@com.oracle.graal.api.interpreter@javaCompliance=1.7
-
 # graal.amd64
 project@com.oracle.graal.amd64@subDir=graal
 project@com.oracle.graal.amd64@sourceDirs=src
@@ -72,7 +65,7 @@
 # graal.hotspot
 project@com.oracle.graal.hotspot@subDir=graal
 project@com.oracle.graal.hotspot@sourceDirs=src
-project@com.oracle.graal.hotspot@dependencies=com.oracle.graal.snippets,com.oracle.graal.api.interpreter,com.oracle.graal.api.runtime,com.oracle.graal.printer
+project@com.oracle.graal.hotspot@dependencies=com.oracle.graal.snippets,com.oracle.graal.api.runtime,com.oracle.graal.printer
 project@com.oracle.graal.hotspot@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.hotspot@javaCompliance=1.7
 
@@ -165,13 +158,6 @@
 project@com.oracle.graal.nodes@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.nodes@javaCompliance=1.7
 
-# graal.interpreter
-project@com.oracle.graal.interpreter@subDir=graal
-project@com.oracle.graal.interpreter@sourceDirs=src
-project@com.oracle.graal.interpreter@dependencies=com.oracle.graal.api.interpreter,com.oracle.graal.bytecode,com.oracle.graal.api.runtime
-project@com.oracle.graal.interpreter@checkstyle=com.oracle.graal.graph
-project@com.oracle.graal.interpreter@javaCompliance=1.7
-
 # graal.phases
 project@com.oracle.graal.phases@subDir=graal
 project@com.oracle.graal.phases@sourceDirs=src
--- a/mxtool/mx.py	Tue Feb 05 15:27:32 2013 +0100
+++ b/mxtool/mx.py	Tue Feb 05 15:27:40 2013 +0100
@@ -2096,21 +2096,23 @@
                 out.close('buildCommand')
 
         if (_needsEclipseJarBuild(p)):
-            out.open('buildCommand')
-            out.element('name', data='org.eclipse.ui.externaltools.ExternalToolBuilder')
-            out.element('triggers', data='auto,full,incremental,')
-            out.open('arguments')
-            out.open('dictionary')
-            out.element('key', data = 'LaunchConfigHandle')
-            out.element('value', data = _genEclipseJarBuild(p))
-            out.close('dictionary')
-            out.open('dictionary')
-            out.element('key', data = 'incclean')
-            out.element('value', data = 'true')
-            out.close('dictionary')
-            out.close('arguments')
-            out.close('buildCommand')       
-                
+            targetValues = _genEclipseJarBuild(p);
+            for value in targetValues:
+                out.open('buildCommand')
+                out.element('name', data='org.eclipse.ui.externaltools.ExternalToolBuilder')
+                out.element('triggers', data='auto,full,incremental,')
+                out.open('arguments')
+                out.open('dictionary')
+                out.element('key', data = 'LaunchConfigHandle')
+                out.element('value', data = value)
+                out.close('dictionary')
+                out.open('dictionary')
+                out.element('key', data = 'incclean')
+                out.element('value', data = 'true')
+                out.close('dictionary')
+                out.close('arguments')
+                out.close('buildCommand')       
+                    
         out.close('buildSpec')
         out.open('natures')
         out.element('nature', data='org.eclipse.jdt.core.javanature')
@@ -2184,12 +2186,20 @@
     return False
 
 def _genEclipseJarBuild(p):
+    builders = []
+    builders.append(_genEclipseLaunch(p, 'Jar.launch', ''.join(['jar ', p.name]), refresh = False, async = False))
+    builders.append(_genEclipseLaunch(p, 'Refresh.launch', '', refresh = True, async = True))
+    return builders
+
+def _genEclipseLaunch(p, name, mxCommand, refresh=True, async=False):
     launchOut = XMLDoc();
     launchOut.open('launchConfiguration', {'type' : 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType'})
-    launchOut.element('stringAttribute',  {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE',            'value': '${project}'})
+    if refresh:
+        launchOut.element('stringAttribute',  {'key' : 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE',            'value': '${project}'})
     launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.core.capture_output',                'value': 'false'})
     launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON',          'value': 'false'})
-    launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND',       'value': 'true'})
+    if async:
+        launchOut.element('booleanAttribute', {'key' : 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND',       'value': 'true'})
     
     baseDir = dirname(dirname(os.path.abspath(__file__)))
     
@@ -2198,7 +2208,7 @@
         cmd = 'mx.cmd'
     launchOut.element('stringAttribute',  {'key' : 'org.eclipse.ui.externaltools.ATTR_LOCATION',           'value': join(baseDir, cmd) })
     launchOut.element('stringAttribute',  {'key' : 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS',    'value': 'auto,full,incremental'})
-    launchOut.element('stringAttribute',  {'key' : 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS',     'value': ''.join(['jar', ' ', p.name])})
+    launchOut.element('stringAttribute',  {'key' : 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS',     'value': mxCommand})
     launchOut.element('booleanAttribute', {'key' : 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED','value': 'true'})
     launchOut.element('stringAttribute',  {'key' : 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY',  'value': baseDir})
     
@@ -2209,11 +2219,9 @@
     
     if not exists(externalToolDir):
         os.makedirs(externalToolDir)
-    update_file(join(externalToolDir, 'Jar.launch'), launchOut.xml(indent='\t', newl='\n'))
+    update_file(join(externalToolDir, name), launchOut.xml(indent='\t', newl='\n'))
     
-    return "<project>/.externalToolBuilders/Jar.launch"
-
-
+    return ''.join(["<project>/.externalToolBuilders/", name])
 
 
 def netbeansinit(args, suite=None):
--- a/src/os/windows/vm/os_windows.cpp	Tue Feb 05 15:27:32 2013 +0100
+++ b/src/os/windows/vm/os_windows.cpp	Tue Feb 05 15:27:40 2013 +0100
@@ -2103,18 +2103,32 @@
 #ifdef _M_IA64
   assert(0, "Fix Handle_IDiv_Exception");
 #elif _M_AMD64
-  PCONTEXT ctx = exceptionInfo->ContextRecord;
-  address pc = (address)ctx->Rip;
-#ifndef GRAAL
-  assert(pc[0] == 0xF7, "not an idiv opcode");
-  assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
-  assert(ctx->Rax == min_jint, "unexpected idiv exception");
-#endif
-  // set correct result values and continue after idiv instruction
-  ctx->Rip = (DWORD)pc + 2;        // idiv reg, reg  is 2 bytes
-  ctx->Rax = (DWORD)min_jint;      // result
-  ctx->Rdx = (DWORD)0;             // remainder
-  // Continue the execution
+  #ifdef GRAAL
+    PCONTEXT ctx = exceptionInfo->ContextRecord;
+    address pc = (address)ctx->Rip;
+    assert(pc[0] == 0x48 && pc[1] == 0xF7 || pc[0] == 0xF7, "not an idiv opcode");
+    if (pc[0] == 0x48) {
+      // set correct result values and continue after idiv instruction
+      ctx->Rip = (DWORD64)pc + 3;        // REX idiv reg, reg  is 3 bytes
+      ctx->Rax = (DWORD64)min_jlong;     // result
+    } else {
+      ctx->Rip = (DWORD64)pc + 2;        // idiv reg, reg  is 2 bytes
+      ctx->Rax = (DWORD64)min_jint;      // result
+    }
+    ctx->Rdx = (DWORD64)0;             // remainder
+    // Continue the execution
+  #else
+    PCONTEXT ctx = exceptionInfo->ContextRecord;
+    address pc = (address)ctx->Rip;
+    assert(pc[0] == 0xF7, "not an idiv opcode");
+    assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
+    assert(ctx->Rax == min_jint, "unexpected idiv exception");
+    // set correct result values and continue after idiv instruction
+    ctx->Rip = (DWORD)pc + 2;        // idiv reg, reg  is 2 bytes
+    ctx->Rax = (DWORD)min_jint;      // result
+    ctx->Rdx = (DWORD)0;             // remainder
+    // Continue the execution
+  #endif // GRAAL
 #else
   PCONTEXT ctx = exceptionInfo->ContextRecord;
   address pc = (address)ctx->Eip;
--- a/src/share/vm/code/nmethod.cpp	Tue Feb 05 15:27:32 2013 +0100
+++ b/src/share/vm/code/nmethod.cpp	Tue Feb 05 15:27:40 2013 +0100
@@ -595,7 +595,7 @@
 {
   assert(debug_info->oop_recorder() == code_buffer->oop_recorder(), "shared OR");
   code_buffer->finalize_oop_references(method);
-  size_t leaf_graph_ids_size = leaf_graph_ids == NULL ? 0 : round_to(sizeof(jlong) * leaf_graph_ids->length(), oopSize);
+  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);
@@ -911,7 +911,7 @@
       _unwind_handler_offset = -1;
     }
 
-    size_t leaf_graph_ids_size = leaf_graph_ids == NULL ? 0 : round_to(sizeof(jlong) * leaf_graph_ids->length(), oopSize);
+    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);
--- a/src/share/vm/runtime/arguments.cpp	Tue Feb 05 15:27:32 2013 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Tue Feb 05 15:27:40 2013 +0100
@@ -2270,7 +2270,6 @@
           "com.oracle.graal.api.runtime",
           "com.oracle.graal.api.meta",
           "com.oracle.graal.api.code",
-          "com.oracle.graal.api.interpreter",
           "com.oracle.graal.hotspot",
           "com.oracle.graal.asm",
           "com.oracle.graal.alloc",
--- a/src/share/vm/runtime/compilationPolicy.cpp	Tue Feb 05 15:27:32 2013 +0100
+++ b/src/share/vm/runtime/compilationPolicy.cpp	Tue Feb 05 15:27:40 2013 +0100
@@ -492,7 +492,7 @@
   int hot_count = m->backedge_count();
   const char* comment = "backedge_count";
 
-  if (is_compilation_enabled() && !m->is_not_osr_compilable() && can_be_compiled(m)) {
+  if (is_compilation_enabled() && !m->is_not_osr_compilable() && can_be_compiled(m) && !m->queued_for_compilation() && m->code() == NULL) {
     if (TraceCompilationPolicy) {
       tty->print("backedge invocation trigger: ");
       m->print_short_name(tty);
--- a/src/share/vm/runtime/java.cpp	Tue Feb 05 15:27:32 2013 +0100
+++ b/src/share/vm/runtime/java.cpp	Tue Feb 05 15:27:40 2013 +0100
@@ -375,6 +375,10 @@
     CompileBroker::print_times();
   }
 
+  if(PrintNMethodStatistics) {
+    nmethod::print_statistics();
+  }
+
   if (PrintCodeCache) {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     CodeCache::print();