comparison graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java @ 19382:37516af640ed

Do not inline into methods that need a Graal replacement in the new partial evaluator.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 15 Feb 2015 16:44:52 +0100
parents 31442a6da26d
children fc390dcb0ba5
comparison
equal deleted inserted replaced
19381:31442a6da26d 19382:37516af640ed
76 this.graphBuilderPlugins = graphBuilderPlugins; 76 this.graphBuilderPlugins = graphBuilderPlugins;
77 } 77 }
78 78
79 @Override 79 @Override
80 protected void run(StructuredGraph graph, HighTierContext context) { 80 protected void run(StructuredGraph graph, HighTierContext context) {
81 new Instance(context.getMetaAccess(), context.getStampProvider(), null, context.getConstantReflection(), graphBuilderConfig, graphBuilderPlugins, context.getOptimisticOptimizations()).run(graph); 81 new Instance(context.getMetaAccess(), context.getStampProvider(), null, null, context.getConstantReflection(), graphBuilderConfig, graphBuilderPlugins, context.getOptimisticOptimizations()).run(graph);
82 } 82 }
83 83
84 public GraphBuilderConfiguration getGraphBuilderConfig() { 84 public GraphBuilderConfiguration getGraphBuilderConfig() {
85 return graphBuilderConfig; 85 return graphBuilderConfig;
86 } 86 }
102 private final OptimisticOptimizations optimisticOpts; 102 private final OptimisticOptimizations optimisticOpts;
103 private final StampProvider stampProvider; 103 private final StampProvider stampProvider;
104 private final ConstantReflectionProvider constantReflection; 104 private final ConstantReflectionProvider constantReflection;
105 private final SnippetReflectionProvider snippetReflectionProvider; 105 private final SnippetReflectionProvider snippetReflectionProvider;
106 106
107 private final Replacements replacements;
108
107 /** 109 /**
108 * Gets the graph being processed by this builder. 110 * Gets the graph being processed by this builder.
109 */ 111 */
110 protected StructuredGraph getGraph() { 112 protected StructuredGraph getGraph() {
111 return currentGraph; 113 return currentGraph;
112 } 114 }
113 115
114 public Instance(MetaAccessProvider metaAccess, StampProvider stampProvider, SnippetReflectionProvider snippetReflectionProvider, ConstantReflectionProvider constantReflection, 116 public Instance(MetaAccessProvider metaAccess, StampProvider stampProvider, SnippetReflectionProvider snippetReflectionProvider, Replacements replacements,
115 GraphBuilderConfiguration graphBuilderConfig, GraphBuilderPlugins graphBuilderPlugins, OptimisticOptimizations optimisticOpts) { 117 ConstantReflectionProvider constantReflection, GraphBuilderConfiguration graphBuilderConfig, GraphBuilderPlugins graphBuilderPlugins, OptimisticOptimizations optimisticOpts) {
116 this.graphBuilderConfig = graphBuilderConfig; 118 this.graphBuilderConfig = graphBuilderConfig;
117 this.optimisticOpts = optimisticOpts; 119 this.optimisticOpts = optimisticOpts;
118 this.metaAccess = metaAccess; 120 this.metaAccess = metaAccess;
119 this.stampProvider = stampProvider; 121 this.stampProvider = stampProvider;
120 this.graphBuilderPlugins = graphBuilderPlugins; 122 this.graphBuilderPlugins = graphBuilderPlugins;
121 this.constantReflection = constantReflection; 123 this.constantReflection = constantReflection;
122 this.snippetReflectionProvider = snippetReflectionProvider; 124 this.snippetReflectionProvider = snippetReflectionProvider;
125 this.replacements = replacements;
123 assert metaAccess != null; 126 assert metaAccess != null;
124 } 127 }
125 128
126 public Instance(MetaAccessProvider metaAccess, StampProvider stampProvider, ConstantReflectionProvider constantReflection, GraphBuilderConfiguration graphBuilderConfig, 129 public Instance(MetaAccessProvider metaAccess, StampProvider stampProvider, ConstantReflectionProvider constantReflection, GraphBuilderConfiguration graphBuilderConfig,
127 OptimisticOptimizations optimisticOpts) { 130 OptimisticOptimizations optimisticOpts) {
128 this(metaAccess, stampProvider, null, constantReflection, graphBuilderConfig, null, optimisticOpts); 131 this(metaAccess, stampProvider, null, null, constantReflection, graphBuilderConfig, null, optimisticOpts);
129 } 132 }
130 133
131 @Override 134 @Override
132 protected void run(StructuredGraph graph) { 135 protected void run(StructuredGraph graph) {
133 ResolvedJavaMethod method = graph.method(); 136 ResolvedJavaMethod method = graph.method();
874 return; 877 return;
875 } 878 }
876 } 879 }
877 InlineInvokePlugin inlineInvokePlugin = graphBuilderConfig.getInlineInvokePlugin(); 880 InlineInvokePlugin inlineInvokePlugin = graphBuilderConfig.getInlineInvokePlugin();
878 if (inlineInvokePlugin != null && invokeKind.isDirect() && targetMethod.canBeInlined() && targetMethod.hasBytecodes() && 881 if (inlineInvokePlugin != null && invokeKind.isDirect() && targetMethod.canBeInlined() && targetMethod.hasBytecodes() &&
882 (replacements == null || (replacements.getMethodSubstitution(targetMethod) == null && replacements.getMacroSubstitution(targetMethod) == null)) &&
879 inlineInvokePlugin.shouldInlineInvoke(targetMethod, currentDepth)) { 883 inlineInvokePlugin.shouldInlineInvoke(targetMethod, currentDepth)) {
880 if (GraalOptions.TraceInlineDuringParsing.getValue()) { 884 if (GraalOptions.TraceInlineDuringParsing.getValue()) {
881 int bci = this.bci(); 885 int bci = this.bci();
882 for (int i = 0; i < this.currentDepth; ++i) { 886 for (int i = 0; i < this.currentDepth; ++i) {
883 TTY.print(' '); 887 TTY.print(' ');