< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectsPhase.java

Print this page




  82                 ControlFlowGraph cfg;
  83                 if (unscheduled) {
  84                     schedule = null;
  85                     cfg = ControlFlowGraph.compute(graph, true, true, false, false);
  86                 } else {
  87                     new SchedulePhase(SchedulePhase.SchedulingStrategy.EARLIEST).apply(graph, false);
  88                     schedule = graph.getLastSchedule();
  89                     cfg = schedule.getCFG();
  90                 }
  91                 try (DebugContext.Scope scheduleScope = debug.scope("EffectsPhaseWithSchedule", schedule)) {
  92                     Closure<?> closure = createEffectsClosure(context, schedule, cfg);
  93                     ReentrantBlockIterator.apply(closure, cfg.getStartBlock());
  94 
  95                     if (closure.needsApplyEffects()) {
  96                         // apply the effects collected during this iteration
  97                         HashSetNodeEventListener listener = new HashSetNodeEventListener();
  98                         try (NodeEventScope nes = graph.trackNodeEvents(listener)) {
  99                             closure.applyEffects();
 100                         }
 101 
 102                         if (debug.isDumpEnabled(DebugContext.INFO_LEVEL)) {
 103                             debug.dump(DebugContext.DETAILED_LEVEL, graph, "%s iteration", getName());
 104                         }
 105 
 106                         new DeadCodeEliminationPhase(Required).apply(graph);
 107 
 108                         EconomicSet<Node> changedNodes = listener.getNodes();
 109                         for (Node node : graph.getNodes()) {
 110                             if (node instanceof Simplifiable) {
 111                                 changedNodes.add(node);
 112                             }
 113                         }
 114                         postIteration(graph, context, changedNodes);
 115                     }
 116 
 117                     if (closure.hasChanged()) {
 118                         changed = true;
 119                     } else {
 120                         break;
 121                     }
 122                 } catch (Throwable t) {
 123                     throw debug.handle(t);


  82                 ControlFlowGraph cfg;
  83                 if (unscheduled) {
  84                     schedule = null;
  85                     cfg = ControlFlowGraph.compute(graph, true, true, false, false);
  86                 } else {
  87                     new SchedulePhase(SchedulePhase.SchedulingStrategy.EARLIEST).apply(graph, false);
  88                     schedule = graph.getLastSchedule();
  89                     cfg = schedule.getCFG();
  90                 }
  91                 try (DebugContext.Scope scheduleScope = debug.scope("EffectsPhaseWithSchedule", schedule)) {
  92                     Closure<?> closure = createEffectsClosure(context, schedule, cfg);
  93                     ReentrantBlockIterator.apply(closure, cfg.getStartBlock());
  94 
  95                     if (closure.needsApplyEffects()) {
  96                         // apply the effects collected during this iteration
  97                         HashSetNodeEventListener listener = new HashSetNodeEventListener();
  98                         try (NodeEventScope nes = graph.trackNodeEvents(listener)) {
  99                             closure.applyEffects();
 100                         }
 101 
 102                         if (debug.isDumpEnabled(DebugContext.VERBOSE_LEVEL)) {
 103                             debug.dump(DebugContext.VERBOSE_LEVEL, graph, "%s iteration", getName());
 104                         }
 105 
 106                         new DeadCodeEliminationPhase(Required).apply(graph);
 107 
 108                         EconomicSet<Node> changedNodes = listener.getNodes();
 109                         for (Node node : graph.getNodes()) {
 110                             if (node instanceof Simplifiable) {
 111                                 changedNodes.add(node);
 112                             }
 113                         }
 114                         postIteration(graph, context, changedNodes);
 115                     }
 116 
 117                     if (closure.hasChanged()) {
 118                         changed = true;
 119                     } else {
 120                         break;
 121                     }
 122                 } catch (Throwable t) {
 123                     throw debug.handle(t);
< prev index next >