# HG changeset patch # User Miguel Garcia # Date 1401722411 -7200 # Node ID 2b79ddf41d2fcb9b1d1fe16d594e9c1280d660c6 # Parent a27eceb10d33319c16ddf2a62800aaf58c517b2b [inliner] trickle up, thus making more visible, graph copying diff -r a27eceb10d33 -r 2b79ddf41d2f 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 Mon Jun 02 17:05:34 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java Mon Jun 02 17:20:11 2014 +0200 @@ -42,7 +42,9 @@ private final StructuredGraph graph; public InlineableGraph(final ResolvedJavaMethod method, final Invoke invoke, final HighTierContext context, CanonicalizerPhase canonicalizer) { - this.graph = buildGraph(method, context, canonicalizer); + StructuredGraph original = buildGraph(method, context, canonicalizer); + // TODO copying the graph is only necessary if it is modified or if it contains any invokes + this.graph = original.copy(); specializeGraphToArguments(invoke, context, canonicalizer); } @@ -61,14 +63,17 @@ return null; } + /** + * This method looks up in a cache the graph for the argument, if not found bytecode is parsed. + * The graph thus obtained is returned, ie the caller is responsible for cloning before + * modification. + */ private static StructuredGraph buildGraph(final ResolvedJavaMethod method, final HighTierContext context, CanonicalizerPhase canonicalizer) { - StructuredGraph newGraph = getOriginalGraph(method, context); - if (newGraph == null) { - newGraph = parseBytecodes(method, context, canonicalizer); + StructuredGraph result = getOriginalGraph(method, context); + if (result == null) { + result = parseBytecodes(method, context, canonicalizer); } - // TODO (chaeubl): copying the graph is only necessary if it is modified or if it contains - // any invokes - return newGraph.copy(); + return result; } /**