Simplify MethodTargetSelector and ContextSelector interfaces; delete optimizations based on allSitesDispatchIdentically and mayReturnSyntheticMethod.

Also some Cast bug fixes.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2655 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2008-03-03 21:32:36 +00:00
parent aa33858080
commit 69c1bfa991
3 changed files with 15 additions and 22 deletions

View File

@ -26,6 +26,7 @@ import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.callgraph.impl.FakeRootMethod; import com.ibm.wala.ipa.callgraph.impl.FakeRootMethod;
import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.SSAAbstractInvokeInstruction; import com.ibm.wala.ssa.SSAAbstractInvokeInstruction;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSANewInstruction; import com.ibm.wala.ssa.SSANewInstruction;
import com.ibm.wala.types.MethodReference; import com.ibm.wala.types.MethodReference;
import com.ibm.wala.types.TypeReference; import com.ibm.wala.types.TypeReference;
@ -45,8 +46,8 @@ public class JSCallGraph extends AstCallGraph {
super(fakeRoot, cha.lookupClass(JavaScriptTypes.FakeRoot), cha, options, cache); super(fakeRoot, cha.lookupClass(JavaScriptTypes.FakeRoot), cha, options, cache);
} }
public InducedCFG makeControlFlowGraph() { public InducedCFG makeControlFlowGraph(SSAInstruction[] instructions) {
return new JSInducedCFG(getStatements(), this, Everywhere.EVERYWHERE); return new JSInducedCFG(instructions, this, Everywhere.EVERYWHERE);
} }
public SSANewInstruction addAllocation(TypeReference T) { public SSANewInstruction addAllocation(TypeReference T) {

View File

@ -37,7 +37,7 @@ public class JSZeroOrOneXCFABuilder extends JSCFABuilder {
options.setSelector(new JavaScriptConstructTargetSelector(cha, options.getMethodTargetSelector())); options.setSelector(new JavaScriptConstructTargetSelector(cha, options.getMethodTargetSelector()));
ContextSelector def = new DefaultContextSelector(cha, options.getMethodTargetSelector()); ContextSelector def = new DefaultContextSelector();
ContextSelector contextSelector = appContextSelector == null ? def : new DelegatingContextSelector(appContextSelector, def); ContextSelector contextSelector = appContextSelector == null ? def : new DelegatingContextSelector(appContextSelector, def);
if (doOneCFA) { if (doOneCFA) {
contextSelector = new nCFAContextSelector(1, contextSelector); contextSelector = new nCFAContextSelector(1, contextSelector);
@ -49,18 +49,12 @@ public class JSZeroOrOneXCFABuilder extends JSCFABuilder {
} }
/** /**
* @param options * @param options options that govern call graph construction
* options that govern call graph construction * @param cha governing class hierarchy
* @param cha * @param cl classloader that can find DOMO resources
* governing class hierarchy * @param scope representation of the analysis scope
* @param cl * @param xmlFiles set of Strings that are names of XML files holding bypass logic specifications.
* classloader that can find DOMO resources * @param dmd deployment descriptor abstraction
* @param scope
* representation of the analysis scope
* @param xmlFiles
* set of Strings that are names of XML files holding bypass logic specifications.
* @param dmd
* deployment descriptor abstraction
* @return a 0-1-Opt-CFA Call Graph Builder. * @return a 0-1-Opt-CFA Call Graph Builder.
*/ */
public static JSCFABuilder make(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, ClassLoader cl, public static JSCFABuilder make(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, ClassLoader cl,

View File

@ -16,23 +16,21 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.ipa.callgraph.impl.Everywhere; import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.summaries.MethodSummary; import com.ibm.wala.ipa.summaries.MethodSummary;
import com.ibm.wala.ipa.summaries.SummarizedMethod; import com.ibm.wala.ipa.summaries.SummarizedMethod;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.types.MethodReference; import com.ibm.wala.types.MethodReference;
public class JavaScriptSummarizedFunction extends SummarizedMethod { public class JavaScriptSummarizedFunction extends SummarizedMethod {
public JavaScriptSummarizedFunction(MethodReference ref, public JavaScriptSummarizedFunction(MethodReference ref, MethodSummary summary, IClass declaringClass) {
MethodSummary summary,
IClass declaringClass)
{
super(ref, summary, declaringClass); super(ref, summary, declaringClass);
} }
public boolean equals(Object o) { public boolean equals(Object o) {
return this==o; return this == o;
} }
public InducedCFG makeControlFlowGraph() { public InducedCFG makeControlFlowGraph(SSAInstruction[] instructions) {
return new JSInducedCFG(getStatements(), this, Everywhere.EVERYWHERE); return new JSInducedCFG(instructions, this, Everywhere.EVERYWHERE);
} }
} }