# HG changeset patch # User Doug Simon # Date 1411389114 -7200 # Node ID 371cf2a6500ab8d8f16ae9c41bc333ad6a879219 # Parent 63870b298b390d017d534473ecd8d576e02e84de# Parent fe5d4383b505caa15267b15d02f7b9e2b05bbd64 Merge. diff -r 63870b298b39 -r 371cf2a6500a graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Mon Sep 22 14:31:08 2014 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCacheImpl.java Mon Sep 22 14:31:54 2014 +0200 @@ -22,14 +22,11 @@ */ package com.oracle.graal.truffle; -import static com.oracle.graal.compiler.common.GraalOptions.*; - import java.util.*; import java.util.Map.Entry; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.common.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.Graph.Mark; @@ -98,8 +95,7 @@ return graph; } - public StructuredGraph lookup(final ResolvedJavaMethod method, final NodeInputList arguments, final Assumptions assumptions, final CanonicalizerPhase finalCanonicalizer, - boolean ignoreSlowPath) { + public StructuredGraph lookup(ResolvedJavaMethod method, NodeInputList arguments, Assumptions assumptions, CanonicalizerPhase canonicalizer, boolean ignoreSlowPath) { if (!ignoreSlowPath && method.getAnnotation(CompilerDirectives.SlowPath.class) != null) { return null; @@ -149,8 +145,7 @@ // Convert deopt to guards. new ConvertDeoptimizeToGuardPhase().apply(graph); - CanonicalizerPhase canonicalizerPhase = new CanonicalizerPhase(!ImmutableCode.getValue()); - PartialEscapePhase partialEscapePhase = new PartialEscapePhase(false, canonicalizerPhase); + PartialEscapePhase partialEscapePhase = new PartialEscapePhase(false, canonicalizer); while (true) { @@ -161,7 +156,7 @@ conditionalEliminationPhase.apply(graph); // Canonicalize / constant propagate. - canonicalizerPhase.apply(graph, phaseContext); + canonicalizer.apply(graph, phaseContext); boolean inliningProgress = false; for (MethodCallTargetNode methodCallTarget : graph.getNodes(MethodCallTargetNode.class)) { @@ -170,14 +165,14 @@ } if (methodCallTarget.isAlive() && methodCallTarget.invoke() != null && shouldInline(methodCallTarget)) { inliningProgress = true; - lookupDoInline(graph, phaseContext, canonicalizerPhase, methodCallTarget); + lookupDoInline(graph, phaseContext, canonicalizer, methodCallTarget); } } // Convert deopt to guards. new ConvertDeoptimizeToGuardPhase().apply(graph); - new EarlyReadEliminationPhase(canonicalizerPhase).apply(graph, phaseContext); + new EarlyReadEliminationPhase(canonicalizer).apply(graph, phaseContext); if (!inliningProgress) { break; @@ -215,7 +210,7 @@ } } - private Mark lookupProcessMacroSubstitutions(final StructuredGraph graph, Mark mark) throws GraalInternalError { + private Mark lookupProcessMacroSubstitutions(StructuredGraph graph, Mark mark) { // Make sure macro substitutions such as // CompilerDirectives.transferToInterpreter get processed first. for (Node newNode : graph.getNewNodes(mark)) { @@ -232,7 +227,7 @@ return graph.getMark(); } - private void lookupDoInline(final StructuredGraph graph, final PhaseContext phaseContext, CanonicalizerPhase canonicalizerPhase, MethodCallTargetNode methodCallTarget) { + private void lookupDoInline(StructuredGraph graph, PhaseContext phaseContext, CanonicalizerPhase canonicalizer, MethodCallTargetNode methodCallTarget) { List canonicalizerUsages = new ArrayList<>(); for (Node n : methodCallTarget.invoke().asNode().usages()) { if (n instanceof Canonicalizable) { @@ -241,7 +236,7 @@ } List argumentSnapshot = methodCallTarget.arguments().snapshot(); Mark beforeInvokeMark = graph.getMark(); - expandInvoke(methodCallTarget); + expandInvoke(methodCallTarget, canonicalizer); for (Node arg : argumentSnapshot) { if (arg != null) { for (Node argUsage : arg.usages()) { @@ -251,13 +246,13 @@ } } } - canonicalizerPhase.applyIncremental(graph, phaseContext, canonicalizerUsages); + canonicalizer.applyIncremental(graph, phaseContext, canonicalizerUsages); } - private void expandInvoke(MethodCallTargetNode methodCallTargetNode) { + private void expandInvoke(MethodCallTargetNode methodCallTargetNode, CanonicalizerPhase canonicalizer) { StructuredGraph inlineGraph = providers.getReplacements().getMethodSubstitution(methodCallTargetNode.targetMethod()); if (inlineGraph == null) { - inlineGraph = TruffleCacheImpl.this.lookup(methodCallTargetNode.targetMethod(), methodCallTargetNode.arguments(), null, null, false); + inlineGraph = TruffleCacheImpl.this.lookup(methodCallTargetNode.targetMethod(), methodCallTargetNode.arguments(), null, canonicalizer, false); } if (inlineGraph == this.markerGraph) { // Can happen for recursive calls. @@ -286,7 +281,7 @@ return false; } - private boolean shouldInline(final MethodCallTargetNode methodCallTargetNode) { + private boolean shouldInline(MethodCallTargetNode methodCallTargetNode) { boolean result = (methodCallTargetNode.invokeKind() == InvokeKind.Special || methodCallTargetNode.invokeKind() == InvokeKind.Static) && methodCallTargetNode.targetMethod().canBeInlined() && !methodCallTargetNode.targetMethod().isNative() && methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) == null && methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null && diff -r 63870b298b39 -r 371cf2a6500a graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeCost.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeCost.java Mon Sep 22 14:31:08 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeCost.java Mon Sep 22 14:31:54 2014 +0200 @@ -29,7 +29,7 @@ /** * Represents a rough estimate for the cost of a {@link Node}. This estimate can be used by runtime * systems or guest languages to implement heuristics based on Truffle ASTs. - * + * * @see Node#getCost() */ public enum NodeCost { @@ -54,7 +54,7 @@ /** * This node represents a polymorphic version of an operation. For multiple chained polymorphic - * nodes the first may return {@link #MONOMORPHIC} and all addtional nodes should return + * nodes the first may return {@link #MONOMORPHIC} and all additional nodes should return * {@link #POLYMORPHIC}. */ POLYMORPHIC,