changeset 17441:3a586c78a807

Merge.
author Chris Seaton <chris.seaton@oracle.com>
date Tue, 14 Oct 2014 16:48:09 +0100
parents 935de03661c1 (current diff) b0e8bc17af1b (diff)
children ecc27b9d2510
files
diffstat 20 files changed, 55 insertions(+), 227 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ArithmeticOperation.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ArithmeticOperation.java	Tue Oct 14 16:48:09 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,9 @@
  */
 package com.oracle.graal.api.code;
 
-import com.oracle.graal.api.meta.*;
-
 /**
  * An {@code ArithmeticOperation} is an operation that does primitive value arithmetic without side
  * effect.
  */
 public interface ArithmeticOperation {
-
-    Constant evalConst(Constant... inputs);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -162,7 +162,7 @@
     @Override
     public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
         if (forValue.isConstant()) {
-            return ConstantNode.forConstant(stamp(), evalConst(forValue.asConstant()), tool.getMetaAccess());
+            return ConstantNode.forConstant(stamp(), convert(forValue.asConstant()), tool.getMetaAccess());
         } else if (forValue instanceof CompressionNode) {
             CompressionNode other = (CompressionNode) forValue;
             if (op != other.op && encoding.equals(other.encoding)) {
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/NegateNodeCanonicalizationTest.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/NegateNodeCanonicalizationTest.java	Tue Oct 14 16:48:09 2014 +0100
@@ -27,8 +27,8 @@
 import org.junit.*;
 
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.calc.*;
 
 /**
  * This class tests that the canonicalization for constant negate nodes cover all cases.
@@ -48,7 +48,7 @@
         for (byte i : a) {
             ConstantNode node = ConstantNode.forByte(i, graph);
             Constant expected = Constant.forInt(-i);
-            assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant()));
+            assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
         }
     }
 
@@ -58,7 +58,7 @@
         for (char i : a) {
             ConstantNode node = ConstantNode.forChar(i, graph);
             Constant expected = Constant.forInt(-i);
-            assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant()));
+            assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
         }
     }
 
@@ -68,7 +68,7 @@
         for (short i : a) {
             ConstantNode node = ConstantNode.forShort(i, graph);
             Constant expected = Constant.forInt(-i);
-            assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant()));
+            assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
         }
     }
 
@@ -78,7 +78,7 @@
         for (int i : a) {
             ConstantNode node = ConstantNode.forInt(i, graph);
             Constant expected = Constant.forInt(-i);
-            assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant()));
+            assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
         }
     }
 
@@ -88,7 +88,7 @@
         for (long i : a) {
             ConstantNode node = ConstantNode.forLong(i, graph);
             Constant expected = Constant.forLong(-i);
-            assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant()));
+            assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
         }
     }
 
@@ -98,7 +98,7 @@
         for (float i : a) {
             ConstantNode node = ConstantNode.forFloat(i, graph);
             Constant expected = Constant.forFloat(-i);
-            assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant()));
+            assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
         }
     }
 
@@ -108,7 +108,7 @@
         for (double i : a) {
             ConstantNode node = ConstantNode.forDouble(i, graph);
             Constant expected = Constant.forDouble(-i);
-            assertEquals(expected, NegateNode.create(node).evalConst(node.asConstant()));
+            assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
         }
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryArithmeticNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryArithmeticNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -56,12 +56,6 @@
     }
 
     @Override
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 2;
-        return getOp(getX(), getY()).foldConstant(inputs[0], inputs[1]);
-    }
-
-    @Override
     public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
         if (forX.isConstant() && forY.isConstant()) {
             Constant ret = getOp(forX, forY).foldConstant(forX.asConstant(), forY.asConstant());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -56,10 +56,5 @@
         return isLossless();
     }
 
-    default Constant evalConst(Constant... inputs) {
-        assert inputs.length == 1;
-        return convert(inputs[0]);
-    }
-
     ValueNode asNode();
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -46,14 +46,12 @@
         return updateStamp(StampTool.leftShift(getX().stamp(), getY().stamp()));
     }
 
-    @Override
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 2;
-        if (getKind() == Kind.Int) {
-            return Constant.forInt(inputs[0].asInt() << inputs[1].asInt());
+    private static Constant evalConst(Constant a, Constant b) {
+        if (a.getKind() == Kind.Int) {
+            return Constant.forInt(a.asInt() << b.asInt());
         } else {
-            assert getKind() == Kind.Long;
-            return Constant.forLong(inputs[0].asLong() << inputs[1].asLong());
+            assert a.getKind() == Kind.Long;
+            return Constant.forLong(a.asLong() << b.asLong());
         }
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -56,9 +56,7 @@
         assert to instanceof PrimitiveStamp;
     }
 
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 1;
-        Constant c = inputs[0];
+    private Constant evalConst(Constant c) {
         assert c.getKind().getBitCount() == ((PrimitiveStamp) stamp()).getBits();
         switch (c.getKind()) {
             case Int:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -47,14 +47,12 @@
         return updateStamp(StampTool.rightShift(getX().stamp(), getY().stamp()));
     }
 
-    @Override
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 2;
-        if (getKind() == Kind.Int) {
-            return Constant.forInt(inputs[0].asInt() >> inputs[1].asInt());
+    private static Constant evalConst(Constant a, Constant b) {
+        if (a.getKind() == Kind.Int) {
+            return Constant.forInt(a.asInt() >> b.asInt());
         } else {
-            assert getKind() == Kind.Long;
-            return Constant.forLong(inputs[0].asLong() >> inputs[1].asLong());
+            assert a.getKind() == Kind.Long;
+            return Constant.forLong(a.asLong() >> b.asLong());
         }
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryArithmeticNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnaryArithmeticNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -24,7 +24,6 @@
 
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp;
 import com.oracle.graal.graph.spi.*;
@@ -46,11 +45,6 @@
         return getOp.apply(ArithmeticOpTable.forStamp(forValue.stamp()));
     }
 
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 1;
-        return getOp(getValue()).foldConstant(inputs[0]);
-    }
-
     @Override
     public boolean inferStamp() {
         return updateStamp(getOp(getValue()).foldStamp(getValue().stamp()));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -46,14 +46,12 @@
         return updateStamp(StampTool.unsignedRightShift(getX().stamp(), getY().stamp()));
     }
 
-    @Override
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 2;
-        if (getKind() == Kind.Int) {
-            return Constant.forInt(inputs[0].asInt() >>> inputs[1].asInt());
+    private static Constant evalConst(Constant a, Constant b) {
+        if (a.getKind() == Kind.Int) {
+            return Constant.forInt(a.asInt() >>> b.asInt());
         } else {
-            assert getKind() == Kind.Long;
-            return Constant.forLong(inputs[0].asLong() >>> inputs[1].asLong());
+            assert a.getKind() == Kind.Long;
+            return Constant.forLong(a.asLong() >>> b.asLong());
         }
     }
 
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64FloatConvertNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.replacements.amd64;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.FloatConvertOp;
 import com.oracle.graal.graph.spi.*;
@@ -53,12 +51,6 @@
     }
 
     @Override
-    public Constant evalConst(Constant... inputs) {
-        // this node should never have been created if its input is constant
-        throw GraalInternalError.shouldNotReachHere();
-    }
-
-    @Override
     public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
         // nothing to do
         return this;
--- a/graal/com.oracle.graal.replacements.hsail/src/com/oracle/graal/replacements/hsail/HSAILMathIntrinsicsNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.replacements.hsail/src/com/oracle/graal/replacements/hsail/HSAILMathIntrinsicsNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -116,20 +116,13 @@
     }
 
     /**
-     * Converts a constant to a boxed double.
-     */
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 1;
-        return Constant.forDouble(compute(inputs[0].asDouble(), operation()));
-    }
-
-    /**
      * Converts the result of the math operation to a boxed Double constant node.
      */
     @Override
     public Node canonical(CanonicalizerTool tool) {
         if (getParameter().isConstant()) {
-            return ConstantNode.forPrimitive(evalConst(getParameter().asConstant()));
+            double ret = compute(getParameter().asConstant().asDouble(), operation());
+            return ConstantNode.forDouble(ret);
         }
         return this;
     }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathIntrinsicNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MathIntrinsicNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -93,15 +93,11 @@
         builder.setResult(this, result);
     }
 
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 1;
-        return Constant.forDouble(doCompute(inputs[0].asDouble(), operation()));
-    }
-
     @Override
     public ValueNode canonical(CanonicalizerTool tool, ValueNode forValue) {
         if (forValue.isConstant()) {
-            return ConstantNode.forPrimitive(evalConst(forValue.asConstant()));
+            double ret = doCompute(forValue.asConstant().asDouble(), operation());
+            return ConstantNode.forDouble(ret);
         }
         return this;
     }
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/AssumptionPartialEvaluationTest.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/AssumptionPartialEvaluationTest.java	Tue Oct 14 16:48:09 2014 +0100
@@ -24,33 +24,26 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.test.nodes.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 
-@Ignore("Currently ignored due to problems with code coverage tools.")
 public class AssumptionPartialEvaluationTest extends PartialEvaluationTest {
-
     public static Object constant42() {
         return 42;
     }
 
     @Test
     public void constantValue() {
-        FrameDescriptor fd = new FrameDescriptor();
         Assumption assumption = Truffle.getRuntime().createAssumption();
         AbstractTestNode result = new ConstantWithAssumptionTestNode(assumption, 42);
-        RootTestNode rootNode = new RootTestNode(fd, "constantValue", result);
-        InstalledCode installedCode = assertPartialEvalEquals("constant42", rootNode);
-        Assert.assertTrue(installedCode.isValid());
-        try {
-            assertDeepEquals(42, installedCode.executeVarargs(null, null, null));
-        } catch (InvalidInstalledCodeException e) {
-            Assert.fail("Code must not have been invalidated.");
-        }
-        Assert.assertTrue(installedCode.isValid());
+        RootTestNode rootNode = new RootTestNode(new FrameDescriptor(), "constantValue", result);
+        OptimizedCallTarget callTarget = assertPartialEvalEquals("constant42", rootNode);
+        Assert.assertTrue(callTarget.isValid());
+        assertDeepEquals(42, callTarget.call());
+        Assert.assertTrue(callTarget.isValid());
         try {
             assumption.check();
         } catch (InvalidAssumptionException e) {
@@ -62,12 +55,7 @@
             Assert.fail("Assumption must have been invalidated.");
         } catch (InvalidAssumptionException e) {
         }
-        Assert.assertFalse(installedCode.isValid());
-
-        try {
-            installedCode.executeVarargs(null, null, null);
-            Assert.fail("Code must have been invalidated.");
-        } catch (InvalidInstalledCodeException e) {
-        }
+        Assert.assertFalse(callTarget.isValid());
+        assertDeepEquals(43, callTarget.call());
     }
 }
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ControlFlowExceptionPartialEvaluationTest.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ControlFlowExceptionPartialEvaluationTest.java	Tue Oct 14 16:48:09 2014 +0100
@@ -28,9 +28,7 @@
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 
-@Ignore("Currently ignored due to problems with code coverage tools.")
 public class ControlFlowExceptionPartialEvaluationTest extends PartialEvaluationTest {
-
     public static Object constant42() {
         return 42;
     }
@@ -50,7 +48,6 @@
     }
 
     public static class ThrowControlFlowExceptionTestNode extends AbstractTestNode {
-
         @Override
         public int execute(VirtualFrame frame) {
             throw new ControlFlowException();
@@ -58,7 +55,6 @@
     }
 
     public static class CatchControlFlowExceptionTestNode extends AbstractTestNode {
-
         @Child private AbstractTestNode child;
 
         public CatchControlFlowExceptionTestNode(AbstractTestNode child) {
@@ -76,7 +72,6 @@
     }
 
     public static class CatchSlowPathAndControlFlowExceptionTestNode extends AbstractTestNode {
-
         @Child private AbstractTestNode child;
 
         public CatchSlowPathAndControlFlowExceptionTestNode(AbstractTestNode child) {
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java	Tue Oct 14 16:48:09 2014 +0100
@@ -22,32 +22,22 @@
  */
 package com.oracle.graal.truffle.test;
 
-import java.util.*;
-
 import org.junit.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.Debug.Scope;
-import com.oracle.graal.java.*;
-import com.oracle.graal.loop.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
-import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.printer.*;
 import com.oracle.graal.truffle.*;
-import com.oracle.graal.virtual.phases.ea.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.nodes.*;
 
 public class PartialEvaluationTest extends GraalCompilerTest {
-
-    private static final long UNROLL_LIMIT = 100;
     private final TruffleCompilerImpl truffleCompiler;
 
     public PartialEvaluationTest() {
@@ -58,19 +48,19 @@
         DebugEnvironment.initialize(System.out);
     }
 
-    protected InstalledCode assertPartialEvalEquals(String methodName, RootNode root) {
+    protected OptimizedCallTarget assertPartialEvalEquals(String methodName, RootNode root) {
         return assertPartialEvalEquals(methodName, root, new Object[0]);
     }
 
-    protected InstalledCode assertPartialEvalEquals(String methodName, RootNode root, Object[] arguments) {
+    protected OptimizedCallTarget assertPartialEvalEquals(String methodName, RootNode root, Object[] arguments) {
         Assumptions assumptions = new Assumptions(true);
-        StructuredGraph actual = partialEval(root, arguments, assumptions, true);
-        InstalledCode result = new InstalledCode("Test:" + methodName);
-        truffleCompiler.compileMethodHelper(actual, assumptions, root.toString(), getSpeculationLog(), result);
+        final OptimizedCallTarget compilable = (OptimizedCallTarget) Truffle.getRuntime().createCallTarget(root);
+        StructuredGraph actual = partialEval(compilable, arguments, assumptions);
+        truffleCompiler.compileMethodHelper(actual, assumptions, methodName, getSpeculationLog(), compilable);
+        removeFrameStates(actual);
         StructuredGraph expected = parseForComparison(methodName);
-        removeFrameStates(actual);
         Assert.assertEquals(getCanonicalGraphString(expected, true, true), getCanonicalGraphString(actual, true, true));
-        return result;
+        return compilable;
     }
 
     protected void assertPartialEvalNoInvokes(RootNode root) {
@@ -79,71 +69,27 @@
 
     protected void assertPartialEvalNoInvokes(RootNode root, Object[] arguments) {
         Assumptions assumptions = new Assumptions(true);
-        StructuredGraph actual = partialEval(root, arguments, assumptions, true);
+        final OptimizedCallTarget compilable = (OptimizedCallTarget) Truffle.getRuntime().createCallTarget(root);
+        StructuredGraph actual = partialEval(compilable, arguments, assumptions);
         removeFrameStates(actual);
         for (MethodCallTargetNode node : actual.getNodes(MethodCallTargetNode.class)) {
             Assert.fail("Found invalid method call target node: " + node);
         }
     }
 
-    protected StructuredGraph partialEval(RootNode root, Object[] arguments, final Assumptions assumptions, final boolean canonicalizeReads) {
-        final OptimizedCallTarget compilable = (OptimizedCallTarget) Truffle.getRuntime().createCallTarget(root);
-
+    protected StructuredGraph partialEval(OptimizedCallTarget compilable, Object[] arguments, final Assumptions assumptions) {
         // Executed AST so that all classes are loaded and initialized.
         compilable.call(arguments);
         compilable.call(arguments);
         compilable.call(arguments);
 
         try (Scope s = Debug.scope("TruffleCompilation", new TruffleDebugJavaMethod(compilable))) {
-
-            StructuredGraph resultGraph = truffleCompiler.getPartialEvaluator().createGraph(compilable, assumptions);
-            CanonicalizerPhase canonicalizer = new CanonicalizerPhase(canonicalizeReads);
-            PhaseContext context = new PhaseContext(getProviders(), assumptions);
-
-            if (resultGraph.hasLoops()) {
-                boolean unrolled;
-                do {
-                    unrolled = false;
-                    LoopsData loopsData = new LoopsData(resultGraph);
-                    loopsData.detectedCountedLoops();
-                    for (LoopEx ex : innerLoopsFirst(loopsData.countedLoops())) {
-                        if (ex.counted().isConstantMaxTripCount()) {
-                            long constant = ex.counted().constantMaxTripCount();
-                            if (constant <= UNROLL_LIMIT) {
-                                LoopTransformations.fullUnroll(ex, context, canonicalizer);
-                                Debug.dump(resultGraph, "After loop unrolling %d times", constant);
-
-                                canonicalizer.apply(resultGraph, context);
-                                unrolled = true;
-                                break;
-                            }
-                        }
-                    }
-                    loopsData.deleteUnusedNodes();
-                } while (unrolled);
-            }
-
-            new DeadCodeEliminationPhase().apply(resultGraph);
-            new PartialEscapePhase(true, canonicalizer).apply(resultGraph, context);
-
-            return resultGraph;
+            return truffleCompiler.getPartialEvaluator().createGraph(compilable, assumptions);
         } catch (Throwable e) {
             throw Debug.handle(e);
         }
     }
 
-    private static List<LoopEx> innerLoopsFirst(Collection<LoopEx> loops) {
-        ArrayList<LoopEx> sortedLoops = new ArrayList<>(loops);
-        Collections.sort(sortedLoops, new Comparator<LoopEx>() {
-
-            @Override
-            public int compare(LoopEx o1, LoopEx o2) {
-                return o2.loop().getDepth() - o1.loop().getDepth();
-            }
-        });
-        return sortedLoops;
-    }
-
     protected void removeFrameStates(StructuredGraph graph) {
         for (FrameState frameState : graph.getNodes(FrameState.class)) {
             frameState.replaceAtUsages(null);
@@ -154,35 +100,9 @@
     }
 
     protected StructuredGraph parseForComparison(final String methodName) {
-
         try (Scope s = Debug.scope("Truffle", new DebugDumpScope("Comparison: " + methodName))) {
-            Assumptions assumptions = new Assumptions(false);
             StructuredGraph graph = parseEager(methodName);
-            PhaseContext context = new PhaseContext(getProviders(), assumptions);
-            CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true);
-            canonicalizer.apply(graph, context);
-
-            // Additional inlining.
-            PhaseSuite<HighTierContext> graphBuilderSuite = getCustomGraphBuilderSuite(GraphBuilderConfiguration.getFullDebugDefault());
-            graphBuilderSuite.appendPhase(canonicalizer);
-            graphBuilderSuite.appendPhase(new DeadCodeEliminationPhase());
-
-            new ConvertDeoptimizeToGuardPhase().apply(graph);
-            canonicalizer.apply(graph, context);
-            new DeadCodeEliminationPhase().apply(graph);
-
-            HighTierContext highTierContext = new HighTierContext(getProviders(), assumptions, null, graphBuilderSuite, TruffleCompilerImpl.Optimizations);
-            InliningPhase inliningPhase = new InliningPhase(canonicalizer);
-            inliningPhase.apply(graph, highTierContext);
-            removeFrameStates(graph);
-
-            new ConvertDeoptimizeToGuardPhase().apply(graph);
-            canonicalizer.apply(graph, context);
-            new DeadCodeEliminationPhase().apply(graph);
-
-            new LoweringPhase(new CanonicalizerPhase(true), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
-            canonicalizer.apply(graph, context);
-            new DeadCodeEliminationPhase().apply(graph);
+            compile(graph.method(), graph);
             return graph;
         } catch (Throwable e) {
             throw Debug.handle(e);
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SimplePartialEvaluationTest.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SimplePartialEvaluationTest.java	Tue Oct 14 16:48:09 2014 +0100
@@ -27,7 +27,6 @@
 import com.oracle.graal.truffle.test.nodes.*;
 import com.oracle.truffle.api.frame.*;
 
-@Ignore("Currently ignored due to problems with code coverage tools.")
 public class SimplePartialEvaluationTest extends PartialEvaluationTest {
 
     public static Object constant42() {
@@ -97,7 +96,7 @@
     public void loop() {
         FrameDescriptor fd = new FrameDescriptor();
         AbstractTestNode result = new BlockTestNode(new AbstractTestNode[]{new StoreLocalTestNode("x", fd, new ConstantTestNode(0)),
-                        new LoopTestNode(21, new StoreLocalTestNode("x", fd, new AddTestNode(new LoadLocalTestNode("x", fd), new ConstantTestNode(2))))});
+                        new LoopTestNode(7, new StoreLocalTestNode("x", fd, new AddTestNode(new LoadLocalTestNode("x", fd), new ConstantTestNode(6))))});
         assertPartialEvalEquals("constant42", new RootTestNode(fd, "loop", result));
     }
 
@@ -106,6 +105,8 @@
         FrameDescriptor fd = new FrameDescriptor();
         AbstractTestNode result = new BlockTestNode(new AbstractTestNode[]{new StoreLocalTestNode("x", fd, new ConstantTestNode(0)),
                         new LoopTestNode(42, new StoreLocalTestNode("x", fd, new AddTestNode(new LoadLocalTestNode("x", fd), new ConstantTestNode(1))))});
-        assertPartialEvalNoInvokes(new RootTestNode(fd, "loop", result));
+        RootTestNode rootNode = new RootTestNode(fd, "loop", result);
+        assertPartialEvalNoInvokes(rootNode);
+        assertPartialEvalEquals("constant42", rootNode);
     }
 }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulHighNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulHighNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -25,7 +25,6 @@
 import java.util.function.*;
 
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.lir.gen.*;
@@ -54,19 +53,6 @@
         super(stamp, x, y);
     }
 
-    @Override
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 2 && inputs[0].getKind() == inputs[1].getKind();
-        switch (inputs[0].getKind()) {
-            case Int:
-                return Constant.forInt(ExactMath.multiplyHigh(inputs[0].asInt(), inputs[1].asInt()));
-            case Long:
-                return Constant.forLong(ExactMath.multiplyHigh(inputs[0].asLong(), inputs[1].asLong()));
-            default:
-                throw GraalInternalError.unimplemented();
-        }
-    }
-
     /**
      * Determines the minimum and maximum result of this node for the given inputs and returns the
      * result of the given BiFunction on the minimum and maximum values.
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/UnsignedMulHighNode.java	Tue Oct 14 15:10:17 2014 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/UnsignedMulHighNode.java	Tue Oct 14 16:48:09 2014 +0100
@@ -25,7 +25,6 @@
 import java.util.function.*;
 
 import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.lir.gen.*;
@@ -54,19 +53,6 @@
         super(stamp, x, y);
     }
 
-    @Override
-    public Constant evalConst(Constant... inputs) {
-        assert inputs.length == 2 && inputs[0].getKind() == inputs[1].getKind();
-        switch (inputs[0].getKind()) {
-            case Int:
-                return Constant.forInt(ExactMath.multiplyHighUnsigned(inputs[0].asInt(), inputs[1].asInt()));
-            case Long:
-                return Constant.forLong(ExactMath.multiplyHighUnsigned(inputs[0].asLong(), inputs[1].asLong()));
-            default:
-                throw GraalInternalError.unimplemented();
-        }
-    }
-
     /**
      * Determines the minimum and maximum result of this node for the given inputs and returns the
      * result of the given BiFunction on the minimum and maximum values. Note that the minima and
--- a/src/share/vm/runtime/javaCalls.cpp	Tue Oct 14 15:10:17 2014 +0100
+++ b/src/share/vm/runtime/javaCalls.cpp	Tue Oct 14 16:48:09 2014 +0100
@@ -417,7 +417,7 @@
       if (graalInstalledCode != NULL && graalInstalledCode->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isExternal(graalInstalledCode)) {
         entry_point = GraalRuntime::get_external_deopt_i2c_entry();
       } else {
-      entry_point = method->adapter()->get_i2c_entry();
+        entry_point = method->adapter()->get_i2c_entry();
       }
     } else {
       THROW(vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException());