# HG changeset patch # User Doug Simon # Date 1363865444 -3600 # Node ID 1571adaf302bc29ecde0a9b66c0795690b665be4 # Parent 24608582da7041315cf4f294674480d3772a4dbb snippet graphs are now stored with a Snippet.class key value in the compiler storage of the snippet method diff -r 24608582da70 -r 1571adaf302b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Thu Mar 21 12:23:37 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Thu Mar 21 12:30:44 2013 +0100 @@ -32,6 +32,7 @@ import com.oracle.graal.nodes.virtual.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.replacements.*; import com.oracle.graal.replacements.nodes.*; public class ArrayCopyNode extends MacroNode implements Virtualizable, IterableNodeType, Lowerable { @@ -72,7 +73,7 @@ } Kind componentKind = srcType.getComponentType().getKind(); ResolvedJavaMethod snippetMethod = tool.getRuntime().lookupJavaMethod(ArrayCopySnippets.getSnippetForKind(componentKind)); - return (StructuredGraph) snippetMethod.getCompilerStorage().get(Graph.class); + return (StructuredGraph) snippetMethod.getCompilerStorage().get(Snippet.class); } private static void unrollFixedLengthLoop(StructuredGraph snippetGraph, int length, LoweringTool tool) { @@ -111,7 +112,7 @@ StructuredGraph snippetGraph = selectSnippet(tool); if (snippetGraph == null) { ResolvedJavaMethod snippetMethod = tool.getRuntime().lookupJavaMethod(ArrayCopySnippets.genericArraycopySnippet); - snippetGraph = ((StructuredGraph) snippetMethod.getCompilerStorage().get(Graph.class)).copy(); + snippetGraph = ((StructuredGraph) snippetMethod.getCompilerStorage().get(Snippet.class)).copy(); assert snippetGraph != null : "ArrayCopySnippets should be installed"; replaceSnippetInvokes(snippetGraph, getTargetMethod(), getBci()); diff -r 24608582da70 -r 1571adaf302b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Thu Mar 21 12:23:37 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Thu Mar 21 12:30:44 2013 +0100 @@ -520,7 +520,7 @@ InvokeNode invoke = graph.add(new InvokeNode(callTarget, 0)); invoke.setStateAfter(graph.start().stateAfter()); graph.addAfterFixed(graph.start(), invoke); - StructuredGraph inlineeGraph = (StructuredGraph) initCounter.getCompilerStorage().get(Graph.class); + StructuredGraph inlineeGraph = (StructuredGraph) initCounter.getCompilerStorage().get(Snippet.class); InliningUtil.inline(invoke, inlineeGraph, false); List rets = graph.getNodes().filter(ReturnNode.class).snapshot(); @@ -534,7 +534,7 @@ FrameState stateAfter = new FrameState(graph.method(), FrameState.AFTER_BCI, new ValueNode[0], stack, new ValueNode[0], false, false); invoke.setStateAfter(graph.add(stateAfter)); graph.addBeforeFixed(ret, invoke); - inlineeGraph = (StructuredGraph) checkCounter.getCompilerStorage().get(Graph.class); + inlineeGraph = (StructuredGraph) checkCounter.getCompilerStorage().get(Snippet.class); InliningUtil.inline(invoke, inlineeGraph, false); } } diff -r 24608582da70 -r 1571adaf302b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Thu Mar 21 12:23:37 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java Thu Mar 21 12:30:44 2013 +0100 @@ -26,13 +26,13 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.virtual.*; import com.oracle.graal.phases.*; +import com.oracle.graal.replacements.*; import com.oracle.graal.replacements.nodes.*; public class ObjectCloneNode extends MacroNode implements VirtualizableAllocation, ArrayLengthProvider { @@ -70,7 +70,7 @@ method = ObjectCloneSnippets.instanceCloneMethod; } ResolvedJavaMethod snippetMethod = tool.getRuntime().lookupJavaMethod(method); - StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.getCompilerStorage().get(Graph.class); + StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.getCompilerStorage().get(Snippet.class); assert snippetGraph != null : "ObjectCloneSnippets should be installed"; return snippetGraph; diff -r 24608582da70 -r 1571adaf302b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Thu Mar 21 12:23:37 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Thu Mar 21 12:30:44 2013 +0100 @@ -33,7 +33,6 @@ import com.oracle.graal.compiler.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.debug.*; -import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.java.*; @@ -41,8 +40,9 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; import com.oracle.graal.replacements.*; -import com.oracle.graal.replacements.Snippet.*; -import com.oracle.graal.replacements.SnippetTemplate.*; +import com.oracle.graal.replacements.Snippet.ConstantParameter; +import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates; +import com.oracle.graal.replacements.SnippetTemplate.Key; /** * Base class for implementing some low level code providing the out-of-line slow path for a @@ -107,7 +107,7 @@ * it. */ public void install(Backend backend) { - StructuredGraph graph = (StructuredGraph) stubMethod.getCompilerStorage().get(Graph.class); + StructuredGraph graph = (StructuredGraph) stubMethod.getCompilerStorage().get(Snippet.class); Key key = new Key(stubMethod); populateKey(key); diff -r 24608582da70 -r 1571adaf302b graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsInstaller.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsInstaller.java Thu Mar 21 12:23:37 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsInstaller.java Thu Mar 21 12:30:44 2013 +0100 @@ -88,10 +88,10 @@ throw new RuntimeException("Snippet must not be abstract or native"); } ResolvedJavaMethod snippet = runtime.lookupJavaMethod(method); - assert snippet.getCompilerStorage().get(Graph.class) == null : method; + assert snippet.getCompilerStorage().get(Snippet.class) == null : method; StructuredGraph graph = makeGraph(snippet, inliningPolicy(snippet)); // System.out.println("snippet: " + graph); - snippet.getCompilerStorage().put(Graph.class, graph); + snippet.getCompilerStorage().put(Snippet.class, graph); } } } diff -r 24608582da70 -r 1571adaf302b graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Thu Mar 21 12:23:37 2013 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Thu Mar 21 12:30:44 2013 +0100 @@ -236,7 +236,7 @@ Signature signature = method.getSignature(); // Copy snippet graph, replacing constant parameters with given arguments - StructuredGraph snippetGraph = (StructuredGraph) method.getCompilerStorage().get(Graph.class); + StructuredGraph snippetGraph = (StructuredGraph) method.getCompilerStorage().get(Snippet.class); StructuredGraph snippetCopy = new StructuredGraph(snippetGraph.name, snippetGraph.method()); IdentityHashMap replacements = new IdentityHashMap<>(); replacements.put(snippetGraph.start(), snippetCopy.start());