Exemplo n.º 1
0
  private void computeControlDependence(Set<CallNode> nonTerm, IProgressMonitor progress) {
    progress.subTask("Compute intraprocedural nontermination sensitive control dependencies");

    for (PDG pdg : sdg.getAllContainedPDGs()) {
      NumberedGraph<AbstractPDGNode> cfg = SDGControlFlowGraph.create(pdg, false);
      for (CallNode call : pdg.getAllCalls()) {
        if (nonTerm.contains(call)) {
          // add a termination sink to all potential non-terminating calls
          AbstractPDGNode art = SDGControlFlowGraph.createArtificialNode();
          cfg.addNode(art);
          cfg.addEdge(call, art);
        }
      }

      NumberedGraph<AbstractPDGNode> cdg = NTSCDGraph.compute(cfg, pdg.getRoot(), pdg.getExit());

      removeArtificialNodes(cdg);

      for (AbstractPDGNode from : cdg) {
        for (Iterator<? extends AbstractPDGNode> it = cdg.getSuccNodes(from); it.hasNext(); ) {
          AbstractPDGNode to = it.next();
          pdg.addNonterminationSensitiveControlDependency(from, to);
        }
      }

      progress.worked(1);
    }

    progress.done();
  }