changeset 15986:23e6edbe4c76

[inlining] more uniform treatment of method cloning in InlineableGraph
author Miguel Garcia <miguel.m.garcia@oracle.com>
date Fri, 30 May 2014 19:00:27 +0200
parents 85fa16055535
children 03b1d8f6b4ef
files graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java	Fri May 30 18:41:56 2014 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java	Fri May 30 19:00:27 2014 +0200
@@ -65,9 +65,8 @@
         if (newGraph == null) {
             newGraph = new StructuredGraph(method);
             parseBytecodes(newGraph, context, canonicalizer);
-        } else {
-            newGraph = newGraph.copy();
         }
+        newGraph = newGraph.copy();
 
         // TODO (chaeubl): copying the graph is only necessary if it is modified or if it contains
         // any invokes
@@ -122,8 +121,8 @@
 
     /**
      * This method builds the IR nodes for <code>newGraph</code> and canonicalizes them. Provided
-     * profiling info is mature, a copy of the resulting graph is cached. Thus, any modifications
-     * performed on the returned graph won't affect the cached copy.</p>
+     * profiling info is mature, the resulting graph is cached. The caller is responsible for
+     * cloning before modification.</p>
      */
     private static StructuredGraph parseBytecodes(StructuredGraph newGraph, HighTierContext context, CanonicalizerPhase canonicalizer) {
         try (Debug.Scope s = Debug.scope("InlineGraph", newGraph)) {
@@ -139,7 +138,7 @@
             }
 
             if (context.getGraphCache() != null) {
-                context.getGraphCache().put(newGraph.method(), newGraph.copy());
+                context.getGraphCache().put(newGraph.method(), newGraph);
             }
             return newGraph;
         } catch (Throwable e) {