changeset 20862:2228b4368946

decouple IntrinsicGraphBuilder from Providers
author Doug Simon <doug.simon@oracle.com>
date Thu, 09 Apr 2015 09:28:35 +0200
parents ce38ee1b67ab
children 7c94786aad9a
files graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathIntrinsicNode.java graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathSubstitutions.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntrinsicGraphBuilder.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntrinsicGraphBuilder.java	Thu Apr 09 09:17:04 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntrinsicGraphBuilder.java	Thu Apr 09 09:28:35 2015 +0200
@@ -34,7 +34,6 @@
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.phases.util.*;
 
 /**
  * Implementation of {@link GraphBuilderContext} used to produce a graph for a method based on an
@@ -42,7 +41,9 @@
  */
 public class IntrinsicGraphBuilder implements GraphBuilderContext, Receiver {
 
-    private final Providers providers;
+    private final MetaAccessProvider metaAccess;
+    private final ConstantReflectionProvider constantReflection;
+    private final StampProvider stampProvider;
     private final SnippetReflectionProvider snippetReflection;
     private final StructuredGraph graph;
     private final ResolvedJavaMethod method;
@@ -50,8 +51,11 @@
     private ValueNode[] arguments;
     private ValueNode returnValue;
 
-    public IntrinsicGraphBuilder(Providers providers, SnippetReflectionProvider snippetReflection, ResolvedJavaMethod method) {
-        this.providers = providers;
+    public IntrinsicGraphBuilder(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, StampProvider stampProvider, SnippetReflectionProvider snippetReflection,
+                    ResolvedJavaMethod method) {
+        this.metaAccess = metaAccess;
+        this.constantReflection = constantReflection;
+        this.stampProvider = stampProvider;
         this.snippetReflection = snippetReflection;
         this.graph = new StructuredGraph(method, AllowAssumptions.YES);
         this.method = method;
@@ -135,15 +139,15 @@
     }
 
     public StampProvider getStampProvider() {
-        return providers.getStampProvider();
+        return stampProvider;
     }
 
     public MetaAccessProvider getMetaAccess() {
-        return providers.getMetaAccess();
+        return metaAccess;
     }
 
     public ConstantReflectionProvider getConstantReflection() {
-        return providers.getConstantReflection();
+        return constantReflection;
     }
 
     public SnippetReflectionProvider getSnippetReflection() {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Thu Apr 09 09:17:04 2015 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Thu Apr 09 09:28:35 2015 +0200
@@ -344,7 +344,7 @@
                 MethodSubstitutionPlugin msplugin = (MethodSubstitutionPlugin) plugin;
                 substitute = msplugin.getSubstitute(providers.getMetaAccess());
             } else if (plugin != null) {
-                StructuredGraph graph = new IntrinsicGraphBuilder(providers, snippetReflection, original).buildGraph(plugin);
+                StructuredGraph graph = new IntrinsicGraphBuilder(providers.getMetaAccess(), providers.getConstantReflection(), providers.getStampProvider(), snippetReflection, original).buildGraph(plugin);
                 if (graph != null) {
                     return graph;
                 }