Examples of CFGVertice


Examples of ai.cfg.CFGVertice

    while(!queue.isEmpty()) {
      if (sc.shouldStop()) {
        System.out.println("---------------interrupted!");
        return null;
      }
      CFGVertice vertice = queue.poll();
      //compute inputs
      log.debug("Processing vertice:" + vertice);
      DI oldValue = values.get(vertice);
      log.debug("Cumulative input before: " + oldValue);
      DI newValue = calcualteCumulativeInput(inputs.get(vertice), edgeValues);
      log.debug("Cumulative input after: " + newValue);

      //perform widening if required
      if (oldValue != null && wideningCounts.containsKey(vertice)) {
        int iteration = wideningCounts.get(vertice).inc();
        WideningOperator<DI> wid = widenings.get(vertice);
        newValue = wid.widen(oldValue, newValue);
        logWidening(graph, semantics, iteration);
      }

//      //verify if semantics is "correct"
//      if (newValue == null || (oldValue != null && !oldValue.leq(newValue)))
//        throw new InterpreterException("Invalid semantics!!, old value: '%s', new value: '%s'", oldValue, newValue);
      //no changes, no propagation required
      if (oldValue !=null && oldValue.equals(newValue))
        continue;
      values.put(vertice, newValue);
      //we have to propagate!!
      for(CFGMultiTargetEdge multiEdge: vertice.getOutgoingMultiEdges())
        for(Pair<CFGSingleEdge, DI> res: multiEdge.acceptVerified(semantics, newValue)){
          log.debug(" Edge: "+res.left);
          CFGSingleEdge edge = res.left;
          DI newEdgeValue = res.right;
//          DI oldEdgeValue = edgeValues.get(res.left);
View Full Code Here

Examples of ai.cfg.CFGVertice

      queue.add(vertice);
      vertices.add(vertice);
    }
   
    public CFGVertice poll() {
      CFGVertice result = queue.poll();
      vertices.remove(result);
      return result;
    }
View Full Code Here

Examples of ai.cfg.CFGVertice

  public void compareLoops(Map<CFGVertice, Collection<CFGSingleEdge>> loopVertices, Map<String, Set<String>> loops) {
    BiMap<String, CFGVertice> interted = verticesMap.inverse();
    org.junit.Assert.assertEquals("Different number of loops", loops.size(), loopVertices.size());
    for (String commentLoopVertice : loops.keySet()) {
      CFGVertice cfgLoopVertice = interted.get(commentLoopVertice);
      org.junit.Assert.assertTrue("Not loop vertice: '" + commentLoopVertice + "'",
          loopVertices.containsKey(cfgLoopVertice));
      Set<String> commentLoopInputs = loops.get(commentLoopVertice);
      Collection<CFGSingleEdge> loopEdges = loopVertices.get(cfgLoopVertice);
      org.junit.Assert.assertEquals("Different number of input edges.", commentLoopInputs.size(),
View Full Code Here

Examples of ai.cfg.CFGVertice

      this.commentCfg = cfgCommentGraph;
    }
   
    private MatchResult compare(EdgeBase inputCommentEdge, CFGSingleEdge inputCfgEdge) {
      String commentVertice = inputCommentEdge.target;
      CFGVertice vertice = inputCfgEdge.target;
      // CFGVertice existing = verticesMap.get(commentVertice);
      if (verticesMap.containsKey(vertice)) {
        // already visited, verify if the same mapping
        org.junit.Assert.assertEquals("Edge '" + inputCommentEdge.toString() + "'/'" + inputCfgEdge.toString()
            + "'", commentVertice, verticesMap.get(vertice));
      } else {
        org.junit.Assert.assertFalse("Comment target '" + commentVertice + "' alreadyVisited (edge "+inputCommentEdge+") but vertice " +
            vertice + " not", verticesMap.containsValue(commentVertice));
        verticesMap.put(vertice, commentVertice);
        ArrayList<EdgeBase> commentEdges = commentCfg.graph.getOutputs(commentVertice);
        List<CFGSingleEdge> cfgEdges = vertice.getOutgoingEdges();
        try {
          org.junit.Assert.assertEquals("Vertice '" + commentVertice
              + "' has different number of output edges: expected '" + commentEdges + "', received: '"
              + cfgEdges + "'.", commentEdges.size(), cfgEdges.size());
        } catch (NullPointerException exc) {
View Full Code Here

Examples of ai.cfg.CFGVertice

      Pair<Multimap<CFGVertice, ASTNode>, Multimap<CFGVertice, ASTNode>> mappings,
      Map<ASTNode, AIAnalysisResult> result, Map<CFGVertice, ASTNode> loopVertices) {
    if (results == null) // something was wrong, ignore
      return;
    for(Map.Entry<CFGVertice, ?> resultEntry: results.entrySet()){
      CFGVertice vertice = resultEntry.getKey();
      for(ASTNode nodeBeforeVertice: mappings.left.get(vertice))
        getOrCreateResult(result, nodeBeforeVertice).setResultAfter(semantics, resultEntry.getValue());
      for(ASTNode nodeAfterVertice: mappings.right.get(vertice))
        getOrCreateResult(result, nodeAfterVertice).setResultBefore(semantics, resultEntry.getValue());
      ASTNode loopNode = loopVertices.get(vertice);
View Full Code Here

Examples of ai.cfg.CFGVertice

      System.err.println("Analysed: " + codeFragment.getUniqueName());
      System.err.println("Found1 " + nonTrivialPoints.size() + " non-trivial points");
      System.err.println("Found2 " + nonTrivialPoints2.size() + " non-trivial points");
      // compare results
      for (Map.Entry<CFGVertice, DI> entry : res.entrySet()) {
        CFGVertice key = entry.getKey();
        DI value = entry.getValue();
        compare(key, value, resAnother.get(key), results);
      }
      count += nonTrivialPoints.size();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.