Esempio n. 1
0
 private void assertReadWithinStartBlock(ScheduleResult schedule, boolean withinStartBlock) {
   boolean readEncountered = false;
   for (Node node : schedule.getBlockToNodesMap().get(schedule.getCFG().getStartBlock())) {
     if (node instanceof FloatingReadNode) {
       readEncountered = true;
     }
   }
   assertDeepEquals(withinStartBlock, readEncountered);
 }
Esempio n. 2
0
  private void assertReadWithinAllReturnBlocks(ScheduleResult schedule, boolean withinReturnBlock) {
    StructuredGraph graph = schedule.getCFG().graph;
    assertTrue(graph.getNodes(ReturnNode.TYPE).isNotEmpty());

    int withRead = 0;
    int returnBlocks = 0;
    for (ReturnNode returnNode : graph.getNodes(ReturnNode.TYPE)) {
      Block block = schedule.getCFG().getNodeToBlock().get(returnNode);
      for (Node node : schedule.getBlockToNodesMap().get(block)) {
        if (node instanceof FloatingReadNode) {
          withRead++;
          break;
        }
      }
      returnBlocks++;
    }
    assertDeepEquals(withRead == returnBlocks, withinReturnBlock);
  }