@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * abs.hashCode(); result = prime * result + ((abs.getPredecessor() == null) ? 0 : abs.getPredecessor().hashCode()); result = prime * result + ((abs.getCurrentStmt() == null) ? 0 : abs.getCurrentStmt().hashCode()); result = prime * result + ((abs.getCorrespondingCallSite() == null) ? 0 : abs.getCorrespondingCallSite().hashCode()); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AbstractionCacheKey other = (AbstractionCacheKey) obj; if (!abs.equals(other.abs)) return false; if (abs.getPredecessor() != other.abs.getPredecessor()) return false; if (abs.getCurrentStmt() != other.abs.getCurrentStmt()) return false; if (abs.getCorrespondingCallSite() != other.abs.getCorrespondingCallSite()) return false; return true; }
@Override public void run() { while (!abstractionQueue.isEmpty()) { // Terminate the thread when we run out of memory if (isKilled()) { abstractionQueue.clear(); return; } Abstraction abstraction = abstractionQueue.remove(0); if (abstraction.getSourceContext() != null) { // Register the result results.addResult(flagAbs.getSinkDefinition(), flagAbs.getAbstraction().getAccessPath(), flagAbs.getSinkStmt(), abstraction.getSourceContext().getDefinition(), abstraction.getSourceContext().getAccessPath(), abstraction.getSourceContext().getStmt(), abstraction.getSourceContext().getUserData(), null); // Sources may not have predecessors assert abstraction.getPredecessor() == null; } else if (abstraction.getPredecessor().registerPathFlag(taskId, numTasks)) abstractionQueue.add(abstraction.getPredecessor()); if (abstraction.getNeighbors() != null) for (Abstraction nb : abstraction.getNeighbors()) if (nb.registerPathFlag(taskId, numTasks)) abstractionQueue.add(nb); } } }
assert curAbs.getPredecessor() == null; } else { for (SourceContextAndPath curScap : getPaths(taskId, curAbs.getPredecessor(), newCallStack)) { SourceContextAndPath extendedPath = curScap.extendPath(curAbs, pathConfig); if (extendedPath != null)
@Override protected boolean checkForSource(Abstraction abs, SourceContextAndPath scap) { // Record the abstraction visitedAbstractions.add(abs); // Source abstractions do not have predecessors if (abs.getPredecessor() != null) return false; // Save the abstraction path SummarySourceContextAndPath sscap = (SummarySourceContextAndPath) scap; SummarySourceInfo ssi = new SummarySourceInfo(abs.getSourceContext().getAccessPath(), abs.getSourceContext().getStmt(), abs.getSourceContext().getUserData(), sscap.getCurrentAccessPath(), sscap.getIsAlias(), !scap.isCallStackEmpty() || sscap.getDepth() != 0); ResultSinkInfo rsi = new ResultSinkInfo(null, scap.getAccessPath(), scap.getStmt()); this.resultInfos.add(new SummaryResultInfo(ssi, rsi)); return true; }
@Override public void run() { final Set<SourceContextAndPath> paths = pathCache.get(abstraction); final Abstraction pred = abstraction.getPredecessor(); if (pred != null) { for (SourceContextAndPath scap : paths) { // Process the predecessor if (processPredecessor(scap, pred)) // Schedule the predecessor scheduleDependentTask(new SourceFindingTask(pred)); // Process the predecessor's neighbors if (pred.getNeighbors() != null) for (Abstraction neighbor : pred.getNeighbors()) if (processPredecessor(scap, neighbor)) // Schedule the predecessor scheduleDependentTask(new SourceFindingTask(neighbor)); } } }
Abstraction pred = output.getPredecessor(); if (pred != null && pred != input) output.setPredecessor(input); Abstraction curAbs = output.getPredecessor(); while (curAbs != null && curAbs.getNeighbors() == null) { Abstraction predPred = curAbs.getPredecessor(); if (predPred != null) { if (predPred.equals(output))
@Override public void run() { final Set<SourceContextAndPath> paths = pathCache.get(abstraction); final Abstraction pred = abstraction.getPredecessor(); if (pred != null && paths != null) { for (SourceContextAndPath scap : paths) { // Process the predecessor if (processPredecessor(scap, pred)) { // Schedule the predecessor scheduleDependentTask(new SourceFindingTask(pred)); } // Process the predecessor's neighbors if (pred.getNeighbors() != null) { for (Abstraction neighbor : pred.getNeighbors()) { if (processPredecessor(scap, neighbor)) { // Schedule the predecessor scheduleDependentTask(new SourceFindingTask(neighbor)); } } } } } }
/** * Checks whether the given abstraction is a source. If so, a result entry is * created. * * @param abs * The abstraction to check * @param scap * The path leading up to the current abstraction * @return True if the current abstraction is a source, otherwise false */ private boolean checkForSource(Abstraction abs, SourceContextAndPath scap) { if (abs.getPredecessor() != null) return false; // If we have no predecessors, this must be a source assert abs.getSourceContext() != null; assert abs.getNeighbors() == null; // Register the source that we have found SourceContext sourceContext = abs.getSourceContext(); results.addResult(scap.getDefinition(), scap.getAccessPath(), scap.getStmt(), sourceContext.getDefinition(), sourceContext.getAccessPath(), sourceContext.getStmt(), sourceContext.getUserData(), scap.getAbstractionPath()); return true; }
/** * Checks whether the given abstraction is a source. If so, a result entry is * created. * * @param abs The abstraction to check * @param scap The path leading up to the current abstraction * @return True if the current abstraction is a source, otherwise false */ protected boolean checkForSource(Abstraction abs, SourceContextAndPath scap) { if (abs.getPredecessor() != null) return false; // If we have no predecessors, this must be a source assert abs.getSourceContext() != null; // A source should normally never have neighbors, but it can happen // with ICCTA if (abs.getNeighbors() != null) { // we ignore this issue for now, because the neighbor's source // contexts seem to be equal to our own one } // Register the source that we have found SourceContext sourceContext = abs.getSourceContext(); Pair<ResultSourceInfo, ResultSinkInfo> newResult = results.addResult(scap.getDefinition(), scap.getAccessPath(), scap.getStmt(), sourceContext.getDefinition(), sourceContext.getAccessPath(), sourceContext.getStmt(), sourceContext.getUserData(), scap.getAbstractionPath()); // Notify our handlers if (resultAvailableHandlers != null) for (OnPathBuilderResultAvailable handler : resultAvailableHandlers) handler.onResultAvailable(newResult.getO1(), newResult.getO2()); return true; }
if (source.getPredecessor() != null && !source.getPredecessor().isAbstractionActive() && source.isAbstractionActive() && source.getPredecessor().getActivationUnit() == stmt && source.getAccessPath().equals(source.getPredecessor().getAccessPath())) return null;
Value newBase = abs.getPredecessor() != null ? abs.getPredecessor().getAccessPath().getPlainValue() : abs.getAccessPath().getPlainValue(); if (rightOps.length == 1) rop = rightOps[0]; else if (abs.getPredecessor() != null) { Value base = abs.getPredecessor().getAccessPath().getPlainValue(); for (Value rv : rightOps) if (base == rv) { if (leftOps.length == 1) lop = leftOps[0]; else if (abs.getPredecessor() != null) { Value base = abs.getPredecessor().getAccessPath().getPlainValue(); for (Value rv : leftOps) if (base == rv) {