changeset 10676:9db1377b0580

Fix for TruffleCache.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 09 Jul 2013 17:38:32 +0200
parents 41362ec88331
children 3bbe14e492fb
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleOptions.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java
diffstat 4 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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<ValueNode> 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
--- 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<ValueNode> arguments) {
+    public StructuredGraph lookup(final ResolvedJavaMethod method, final NodeInputList<ValueNode> 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();
--- 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;
 
 }
--- 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();
     }
 
     /**