Exemplo n.º 1
0
 private StructuredGraph parseAndProcess(String snippet) {
   StructuredGraph graph = parse(snippet);
   LocalNode local = graph.getNodes(LocalNode.class).first();
   ConstantNode constant = ConstantNode.forInt(0, graph);
   for (Node n : local.usages().filter(isNotA(FrameState.class)).snapshot()) {
     n.replaceFirstInput(local, constant);
   }
   Map<Invoke, Double> hints = new HashMap<>();
   for (Invoke invoke : graph.getInvokes()) {
     hints.put(invoke, 1000d);
   }
   Assumptions assumptions = new Assumptions(false);
   new InliningPhase(
           runtime(),
           hints,
           replacements,
           assumptions,
           null,
           getDefaultPhasePlan(),
           OptimisticOptimizations.ALL)
       .apply(graph);
   new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph);
   new DeadCodeEliminationPhase().apply(graph);
   return graph;
 }
 private void test(String snippet) {
   StructuredGraph graph = parseProfiled(snippet, AllowAssumptions.NO);
   Map<Invoke, Double> hints = new HashMap<>();
   for (Invoke invoke : graph.getInvokes()) {
     hints.put(invoke, 1000d);
   }
   HighTierContext context =
       new HighTierContext(
           getProviders(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL);
   new InliningPhase(hints, new CanonicalizerPhase(true)).apply(graph, context);
   new CanonicalizerPhase(true).apply(graph, context);
   new DeadCodeEliminationPhase().apply(graph);
 }