comparison graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java @ 11569:2f6734f8126a

Avoid direct usage of CanonicalizerPhase.Instance in replacements processing.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 10 Sep 2013 13:28:26 +0200
parents a03452edfc4d
children c47153857827
comparison
equal deleted inserted replaced
11568:ae27f6ac3374 11569:2f6734f8126a
42 import com.oracle.graal.nodes.java.*; 42 import com.oracle.graal.nodes.java.*;
43 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; 43 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
44 import com.oracle.graal.nodes.spi.*; 44 import com.oracle.graal.nodes.spi.*;
45 import com.oracle.graal.phases.*; 45 import com.oracle.graal.phases.*;
46 import com.oracle.graal.phases.common.*; 46 import com.oracle.graal.phases.common.*;
47 import com.oracle.graal.phases.tiers.*;
47 import com.oracle.graal.replacements.Snippet.DefaultSnippetInliningPolicy; 48 import com.oracle.graal.replacements.Snippet.DefaultSnippetInliningPolicy;
48 import com.oracle.graal.replacements.Snippet.SnippetInliningPolicy; 49 import com.oracle.graal.replacements.Snippet.SnippetInliningPolicy;
49 import com.oracle.graal.word.phases.*; 50 import com.oracle.graal.word.phases.*;
50 51
51 public class ReplacementsImpl implements Replacements { 52 public class ReplacementsImpl implements Replacements {
329 graphBuilder.apply(graph); 330 graphBuilder.apply(graph);
330 331
331 new WordTypeVerificationPhase(runtime, target.wordKind).apply(graph); 332 new WordTypeVerificationPhase(runtime, target.wordKind).apply(graph);
332 if (OptCanonicalizer.getValue()) { 333 if (OptCanonicalizer.getValue()) {
333 new WordTypeRewriterPhase(runtime, target.wordKind).apply(graph); 334 new WordTypeRewriterPhase(runtime, target.wordKind).apply(graph);
334 new CanonicalizerPhase.Instance(runtime, assumptions, true).apply(graph); 335 new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime, assumptions, ReplacementsImpl.this));
335 } 336 }
336 } 337 }
337 }); 338 });
338 return graph; 339 return graph;
339 } 340 }
345 * @param callee the graph that was inlined into {@code caller} 346 * @param callee the graph that was inlined into {@code caller}
346 */ 347 */
347 protected void afterInline(StructuredGraph caller, StructuredGraph callee) { 348 protected void afterInline(StructuredGraph caller, StructuredGraph callee) {
348 if (OptCanonicalizer.getValue()) { 349 if (OptCanonicalizer.getValue()) {
349 new WordTypeRewriterPhase(runtime, target.wordKind).apply(caller); 350 new WordTypeRewriterPhase(runtime, target.wordKind).apply(caller);
350 new CanonicalizerPhase.Instance(runtime, assumptions, true).apply(caller); 351 new CanonicalizerPhase(true).apply(caller, new PhaseContext(runtime, assumptions, ReplacementsImpl.this));
351 } 352 }
352 } 353 }
353 354
354 /** 355 /**
355 * Called after all inlining for a given graph is complete. 356 * Called after all inlining for a given graph is complete.
359 360
360 new WordTypeRewriterPhase(runtime, target.wordKind).apply(graph); 361 new WordTypeRewriterPhase(runtime, target.wordKind).apply(graph);
361 362
362 new DeadCodeEliminationPhase().apply(graph); 363 new DeadCodeEliminationPhase().apply(graph);
363 if (OptCanonicalizer.getValue()) { 364 if (OptCanonicalizer.getValue()) {
364 new CanonicalizerPhase.Instance(runtime, assumptions, true).apply(graph); 365 new CanonicalizerPhase(true).apply(graph, new PhaseContext(runtime, assumptions, ReplacementsImpl.this));
365 } 366 }
366 } 367 }
367 368
368 private StructuredGraph buildGraph(final ResolvedJavaMethod methodToParse, final SnippetInliningPolicy policy) { 369 private StructuredGraph buildGraph(final ResolvedJavaMethod methodToParse, final SnippetInliningPolicy policy) {
369 assert !Modifier.isAbstract(methodToParse.getModifiers()) && !Modifier.isNative(methodToParse.getModifiers()) : methodToParse; 370 assert !Modifier.isAbstract(methodToParse.getModifiers()) && !Modifier.isNative(methodToParse.getModifiers()) : methodToParse;