Example #1
0
 /**
  * Checks that second lowering of a given graph did not introduce any new nodes.
  *
  * @param graph a graph that was just {@linkplain #lower lowered}
  * @throws AssertionError if the check fails
  */
 private boolean checkPostLowering(StructuredGraph graph, PhaseContext context) {
   Mark expectedMark = graph.getMark();
   lower(graph, context, LoweringMode.VERIFY_LOWERING);
   Mark mark = graph.getMark();
   assert mark.equals(expectedMark)
       : graph
           + ": a second round in the current lowering phase introduced these new nodes: "
           + graph.getNewNodes(expectedMark).snapshot();
   return true;
 }
Example #2
0
 /**
  * Checks that lowering of a given node did not introduce any new {@link Lowerable} nodes that
  * could be lowered in the current {@link LoweringPhase}. Such nodes must be recursively lowered
  * as part of lowering {@code node}.
  *
  * @param node a node that was just lowered
  * @param preLoweringMark the graph mark before {@code node} was lowered
  * @param unscheduledUsages set of {@code node}'s usages that were unscheduled before it was
  *     lowered
  * @throws AssertionError if the check fails
  */
 private static boolean checkPostNodeLowering(
     Node node,
     LoweringToolImpl loweringTool,
     Mark preLoweringMark,
     Collection<Node> unscheduledUsages) {
   StructuredGraph graph = (StructuredGraph) node.graph();
   Mark postLoweringMark = graph.getMark();
   NodeIterable<Node> newNodesAfterLowering = graph.getNewNodes(preLoweringMark);
   if (node instanceof FloatingNode) {
     if (!unscheduledUsages.isEmpty()) {
       for (Node n : newNodesAfterLowering) {
         assert !(n instanceof FixedNode)
             : node.graph()
                 + ": cannot lower floatable node "
                 + node
                 + " as it introduces fixed node(s) but has the following unscheduled usages: "
                 + unscheduledUsages;
       }
     }
   }
   for (Node n : newNodesAfterLowering) {
     if (n instanceof Lowerable) {
       ((Lowerable) n).lower(loweringTool);
       Mark mark = graph.getMark();
       assert postLoweringMark.equals(mark)
           : graph
               + ": lowering of "
               + node
               + " produced lowerable "
               + n
               + " that should have been recursively lowered as it introduces these new nodes: "
               + graph.getNewNodes(postLoweringMark).snapshot();
     }
   }
   return true;
 }