# HG changeset patch # User Thomas Wuerthinger # Date 1373384312 -7200 # Node ID 9db1377b05805caf7571489be2fe0e7bb86f081b # Parent 41362ec883312d40d8ea193f5a8db91281c44e73 Fix for TruffleCache. diff -r 41362ec88331 -r 9db1377b0580 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Tue Jul 09 14:33:24 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Tue Jul 09 17:38:32 2013 +0200 @@ -243,7 +243,7 @@ private StructuredGraph parseGraph(final ResolvedJavaMethod targetMethod, final NodeInputList arguments, final Assumptions assumptions, final boolean canonicalizeReads) { - final StructuredGraph graph = truffleCache.lookup(targetMethod, arguments); + final StructuredGraph graph = truffleCache.lookup(targetMethod, arguments, assumptions); Debug.scope("parseGraph", targetMethod, new Runnable() { @Override diff -r 41362ec88331 -r 9db1377b0580 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Tue Jul 09 14:33:24 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Tue Jul 09 17:38:32 2013 +0200 @@ -66,7 +66,7 @@ this.replacements = replacements; } - public StructuredGraph lookup(final ResolvedJavaMethod method, final NodeInputList arguments) { + public StructuredGraph lookup(final ResolvedJavaMethod method, final NodeInputList arguments, final Assumptions assumptions) { StructuredGraph resultGraph = null; if (cache.containsKey(method)) { @@ -105,9 +105,10 @@ localNode.setStamp(stamp); } - optimizeGraph(newGraph); + Assumptions tmpAssumptions = new Assumptions(false); + optimizeGraph(newGraph, tmpAssumptions); - HighTierContext context = new HighTierContext(metaAccessProvider, new Assumptions(false), replacements); + HighTierContext context = new HighTierContext(metaAccessProvider, tmpAssumptions, replacements); PartialEscapePhase partialEscapePhase = new PartialEscapePhase(false, new CanonicalizerPhase(true)); partialEscapePhase.apply(newGraph, context); @@ -138,18 +139,17 @@ } } Debug.dump(clonedResultGraph, "after applying constants"); - optimizeGraph(clonedResultGraph); + optimizeGraph(clonedResultGraph, assumptions); } }); return clonedResultGraph; } - private void optimizeGraph(StructuredGraph newGraph) { + private void optimizeGraph(StructuredGraph newGraph, Assumptions assumptions) { ConditionalEliminationPhase eliminate = new ConditionalEliminationPhase(metaAccessProvider); ConvertDeoptimizeToGuardPhase convertDeoptimizeToGuardPhase = new ConvertDeoptimizeToGuardPhase(); - Assumptions assumptions = new Assumptions(false); CanonicalizerPhase.Instance canonicalizerPhase = new CanonicalizerPhase.Instance(metaAccessProvider, assumptions, !AOTCompilation.getValue(), null, null); Integer maxNodes = TruffleCompilerOptions.TruffleOperationCacheMaxNodes.getValue(); diff -r 41362ec88331 -r 9db1377b0580 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java Tue Jul 09 14:33:24 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java Tue Jul 09 17:38:32 2013 +0200 @@ -31,24 +31,24 @@ public class TruffleOptions { /** Enables/disables the rewriting of traces in the truffle runtime to stdout. */ - public static final boolean TraceRewrites = false; + public static boolean TraceRewrites = false; /** * Filters rewrites that do not contain the given string in the qualified name of the source or * target class hierarchy. */ - public static final String TraceRewritesFilterClass = null; + public static String TraceRewritesFilterClass = null; /** * Filters rewrites which does not contain the {@link Kind} in its source {@link NodeInfo}. If * no {@link NodeInfo} is defined the element is filtered if the filter value is set. */ - public static final NodeInfo.Kind TraceRewritesFilterFromKind = null; + public static NodeInfo.Kind TraceRewritesFilterFromKind = null; /** * Filters rewrites which does not contain the {@link Kind} in its target {@link NodeInfo}. If * no {@link NodeInfo} is defined the element is filtered if the filter value is set. */ - public static final NodeInfo.Kind TraceRewritesFilterToKind = null; + public static NodeInfo.Kind TraceRewritesFilterToKind = null; } diff -r 41362ec88331 -r 9db1377b0580 graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java --- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java Tue Jul 09 14:33:24 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java Tue Jul 09 17:38:32 2013 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.truffle.api.nodes; +import com.oracle.truffle.api.*; + /** * An exception thrown to enter a slow path. The Truffle optimizer has special knowledge of this * exception class and will never compile a catch block that catches this exception type. @@ -34,6 +36,7 @@ * Creates an exception thrown to enter a slow path. */ public SlowPathException() { + CompilerDirectives.transferToInterpreter(); } /** @@ -41,6 +44,7 @@ */ public SlowPathException(String message, Throwable cause) { super(message, cause); + CompilerDirectives.transferToInterpreter(); } /** @@ -48,6 +52,7 @@ */ public SlowPathException(String message) { super(message); + CompilerDirectives.transferToInterpreter(); } /** @@ -55,6 +60,7 @@ */ public SlowPathException(Throwable cause) { super(cause); + CompilerDirectives.transferToInterpreter(); } /**