use of com.jopdesign.common.graphutils.DFSTraverser.DFSEdgeType in project jop by jop-devel.
the class WCAInvoker method updateWCA.
///////////////////////////////////////////////////////////////////////////////
// Update results
///////////////////////////////////////////////////////////////////////////////
/**
* Update the WCA results after a set of methods have been changed. The changesets of analyses
* in the AnalysisManager are checked for changes too.
*
* @param changedMethods a set of methods of which the code has been modified.
* @return a set of all methods for which the path may have changed.
*/
public Set<MethodInfo> updateWCA(Collection<MethodInfo> changedMethods) {
// Now we need to clear all results for all callers of the modified methods as well as the modified methods,
// and recalculate all results
CallGraph callGraph = wcetTool.getCallGraph();
final Set<ExecutionContext> rootNodes = new LinkedHashSet<ExecutionContext>();
for (MethodInfo root : changedMethods) {
rootNodes.addAll(callGraph.getNodes(root));
}
// we also need to recalculate for new nodes.. we simply go down callstring-length from the changed methods
final int callstringLength = AppInfo.getSingleton().getCallstringLength();
DFSVisitor<ExecutionContext, ContextEdge> visitor = new EmptyDFSVisitor<ExecutionContext, ContextEdge>() {
@Override
public boolean visitNode(ExecutionContext parent, ContextEdge edge, ExecutionContext node, DFSEdgeType type, Collection<ContextEdge> outEdges, int depth) {
if (type.isFirstVisit() && !wcaNodeFlow.containsKey(node)) {
rootNodes.add(node);
}
return depth <= callstringLength;
}
};
DFSTraverser<ExecutionContext, ContextEdge> traverser = new DFSTraverser<ExecutionContext, ContextEdge>(visitor);
traverser.traverse(callGraph.getGraph(), new ArrayList<ExecutionContext>(rootNodes));
// classification changed too
for (MethodInfo method : analyses.getMethodCacheAnalysis().getClassificationChangeSet()) {
rootNodes.addAll(callGraph.getNodes(method));
}
Set<MethodInfo> changed = runAnalysis(wcetTool.getCallGraph().createInvokeGraph(rootNodes, true));
updateWCEP();
return changed;
}
Aggregations