< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java

Print this page
rev 52509 : [mq]: graal2


  73         this.providers = providers;
  74         this.graphBuilderConfig = graphBuilderConfig;
  75         this.optimisticOpts = optimisticOpts;
  76         this.allowAssumptions = allowAssumptions;
  77         this.graphCache = EconomicMap.create();
  78     }
  79 
  80     protected GraphBuilderPhase.Instance createGraphBuilderPhaseInstance(IntrinsicContext initialIntrinsicContext) {
  81         return new GraphBuilderPhase.Instance(providers.getMetaAccess(), providers.getStampProvider(), providers.getConstantReflection(), providers.getConstantFieldProvider(), graphBuilderConfig,
  82                         optimisticOpts, initialIntrinsicContext);
  83     }
  84 
  85     @SuppressWarnings("try")
  86     private EncodedGraph createGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean isSubstitution) {
  87         // @formatter:off
  88         StructuredGraph graphToEncode = new StructuredGraph.Builder(options, debug, allowAssumptions).
  89                         useProfilingInfo(false).
  90                         trackNodeSourcePosition(graphBuilderConfig.trackNodeSourcePosition()).
  91                         method(method).
  92                         setIsSubstitution(isSubstitution).

  93                         build();
  94         // @formatter:on
  95         try (DebugContext.Scope scope = debug.scope("createGraph", graphToEncode)) {
  96             IntrinsicContext initialIntrinsicContext = intrinsicBytecodeProvider != null ? new IntrinsicContext(originalMethod, method, intrinsicBytecodeProvider, INLINE_AFTER_PARSING) : null;
  97             GraphBuilderPhase.Instance graphBuilderPhaseInstance = createGraphBuilderPhaseInstance(initialIntrinsicContext);
  98             graphBuilderPhaseInstance.apply(graphToEncode);
  99 
 100             PhaseContext context = new PhaseContext(providers);
 101             new CanonicalizerPhase().apply(graphToEncode, context);
 102             /*
 103              * ConvertDeoptimizeToGuardPhase reduces the number of merges in the graph, so that
 104              * fewer frame states will be created. This significantly reduces the number of nodes in
 105              * the initial graph.
 106              */
 107             new ConvertDeoptimizeToGuardPhase().apply(graphToEncode, context);
 108 
 109             EncodedGraph encodedGraph = GraphEncoder.encodeSingleGraph(graphToEncode, architecture);
 110             graphCache.put(method, encodedGraph);
 111             return encodedGraph;
 112 


  73         this.providers = providers;
  74         this.graphBuilderConfig = graphBuilderConfig;
  75         this.optimisticOpts = optimisticOpts;
  76         this.allowAssumptions = allowAssumptions;
  77         this.graphCache = EconomicMap.create();
  78     }
  79 
  80     protected GraphBuilderPhase.Instance createGraphBuilderPhaseInstance(IntrinsicContext initialIntrinsicContext) {
  81         return new GraphBuilderPhase.Instance(providers.getMetaAccess(), providers.getStampProvider(), providers.getConstantReflection(), providers.getConstantFieldProvider(), graphBuilderConfig,
  82                         optimisticOpts, initialIntrinsicContext);
  83     }
  84 
  85     @SuppressWarnings("try")
  86     private EncodedGraph createGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean isSubstitution) {
  87         // @formatter:off
  88         StructuredGraph graphToEncode = new StructuredGraph.Builder(options, debug, allowAssumptions).
  89                         useProfilingInfo(false).
  90                         trackNodeSourcePosition(graphBuilderConfig.trackNodeSourcePosition()).
  91                         method(method).
  92                         setIsSubstitution(isSubstitution).
  93                         cancellable(graph.getCancellable()).
  94                         build();
  95         // @formatter:on
  96         try (DebugContext.Scope scope = debug.scope("createGraph", graphToEncode)) {
  97             IntrinsicContext initialIntrinsicContext = intrinsicBytecodeProvider != null ? new IntrinsicContext(originalMethod, method, intrinsicBytecodeProvider, INLINE_AFTER_PARSING) : null;
  98             GraphBuilderPhase.Instance graphBuilderPhaseInstance = createGraphBuilderPhaseInstance(initialIntrinsicContext);
  99             graphBuilderPhaseInstance.apply(graphToEncode);
 100 
 101             PhaseContext context = new PhaseContext(providers);
 102             new CanonicalizerPhase().apply(graphToEncode, context);
 103             /*
 104              * ConvertDeoptimizeToGuardPhase reduces the number of merges in the graph, so that
 105              * fewer frame states will be created. This significantly reduces the number of nodes in
 106              * the initial graph.
 107              */
 108             new ConvertDeoptimizeToGuardPhase().apply(graphToEncode, context);
 109 
 110             EncodedGraph encodedGraph = GraphEncoder.encodeSingleGraph(graphToEncode, architecture);
 111             graphCache.put(method, encodedGraph);
 112             return encodedGraph;
 113 
< prev index next >