示例#1
0
 /*
  * @see com.ibm.wala.ipa.callgraph.impl.BasicCallGraph.NodeImpl#removeTarget(com.ibm.wala.ipa.callgraph.CGNode)
  */
 public void removeTarget(CGNode target) {
   allTargets.remove(getCallGraph().getNumber(target));
   for (IntIterator it = targets.safeIterateIndices(); it.hasNext(); ) {
     int pc = it.next();
     Object value = targets.get(pc);
     if (value instanceof CGNode) {
       if (value.equals(target)) {
         targets.remove(pc);
       }
     } else {
       MutableIntSet s = (MutableIntSet) value;
       int n = getCallGraph().getNumber(target);
       if (s.size() > 2) {
         s.remove(n);
       } else {
         assert s.size() == 2;
         if (s.contains(n)) {
           s.remove(n);
           int i = s.intIterator().next();
           targets.set(pc, getCallGraph().getNode(i));
         }
       }
     }
   }
 }
示例#2
0
    protected Set<CGNode> getPossibleTargets(CallSiteReference site) {
      Object result = targets.get(site.getProgramCounter());

      if (result == null) {
        return Collections.emptySet();
      } else if (result instanceof CGNode) {
        Set<CGNode> s = Collections.singleton((CGNode) result);
        return s;
      } else {
        IntSet s = (IntSet) result;
        HashSet<CGNode> h = HashSetFactory.make(s.size());
        for (IntIterator it = s.intIterator(); it.hasNext(); ) {
          h.add(getCallGraph().getNode(it.next()));
        }
        return h;
      }
    }