Esempio n. 1
0
 /**
  * Applies {@linkplain LoweringPhase lowering} to a replacement graph.
  *
  * @param replacementGraph a replacement (i.e., snippet or method substitution) graph
  */
 @SuppressWarnings("try")
 protected StructuredGraph lowerReplacement(
     final StructuredGraph replacementGraph, LoweringTool tool) {
   final PhaseContext c =
       new PhaseContext(
           tool.getMetaAccess(),
           tool.getConstantReflection(),
           tool.getConstantFieldProvider(),
           tool.getLowerer(),
           tool.getReplacements(),
           tool.getStampProvider(),
           tool.getNodeCostProvider());
   if (!graph().hasValueProxies()) {
     new RemoveValueProxyPhase().apply(replacementGraph);
   }
   GuardsStage guardsStage = graph().getGuardsStage();
   if (!guardsStage.allowsFloatingGuards()) {
     new GuardLoweringPhase().apply(replacementGraph, null);
     if (guardsStage.areFrameStatesAtDeopts()) {
       new FrameStateAssignmentPhase().apply(replacementGraph);
     }
   }
   try (Scope s = Debug.scope("LoweringSnippetTemplate", replacementGraph)) {
     new LoweringPhase(new CanonicalizerPhase(), tool.getLoweringStage())
         .apply(replacementGraph, c);
   } catch (Throwable e) {
     throw Debug.handle(e);
   }
   return replacementGraph;
 }
Esempio n. 2
0
 @SuppressWarnings("try")
 public boolean verify() {
   try (Scope s = Debug.scope("SSAVerifier", lir)) {
     for (AbstractBlockBase<?> block : lir.getControlFlowGraph().getBlocks()) {
       doBlock(block);
     }
   } catch (Throwable e) {
     throw Debug.handle(e);
   }
   return true;
 }
Esempio n. 3
0
  @SuppressWarnings("try")
  private ScheduleResult getFinalSchedule(
      final String snippet, final TestMode mode, final SchedulingStrategy schedulingStrategy) {
    final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
    try (Scope d = Debug.scope("FloatingReadTest", graph)) {
      try (OverrideScope s =
          OptionValue.override(
              OptScheduleOutOfLoops,
              schedulingStrategy == SchedulingStrategy.LATEST_OUT_OF_LOOPS,
              OptImplicitNullChecks,
              false)) {
        HighTierContext context = getDefaultHighTierContext();
        CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
        canonicalizer.apply(graph, context);
        if (mode == TestMode.INLINED_WITHOUT_FRAMESTATES) {
          new InliningPhase(canonicalizer).apply(graph, context);
        }
        new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER)
            .apply(graph, context);
        if (mode == TestMode.WITHOUT_FRAMESTATES || mode == TestMode.INLINED_WITHOUT_FRAMESTATES) {
          graph.clearAllStateAfter();
        }
        Debug.dump(graph, "after removal of framestates");

        new FloatingReadPhase().apply(graph);
        new RemoveValueProxyPhase().apply(graph);

        MidTierContext midContext =
            new MidTierContext(
                getProviders(),
                getTargetProvider(),
                OptimisticOptimizations.ALL,
                graph.getProfilingInfo());
        new GuardLoweringPhase().apply(graph, midContext);
        new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.MID_TIER)
            .apply(graph, midContext);
        new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.LOW_TIER)
            .apply(graph, midContext);

        SchedulePhase schedule = new SchedulePhase(schedulingStrategy);
        schedule.apply(graph);
        assertDeepEquals(1, graph.getNodes().filter(StartNode.class).count());
        return graph.getLastSchedule();
      }
    } catch (Throwable e) {
      throw Debug.handle(e);
    }
  }
Esempio n. 4
0
  @SuppressWarnings("try")
  protected LIRGenerationResult getLIRGenerationResult(final StructuredGraph graph) {
    try (Scope s = Debug.scope("FrontEnd")) {
      GraalCompiler.emitFrontEnd(
          getProviders(),
          getBackend(),
          graph,
          getDefaultGraphBuilderSuite(),
          OptimisticOptimizations.NONE,
          graph.getProfilingInfo(),
          getSuites());
    } catch (Throwable e) {
      throw Debug.handle(e);
    }

    LIRGenerationResult lirGen =
        GraalCompiler.emitLIR(getBackend(), graph, null, null, getLIRSuites(), null);
    return lirGen;
  }