changed heuristic for on-the-fly call graph refinement with a context-sensitive pre-computed call graph

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3090 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
msridhar1 2008-11-21 16:28:59 +00:00
parent 4c37cfc4dd
commit 38f061042f
1 changed files with 11 additions and 1 deletions

View File

@ -2268,7 +2268,17 @@ public class DemandRefinementPointsTo extends AbstractDemandPointsTo {
// NOTE: if we want to be more precise for queries in dead code,
// we shouldn't rely on possibleTargets here (since there may be
// zero targets)
return !refinementPolicy.getCallGraphRefinePolicy().shouldRefine(call) || possibleTargets.size() <= 1;
if (!refinementPolicy.getCallGraphRefinePolicy().shouldRefine(call)) {
return true;
}
// here we compute the number of unique *method* targets, as opposed to call graph nodes.
// if we have a context-sensitive call graph, with many targets representing clones of
// the same method, we don't want to count the clones twice
Set<IMethod> methodTargets = new HashSet<IMethod>();
for (CGNode node: possibleTargets) {
methodTargets.add(node.getMethod());
}
return methodTargets.size() <= 1;
}
}