public ValidMatches(PAG pag, FieldToEdgesMap fieldToStores) { for (Iterator iter = pag.loadSources().iterator(); iter.hasNext();) { FieldRefNode loadSource = (FieldRefNode) iter.next(); SparkField field = loadSource.getField(); VarNode loadBase = loadSource.getBase(); ArraySet<Pair<VarNode, VarNode>> storesOnField = fieldToStores.get(field); for (Pair<VarNode, VarNode> store : storesOnField) { VarNode storeBase = store.getO2(); if (loadBase.getP2Set().hasNonEmptyIntersection(storeBase.getP2Set())) { VarNode matchSrc = store.getO1(); Node[] loadTargets = pag.loadLookup(loadSource); for (int i = 0; i < loadTargets.length; i++) { VarNode matchTgt = (VarNode) loadTargets[i]; vMatchEdges.put(matchSrc, matchTgt); vMatchBarEdges.put(matchTgt, matchSrc); } } } } }
public static FieldAccessMap buildStoreMap(PAG pag) { FieldAccessMap ret = new FieldAccessMap(); Iterator frNodeIter = pag.storeInvSourcesIterator(); while (frNodeIter.hasNext()) { FieldRefNode frNode = (FieldRefNode) frNodeIter.next(); SparkField field = frNode.getField(); Node[] targets = pag.storeInvLookup(frNode); for (int i = 0; i < targets.length; i++) { VarNode target = (VarNode) targets[i]; if (target instanceof GlobalVarNode) continue; ret.put(field, new Pair<FieldRefNode, LocalVarNode>(frNode, (LocalVarNode) target)); } } return ret; }
public static PointsToSetInternal constructIntersection(final PointsToSetInternal set1, final PointsToSetInternal set2, PAG pag) { HybridPointsToSet hybridSet1 = null, hybridSet2 = null; hybridSet1 = convertToHybrid(set1); hybridSet2 = convertToHybrid(set2); HybridPointsToSet intersection = HybridPointsToSet.intersection(hybridSet1, hybridSet2, pag); // checkSetsEqual(intersection, set1, set2, pag); return intersection; }
public static void dumpVarNodeInfo(final PAG pag) { PrintWriter varNodeWriter = null; try { varNodeWriter = new PrintWriter(new BufferedWriter(new FileWriter("varNodeInfo"))); } catch (IOException e) { e.printStackTrace(); } for (Iterator iter = pag.getVarNodeNumberer().iterator(); iter.hasNext();) { VarNode varNode = (VarNode) iter.next(); varNodeWriter.println(varNode.getNumber() + " " + varNode); } varNodeWriter.flush(); varNodeWriter.close(); }
public static void printNodeNumberMapping(String fileName, PAG pag) { try { PrintWriter pw = new PrintWriter(new FileOutputStream(fileName)); for (Iterator iter = pag.getVarNodeNumberer().iterator(); iter.hasNext();) { VarNode vn = (VarNode) iter.next(); pw.println(vn.getNumber() + "\t" + vn); } pw.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
public DemandCSPointsTo(ContextSensitiveInfo csInfo, PAG pag, int maxTraversal, int maxPasses, boolean lazy) { this.csInfo = csInfo; this.pag = pag; this.maxPasses = maxPasses; this.lazy = lazy; this.maxNodesPerPass = maxTraversal / maxPasses; this.heuristicType = HeuristicType.INCR; this.reachingObjectsCache = new HashMap<Local, PointsToSet>(); this.reachingObjectsCacheNoCGRefinement = new HashMap<Local, PointsToSet>(); this.useCache = true; }
public static P2SetFactory getFactory() { return new P2SetFactory() { public PointsToSetInternal newSet( Type type, PAG pag ) { return new BitPointsToSet( type, pag ); } }; }
public static P2SetFactory getFactory( P2SetFactory newFactory, P2SetFactory oldFactory ) { G.v().newSetFactory = newFactory; G.v().oldSetFactory = oldFactory; return new P2SetFactory() { public PointsToSetInternal newSet( Type type, PAG pag ) { return new DoublePointsToSet( type, pag ); } }; }
public final static P2SetFactory getFactory() { return new P2SetFactory() { public final PointsToSetInternal newSet(Type type, PAG pag) { return new SharedListSet(type, pag); } }; }
public final static P2SetFactory getFactory() { return new P2SetFactory() { public final PointsToSetInternal newSet( Type type, PAG pag ) { return new SortedArraySet( type, pag ); } }; }
public SharedHybridSet(Type type, PAG pag) { // I'm not sure what "type" is for, but this is the way the other set // representations // did it super(type); this.pag = pag; //System.out.println("Using new heintze set"); }
public final static P2SetFactory getFactory() { return new P2SetFactory() { public final PointsToSetInternal newSet(Type type, PAG pag) { return new SharedHybridSet(type, pag); } }; }
public static P2SetFactory getFactory() { return new P2SetFactory() { public final PointsToSetInternal newSet( Type type, PAG pag ) { return new HybridPointsToSet( type, pag ); } }; }
public static P2SetFactory getFactory() { return new P2SetFactory() { public PointsToSetInternal newSet( Type type, PAG pag ) { return new HashPointsToSet( type, pag ); } }; }
private AbsValue analyzeArrayRef(ArrayRef r, Unit u, Set <Unit> seen ) { ProgramSpy.debug("******** ARRAY REF *******"); ArrayRef fr = (ArrayRef) r; Value b = fr.getBase(); if (b instanceof Local) { try { PointsToSet ps1 = pag.reachingObjects((Local) b); PointsToSet ps2 = ((PAG) pag).reachingObjectsOfArrayElement(ps1); return possibleStringConstantsValue(b.toString(),ps2); } catch (Exception e) { return new UnknownValue(r.toString()); } } else return new UnknownValue(r.toString()); }
public static DemandCSPointsTo makeWithBudget(int maxTraversal, int maxPasses, boolean lazy) { PAG pag = (PAG) Scene.v().getPointsToAnalysis(); ContextSensitiveInfo csInfo = new ContextSensitiveInfo(pag); return new DemandCSPointsTo(csInfo, pag, maxTraversal, maxPasses, lazy); }
public DemandCSPointsTo(ContextSensitiveInfo csInfo, PAG pag) { this(csInfo, pag, DEFAULT_MAX_TRAVERSAL, DEFAULT_MAX_PASSES, DEFAULT_LAZY); }
/** * @return returns the (SPARK) pointer assignment graph */ public PAG getPAG() { return pag; }
public BitPointsToSet( Type type, PAG pag ) { super( type ); this.pag = pag; bits = new BitVector( pag.getAllocNodeNumberer().size() ); }
public DoublePointsToSet( Type type, PAG pag ) { super( type ); newSet = G.v().newSetFactory.newSet( type, pag ); oldSet = G.v().oldSetFactory.newSet( type, pag ); this.pag = pag; }
public SharedListSet(Type type, PAG pag) { super( type ); this.pag = pag; }
/** Returns a newly-created set. */ public abstract PointsToSetInternal newSet( Type type, PAG pag );
public SortedArraySet( Type type, PAG pag ) { super( type ); this.pag = pag; }
public HybridPointsToSet( Type type, PAG pag ) { super( type ); this.pag = pag; }
public HashPointsToSet( Type type, PAG pag ) { super( type ); this.pag = pag; }
public TypeManager( PAG pag ) { this.pag = pag; }
/** * @param pag * @param receiverType * @param methodName * @param parameterTypes * @param returnType */ public VirtualCallHandler(PAG pag, Type receiverType, NumberedString methodStr) { super(); this.pag = pag; this.receiverType = receiverType; this.methodStr = methodStr; }
/** * Constructor of the analysis. * @param pag Points to analysis. */ public ArrayAnalysis(PointsToAnalysis pag ) { if (pag instanceof PAG) this.pag = (PAG) pag; }
public MergeChecker( PAG pag ) { this.pag = pag; }