# HG changeset patch # User Miguel Garcia # Date 1401469227 -7200 # Node ID 23e6edbe4c763bd16ff80510fb2268476e0add29 # Parent 85fa160555355029e6d34f0c4445349e1d3dbe22 [inlining] more uniform treatment of method cloning in InlineableGraph diff -r 85fa16055535 -r 23e6edbe4c76 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java --- 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 newGraph 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.

+ * profiling info is mature, the resulting graph is cached. The caller is responsible for + * cloning before modification.

*/ 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) {