コード例 #1
0
ファイル: ExplicitCallGraph.java プロジェクト: SCanDroid/WALA
 @Override
 public CGNode findOrCreateNode(IMethod method, Context context) throws CancelException {
   if (method == null) {
     throw new IllegalArgumentException("null method");
   }
   if (context == null) {
     throw new IllegalArgumentException("null context");
   }
   Key k = new Key(method, context);
   NodeImpl result = getNode(k);
   if (result == null) {
     if (maxNumberOfNodes == -1 || getNumberOfNodes() < maxNumberOfNodes) {
       result = makeNode(method, context);
       registerNode(k, result);
     } else {
       throw CancelException.make("Too many nodes");
     }
   }
   return result;
 }
コード例 #2
0
ファイル: CGProvider.java プロジェクト: majestyhao/joana
  public static final Result getJoanaSDG(Config cfg, final IProgressMonitor progress)
      throws IllegalArgumentException, CancelException, PDGFormatException, IOException,
          WalaException, InvalidClassFileException {
    final Date start = initSDGcomputation(cfg);

    final Result jresult = getOrigSDG(cfg, progress);

    edu.kit.joana.ifc.sdg.graph.SDG joanaSdg =
        JoanaStyleSDG.createJoanaSDG(
            jresult.jsdg, cfg.addControlFlow, cfg.nonTermination, cfg.useSummaryOpt, progress);

    if (progress.isCanceled()) {
      throw CancelException.make("Operation aborted.");
    }

    // as long as we can not cope with nodes that do not belong to the control flow we do this...
    JoanaCFGSanitizer.sanitizeCFG(joanaSdg);

    //        assert assertVerify(joanaSdg, !cfg.useWalaSdg, cfg.addControlFlow);

    final Date beforeThreadAllocation = new Date();

    final MHPAnalysis mhp;

    if (cfg.computeInterference) {
      progress.beginTask("Creating cSDG from SDG " + cfg.outputSDGfile, -1);

      progress.subTask("Running Thread Allocation Analysis");
      Log.info("Running Thread Allocation Analysis");

      mhp = CSDGPreprocessor.runMHP(joanaSdg, progress);

      Log.info("Thread Allocation done.");
      progress.done();
    } else {
      mhp = null;
    }

    if (progress.isCanceled()) {
      throw CancelException.make("Operation aborted.");
    }

    final Date beforeSummaryEdge = new Date();

    if (cfg.computeSummaryEdges) {
      progress.subTask("Compute Summary Edges");
      Log.info("Compute Summary Edges");
      SummaryEdgeComputation.compute(joanaSdg, progress);

      Log.info("Summary Edges done.");
      progress.done();
    }

    if (progress.isCanceled()) {
      throw CancelException.make("Operation aborted.");
    }

    final Date end = new Date();

    long start2end = end.getTime() - start.getTime();
    long summary2end = end.getTime() - beforeSummaryEdge.getTime();
    long start2thread = beforeThreadAllocation.getTime() - start.getTime();
    long threadAlloc = beforeSummaryEdge.getTime() - beforeThreadAllocation.getTime();

    Log.info("Start 2 End: " + start2end / 1000 + "s (" + start2end + "ms)");
    Log.info("Create: " + start2thread / 1000 + "s (" + start2thread + "ms)");
    Log.info(
        "Summary: "
            + summary2end / 1000
            + "s ("
            + summary2end
            + "ms)"
            + (cfg.computeSummaryEdges ? "" : " [deactivated]"));
    Log.info(
        "Thread: "
            + threadAlloc / 1000
            + "s ("
            + threadAlloc
            + "ms)"
            + (cfg.computeInterference ? "" : " [deactivated]"));

    return new Result(joanaSdg, jresult.jsdg, jresult.cg, jresult.pts, mhp);
  }