cross-cutting changes to make more of WALA runnable with TeaVM. The biggest change is refactoring to AnalysisCache and friends; since TeaVM does not support SoftReference, I needed to add a layer of interfaces so that I can use a more simpleminded caching implementation for TeaVM. There are other changes to Module and friends to break connections with File and URL, which also cause TeaVM grief. I also organized imports in many places to remove unused types that caused trouble.
This commit is contained in:
parent
71b505cfc8
commit
d24519e974
|
@ -11,6 +11,7 @@ import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
|
|||
import com.ibm.wala.cast.java.translator.jdt.ecj.ECJClassLoaderFactory;
|
||||
import com.ibm.wala.classLoader.SourceDirectoryTreeModule;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
|
@ -67,7 +68,7 @@ public class SourceDirCallGraph {
|
|||
options.setEntrypoints(entrypoints);
|
||||
// you can dial down reflection handling if you like
|
||||
// options.setReflectionOptions(ReflectionOptions.NONE);
|
||||
AnalysisCache cache = new AnalysisCache(AstIRFactory.makeDefaultFactory());
|
||||
AnalysisCache cache = new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory());
|
||||
//CallGraphBuilder builder = new ZeroCFABuilderFactory().make(options, cache, cha, scope, false);
|
||||
CallGraphBuilder builder = new ZeroOneContainerCFABuilderFactory().make(options, cache, cha, scope, false);
|
||||
System.out.println("building call graph...");
|
||||
|
|
|
@ -71,7 +71,6 @@ import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
|||
import com.ibm.wala.types.ClassLoaderReference;
|
||||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
import com.ibm.wala.util.collections.Pair;
|
||||
import com.ibm.wala.util.debug.Assertions;
|
||||
import com.ibm.wala.util.io.TemporaryFile;
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,10 +23,12 @@ import com.ibm.wala.classLoader.ClassLoaderFactory;
|
|||
import com.ibm.wala.classLoader.Module;
|
||||
import com.ibm.wala.client.AbstractAnalysisEngine;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Util;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
|
@ -148,8 +150,8 @@ public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends Ab
|
|||
}
|
||||
|
||||
@Override
|
||||
public AnalysisCache makeDefaultCache() {
|
||||
return new AnalysisCache(AstIRFactory.makeDefaultFactory());
|
||||
public IAnalysisCacheView makeDefaultCache() {
|
||||
return new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -170,7 +172,7 @@ public abstract class JavaSourceAnalysisEngine<I extends InstanceKey> extends Ab
|
|||
}
|
||||
|
||||
@Override
|
||||
protected CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
protected CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
return new ZeroCFABuilderFactory().make(options, cache, cha, scope, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Util;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
|
@ -26,7 +27,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
|
|||
*/
|
||||
public class ZeroCFABuilderFactory {
|
||||
|
||||
public CallGraphBuilder make(AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope, boolean keepPointsTo) {
|
||||
public CallGraphBuilder make(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope, boolean keepPointsTo) {
|
||||
Util.addDefaultSelectors(options, cha);
|
||||
Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
|
||||
return new AstJavaZeroXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.NONE);
|
||||
|
|
|
@ -12,6 +12,7 @@ package com.ibm.wala.cast.java.ipa.callgraph;
|
|||
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.cfa.DefaultPointerKeyFactory;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
|
||||
|
@ -20,7 +21,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
|
|||
*/
|
||||
public class AstJavaCFABuilder extends AstJavaSSAPropagationCallGraphBuilder {
|
||||
|
||||
public AstJavaCFABuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public AstJavaCFABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(cha, options, cache, new DefaultPointerKeyFactory());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.ibm.wala.fixpoint.UnaryOperator;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.AbstractFieldPointerKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.LocalPointerKey;
|
||||
|
@ -42,7 +43,7 @@ import com.ibm.wala.util.strings.Atom;
|
|||
|
||||
public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraphBuilder {
|
||||
|
||||
protected AstJavaSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
||||
protected AstJavaSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache,
|
||||
PointerKeyFactory pointerKeyFactory) {
|
||||
super(cha, options, cache, pointerKeyFactory);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.ContextSelector;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.DefaultContextSelector;
|
||||
import com.ibm.wala.ipa.callgraph.impl.DelegatingContextSelector;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
|
||||
|
@ -25,7 +26,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
|
|||
*/
|
||||
public class AstJavaZeroXCFABuilder extends AstJavaCFABuilder {
|
||||
|
||||
public AstJavaZeroXCFABuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
||||
public AstJavaZeroXCFABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache,
|
||||
ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, int instancePolicy) {
|
||||
super(cha, options, cache);
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import nu.validator.htmlparser.common.XmlViolationPolicy;
|
||||
import nu.validator.htmlparser.sax.HtmlParser;
|
||||
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.InputSource;
|
||||
|
@ -39,6 +36,9 @@ import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
|||
import com.ibm.wala.cast.tree.impl.LineNumberPosition;
|
||||
import com.ibm.wala.util.collections.Pair;
|
||||
|
||||
import nu.validator.htmlparser.common.XmlViolationPolicy;
|
||||
import nu.validator.htmlparser.sax.HtmlParser;
|
||||
|
||||
public class NuValidatorHtmlParser implements IHtmlParser {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.ibm.wala.classLoader.IMethod;
|
|||
import com.ibm.wala.classLoader.Language;
|
||||
import com.ibm.wala.classLoader.SourceURLModule;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
|
@ -34,7 +35,7 @@ import com.ibm.wala.util.strings.Atom;
|
|||
|
||||
public class Driver {
|
||||
|
||||
public static void addDefaultDispatchLogic(AnalysisOptions options, AnalysisScope scope, IClassHierarchy cha) {
|
||||
public static void addDefaultDispatchLogic(AnalysisOptions options, AnalysisScope scope, IClassHierarchy cha, AnalysisCache cache) {
|
||||
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
|
||||
|
||||
Map<Atom,MethodTargetSelector> methodTargetSelectors = HashMapFactory.make();
|
||||
|
@ -77,11 +78,11 @@ public class Driver {
|
|||
|
||||
AnalysisOptions options = new AnalysisOptions(scope, roots);
|
||||
|
||||
addDefaultDispatchLogic(options, scope, cha);
|
||||
|
||||
IRFactory<IMethod> factory = AstIRFactory.makeDefaultFactory();
|
||||
|
||||
AnalysisCache cache = new AnalysisCache(factory);
|
||||
AnalysisCache cache = new AnalysisCacheImpl(factory);
|
||||
|
||||
addDefaultDispatchLogic(options, scope, cha, cache);
|
||||
|
||||
JavaJavaScriptHybridCallGraphBuilder b = new JavaJavaScriptHybridCallGraphBuilder(cha, options, cache);
|
||||
|
||||
|
|
|
@ -5,16 +5,14 @@ import java.net.URL;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
|
||||
import org.junit.Before;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
|
||||
import com.ibm.wala.cast.js.html.DefaultSourceExtractor;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraph;
|
||||
import com.ibm.wala.cast.js.test.FieldBasedCGUtil;
|
||||
import com.ibm.wala.cast.js.test.TestJSCallGraphShape;
|
||||
import com.ibm.wala.cast.js.test.FieldBasedCGUtil.BuilderType;
|
||||
import com.ibm.wala.cast.js.test.TestJSCallGraphShape;
|
||||
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||
import com.ibm.wala.cast.js.util.CallGraph2JSON;
|
||||
import com.ibm.wala.util.CancelException;
|
||||
|
@ -22,6 +20,8 @@ import com.ibm.wala.util.NullProgressMonitor;
|
|||
import com.ibm.wala.util.ProgressMaster;
|
||||
import com.ibm.wala.util.WalaException;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
|
||||
public abstract class AbstractFieldBasedTest extends TestJSCallGraphShape {
|
||||
|
||||
protected FieldBasedCGUtil util;
|
||||
|
@ -66,8 +66,7 @@ public abstract class AbstractFieldBasedTest extends TestJSCallGraphShape {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void dumpCG(JSCallGraph cg) {
|
||||
protected void dumpCG(JSCallGraph cg) {
|
||||
CallGraph2JSON.IGNORE_HARNESS = false;
|
||||
Map<String, Set<String>> edges = CallGraph2JSON.extractEdges(cg);
|
||||
for(String callsite : edges.keySet())
|
||||
|
|
|
@ -18,10 +18,12 @@ public class FieldBasedCGGamesTest extends AbstractFieldBasedTest {
|
|||
runTestExceptOnTravis(new URL("http://www.themaninblue.com/experiment/BunnyHunt/"), new Object[][]{}, BuilderType.OPTIMISTIC_WORKLIST);
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testBomberman() throws IOException, WalaException, Error, CancelException {
|
||||
runTestExceptOnTravis(new URL("http://www.e-forum.ro/bomberman/dynagame.html"), new Object[][]{}, BuilderType.OPTIMISTIC_WORKLIST);
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testBeslimed() throws IOException, WalaException, Error, CancelException {
|
||||
|
@ -34,11 +36,13 @@ public class FieldBasedCGGamesTest extends AbstractFieldBasedTest {
|
|||
runTestExceptOnTravis(new URL("http://www.pixastic.com/labs/digg_attack/"), new Object[][]{}, BuilderType.OPTIMISTIC_WORKLIST);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testRiverRaider() throws IOException, WalaException, Error, CancelException {
|
||||
runTestExceptOnTravis(new URL("http://playstar.mobi/games/riverraider/index.html?playerId=&gameId=8&highscore=102425"), new Object[][]{}, BuilderType.OPTIMISTIC_WORKLIST);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testSolitaire() throws IOException, WalaException, Error, CancelException {
|
||||
runTestExceptOnTravis(new URL("http://www.inmensia.com/files/solitaire1.0.html"), new Object[][]{}, BuilderType.OPTIMISTIC_WORKLIST);
|
||||
|
@ -53,6 +57,7 @@ public class FieldBasedCGGamesTest extends AbstractFieldBasedTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testMinesweeper() throws IOException, WalaException, Error, CancelException {
|
||||
runTestExceptOnTravis(new URL("http://www.inmensia.com/files/minesweeper1.0.html"), new Object[][]{}, BuilderType.OPTIMISTIC_WORKLIST);
|
||||
|
|
|
@ -2,17 +2,17 @@ package com.ibm.wala.cast.js.rhino.callgraph.fieldbased.test;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.Error;
|
||||
import com.ibm.wala.cast.js.html.JSSourceExtractor;
|
||||
import com.ibm.wala.cast.js.test.TestSimplePageCallGraphShape;
|
||||
import com.ibm.wala.cast.js.test.FieldBasedCGUtil.BuilderType;
|
||||
import com.ibm.wala.cast.js.test.TestSimplePageCallGraphShape;
|
||||
import com.ibm.wala.util.CancelException;
|
||||
import com.ibm.wala.util.WalaException;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
|
||||
public class FieldBasedComparisonTest extends AbstractFieldBasedTest {
|
||||
|
||||
private void test(String file, Object[][] assertions, BuilderType builderType) throws IOException, WalaException, Error, CancelException {
|
||||
|
|
|
@ -17,8 +17,6 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import com.ibm.wala.cast.js.html.DefaultSourceExtractor;
|
||||
import com.ibm.wala.cast.js.html.JSSourceExtractor;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
||||
|
@ -40,6 +38,8 @@ import com.ibm.wala.util.io.CommandLine;
|
|||
import com.ibm.wala.util.io.FileProvider;
|
||||
import com.ibm.wala.util.io.FileUtil;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
/**
|
||||
* Utility class for building call graphs of HTML pages.
|
||||
*
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package com.ibm.wala.cast.js.translator;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||
import com.ibm.wala.cast.js.translator.JavaScriptLoopUnwindingTranslatorFactory;
|
||||
import com.ibm.wala.cast.tree.CAst;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
|
||||
|
|
|
@ -13,19 +13,10 @@ package com.ibm.wala.cast.js.translator;
|
|||
import com.ibm.wala.cast.ir.translator.RewritingTranslatorToCAst;
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||
import com.ibm.wala.cast.tree.impl.CAstImpl;
|
||||
import com.ibm.wala.classLoader.SourceFileModule;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
|
||||
public class CAstRhinoTranslator extends RewritingTranslatorToCAst implements TranslatorToCAst {
|
||||
private static String getName(SourceModule M) {
|
||||
if (M instanceof SourceFileModule) {
|
||||
return ((SourceFileModule) M).getClassName();
|
||||
} else {
|
||||
return M.getName();
|
||||
}
|
||||
}
|
||||
|
||||
public CAstRhinoTranslator(SourceModule M, boolean replicateForDoLoops) {
|
||||
super(M, new RhinoToAstTranslator(new CAstImpl(), M, getName(M), replicateForDoLoops));
|
||||
public CAstRhinoTranslator(ModuleEntry m, boolean replicateForDoLoops) {
|
||||
super(m, new RhinoToAstTranslator(new CAstImpl(), m, m.getName(), replicateForDoLoops));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ package com.ibm.wala.cast.js.translator;
|
|||
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||
import com.ibm.wala.cast.tree.CAst;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
|
||||
public class CAstRhinoTranslatorFactory implements JavaScriptTranslatorFactory {
|
||||
|
||||
@Override
|
||||
public TranslatorToCAst make(CAst ast, SourceModule M) {
|
||||
public TranslatorToCAst make(CAst ast, ModuleEntry M) {
|
||||
return new CAstRhinoTranslator(M, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package com.ibm.wala.cast.js.translator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
|
@ -90,7 +91,6 @@ import org.mozilla.javascript.ast.XmlString;
|
|||
import org.mozilla.javascript.ast.Yield;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.DoLoopTranslator;
|
||||
import com.ibm.wala.cast.js.html.MappedSourceModule;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSSSAPropagationCallGraphBuilder;
|
||||
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
||||
|
@ -113,6 +113,7 @@ import com.ibm.wala.cast.tree.rewrite.CAstRewriter.RewriteContext;
|
|||
import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
|
||||
import com.ibm.wala.cast.tree.visit.CAstVisitor;
|
||||
import com.ibm.wala.cast.util.CAstPattern;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.util.collections.EmptyIterator;
|
||||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
|
@ -539,7 +540,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
|
|||
}
|
||||
|
||||
private Position makePosition(AstNode n) {
|
||||
URL url = sourceModule.getURL();
|
||||
URL url = ((SourceModule)sourceModule).getURL();
|
||||
int line = n.getLineno();
|
||||
Position pos = new RangePosition(url, line, n.getAbsolutePosition(), n.getAbsolutePosition()+n.getLength());
|
||||
|
||||
|
@ -2426,7 +2427,7 @@ private CAstNode[] walkChildren(final Node n, WalkContext context) {
|
|||
|
||||
private final String scriptName;
|
||||
|
||||
private final SourceModule sourceModule;
|
||||
private final ModuleEntry sourceModule;
|
||||
|
||||
final private Reader sourceReader;
|
||||
|
||||
|
@ -2434,11 +2435,11 @@ private CAstNode[] walkChildren(final Node n, WalkContext context) {
|
|||
|
||||
private final DoLoopTranslator doLoopTranslator;
|
||||
|
||||
public RhinoToAstTranslator(CAst Ast, SourceModule M, String scriptName, boolean replicateForDoLoops) {
|
||||
public RhinoToAstTranslator(CAst Ast, ModuleEntry m, String scriptName, boolean replicateForDoLoops) {
|
||||
this.Ast = Ast;
|
||||
this.scriptName = scriptName;
|
||||
this.sourceModule = M;
|
||||
this.sourceReader = sourceModule.getInputReader();
|
||||
this.sourceModule = m;
|
||||
this.sourceReader = new InputStreamReader(sourceModule.getInputStream());
|
||||
this.doLoopTranslator = new DoLoopTranslator(replicateForDoLoops, Ast);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,11 @@ import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
|||
import com.ibm.wala.cast.js.loader.JavaScriptLoaderFactory;
|
||||
import com.ibm.wala.cast.js.translator.JavaScriptTranslatorFactory;
|
||||
import com.ibm.wala.cast.js.util.Util;
|
||||
import com.ibm.wala.classLoader.Module;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.classLoader.SourceURLModule;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
|
@ -74,7 +76,7 @@ public class FieldBasedCGUtil {
|
|||
|
||||
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildScriptCG(URL url, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException {
|
||||
JavaScriptLoaderFactory loaders = new JavaScriptLoaderFactory(translatorFactory);
|
||||
SourceModule[] scripts = new SourceModule[]{
|
||||
Module[] scripts = new Module[]{
|
||||
new SourceURLModule(url),
|
||||
JSCallGraphBuilderUtil.getPrologueFile("prologue.js")
|
||||
};
|
||||
|
@ -83,7 +85,7 @@ public class FieldBasedCGUtil {
|
|||
|
||||
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildTestCG(String dir, String name, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException {
|
||||
JavaScriptLoaderFactory loaders = new JavaScriptLoaderFactory(translatorFactory);
|
||||
SourceModule[] scripts = JSCallGraphBuilderUtil.makeSourceModules(dir, name);
|
||||
Module[] scripts = JSCallGraphBuilderUtil.makeSourceModules(dir, name);
|
||||
return buildCG(loaders, scripts, builderType, monitor, supportFullPointerAnalysis);
|
||||
}
|
||||
|
||||
|
@ -93,14 +95,14 @@ public class FieldBasedCGUtil {
|
|||
return buildCG(loaders, scripts, builderType, monitor, supportFullPointerAnalysis);
|
||||
}
|
||||
|
||||
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(JavaScriptLoaderFactory loaders, SourceModule[] scripts, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException {
|
||||
public Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> buildCG(JavaScriptLoaderFactory loaders, Module[] scripts, BuilderType builderType, IProgressMonitor monitor, boolean supportFullPointerAnalysis) throws IOException, WalaException, CancelException {
|
||||
CAstAnalysisScope scope = new CAstAnalysisScope(scripts, loaders, Collections.singleton(JavaScriptLoader.JS));
|
||||
IClassHierarchy cha = ClassHierarchyFactory.make(scope, loaders, JavaScriptLoader.JS);
|
||||
Util.checkForFrontEndErrors(cha);
|
||||
Iterable<Entrypoint> roots = JSCallGraphUtil.makeScriptRoots(cha);
|
||||
FieldBasedCallGraphBuilder builder = null;
|
||||
|
||||
AnalysisCache cache = new AnalysisCache(AstIRFactory.makeDefaultFactory());
|
||||
AnalysisCache cache = new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory());
|
||||
switch(builderType) {
|
||||
case PESSIMISTIC:
|
||||
builder = new PessimisticCallGraphBuilder(cha, JSCallGraphUtil.makeOptions(scope, cha, roots), cache, supportFullPointerAnalysis);
|
||||
|
|
|
@ -33,10 +33,10 @@ import com.ibm.wala.cast.js.ipa.callgraph.PropertyNameContextSelector;
|
|||
import com.ibm.wala.cast.js.ipa.callgraph.correlations.extraction.CorrelatedPairExtractorFactory;
|
||||
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
||||
import com.ibm.wala.cast.js.loader.JavaScriptLoaderFactory;
|
||||
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil.CGBuilderType;
|
||||
import com.ibm.wala.cast.loader.CAstAbstractLoader;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.classLoader.Module;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.classLoader.SourceURLModule;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
|
@ -123,13 +123,13 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
|
|||
return makeScope(makeSourceModules(dir, name, JSCallGraphBuilderUtil.class.getClassLoader()), loaders, JavaScriptLoader.JS);
|
||||
}
|
||||
|
||||
public static SourceModule[] makeSourceModules(String dir, String name) throws IOException {
|
||||
public static Module[] makeSourceModules(String dir, String name) throws IOException {
|
||||
return makeSourceModules(dir, name, JSCallGraphBuilderUtil.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static SourceModule[] makeSourceModules(String dir, String name, ClassLoader loader) throws IOException {
|
||||
public static Module[] makeSourceModules(String dir, String name, ClassLoader loader) throws IOException {
|
||||
URL script = getURLforFile(dir, name, loader);
|
||||
SourceModule[] modules = new SourceModule[] {
|
||||
Module[] modules = new Module[] {
|
||||
(script.openConnection() instanceof JarURLConnection)? new SourceURLModule(script): makeSourceModule(script, dir, name),
|
||||
getPrologueFile("prologue.js")
|
||||
};
|
||||
|
@ -187,7 +187,7 @@ public class JSCallGraphBuilderUtil extends com.ibm.wala.cast.js.ipa.callgraph.J
|
|||
}
|
||||
|
||||
public static SourceModule[] makeHtmlScope(URL url, JavaScriptLoaderFactory loaders, Function<Void,JSSourceExtractor> fExtractor) {
|
||||
Set<SourceModule> scripts = HashSetFactory.make();
|
||||
Set<Module> scripts = HashSetFactory.make();
|
||||
|
||||
JavaScriptLoader.addBootstrapFile(WebUtil.preamble);
|
||||
scripts.add(getPrologueFile("prologue.js"));
|
||||
|
|
|
@ -34,12 +34,12 @@ import com.ibm.wala.util.WalaException;
|
|||
public abstract class TestArgumentSensitivity extends TestJSCallGraphShape {
|
||||
|
||||
protected static final Object[][] assertionsForArgs = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/args.js" } },
|
||||
new Object[] { ROOT, new String[] { "args.js" } },
|
||||
new Object[] {
|
||||
"tests/args.js",
|
||||
new String[] { "tests/args.js/a" } },
|
||||
new Object[] { "tests/args.js/a", new String[] { "tests/args.js/x"} },
|
||||
new Object[] { "tests/args.js/a", new String[] { "tests/args.js/y", "tests/args.js/z", "!tests/args.js/wrong" } } };
|
||||
"args.js",
|
||||
new String[] { "args.js/a" } },
|
||||
new Object[] { "args.js/a", new String[] { "args.js/x"} },
|
||||
new Object[] { "args.js/a", new String[] { "args.js/y", "args.js/z", "!args.js/wrong" } } };
|
||||
|
||||
@Test public void testArgs() throws IOException, IllegalArgumentException, CancelException, ClassHierarchyException, WalaException {
|
||||
JavaScriptLoaderFactory loaders = JSCallGraphUtil.makeLoaders(null);
|
||||
|
|
|
@ -70,19 +70,19 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
|
|||
|
||||
private static final Object[][] assertionsForBadForin = new Object[][] {
|
||||
new Object[] { ROOT,
|
||||
new String[] { "tests/badforin.js" } },
|
||||
new Object[] { "tests/badforin.js",
|
||||
new String[] { "tests/badforin.js/testForIn", "tests/badforin.js/_check_obj_foo", "tests/badforin.js/_check_obj_bar", "tests/badforin.js/_check_copy_foo", "tests/badforin.js/_check_copy_bar"} },
|
||||
new Object[] { "tests/badforin.js/testForIn",
|
||||
new String[] { "tests/badforin.js/testForIn1", "tests/badforin.js/testForIn2" } },
|
||||
new Object[] { "tests/badforin.js/_check_obj_foo",
|
||||
new String[] { "tests/badforin.js/testForIn1" } },
|
||||
new Object[] { "tests/badforin.js/_check_copy_foo",
|
||||
new String[] { "tests/badforin.js/testForIn1" } },
|
||||
new Object[] { "tests/badforin.js/_check_obj_bar",
|
||||
new String[] { "tests/badforin.js/testForIn2" } },
|
||||
new Object[] { "tests/badforin.js/_check_copy_bar",
|
||||
new String[] { "tests/badforin.js/testForIn2" } }
|
||||
new String[] { "badforin.js" } },
|
||||
new Object[] { "badforin.js",
|
||||
new String[] { "badforin.js/testForIn", "badforin.js/_check_obj_foo", "badforin.js/_check_obj_bar", "badforin.js/_check_copy_foo", "badforin.js/_check_copy_bar"} },
|
||||
new Object[] { "badforin.js/testForIn",
|
||||
new String[] { "badforin.js/testForIn1", "badforin.js/testForIn2" } },
|
||||
new Object[] { "badforin.js/_check_obj_foo",
|
||||
new String[] { "badforin.js/testForIn1" } },
|
||||
new Object[] { "badforin.js/_check_copy_foo",
|
||||
new String[] { "badforin.js/testForIn1" } },
|
||||
new Object[] { "badforin.js/_check_obj_bar",
|
||||
new String[] { "badforin.js/testForIn2" } },
|
||||
new Object[] { "badforin.js/_check_copy_bar",
|
||||
new String[] { "badforin.js/testForIn2" } }
|
||||
};
|
||||
|
||||
@Test public void testBadForInWithoutHack() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -93,14 +93,14 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForBadForinHackPrecision = new Object[][] {
|
||||
new Object[] { "tests/badforin.js/_check_obj_foo",
|
||||
new String[] { "!tests/badforin.js/testForIn2" } },
|
||||
new Object[] { "tests/badforin.js/_check_copy_foo",
|
||||
new String[] { "!tests/badforin.js/testForIn2" } },
|
||||
new Object[] { "tests/badforin.js/_check_obj_bar",
|
||||
new String[] { "!tests/badforin.js/testForIn1" } },
|
||||
new Object[] { "tests/badforin.js/_check_copy_bar",
|
||||
new String[] { "!tests/badforin.js/testForIn1" } }
|
||||
new Object[] { "badforin.js/_check_obj_foo",
|
||||
new String[] { "!badforin.js/testForIn2" } },
|
||||
new Object[] { "badforin.js/_check_copy_foo",
|
||||
new String[] { "!badforin.js/testForIn2" } },
|
||||
new Object[] { "badforin.js/_check_obj_bar",
|
||||
new String[] { "!badforin.js/testForIn1" } },
|
||||
new Object[] { "badforin.js/_check_copy_bar",
|
||||
new String[] { "!badforin.js/testForIn1" } }
|
||||
};
|
||||
|
||||
@Test public void testBadForInWithHack() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -114,19 +114,19 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
|
|||
|
||||
private static final Object[][] assertionsForbadforin2 = new Object[][] {
|
||||
new Object[] { ROOT,
|
||||
new String[] { "tests/badforin2.js" } },
|
||||
new Object[] { "tests/badforin2.js",
|
||||
new String[] { "tests/badforin2.js/testForIn", "tests/badforin2.js/_check_obj_foo", "tests/badforin2.js/_check_obj_bar", "tests/badforin2.js/_check_copy_foo", "tests/badforin2.js/_check_copy_bar"} },
|
||||
new Object[] { "tests/badforin2.js/testForIn",
|
||||
new String[] { "tests/badforin2.js/testForIn1", "tests/badforin2.js/testForIn2" } },
|
||||
new Object[] { "tests/badforin2.js/_check_obj_foo",
|
||||
new String[] { "tests/badforin2.js/testForIn1" } },
|
||||
new Object[] { "tests/badforin2.js/_check_copy_foo",
|
||||
new String[] { "tests/badforin2.js/testForIn1" } },
|
||||
new Object[] { "tests/badforin2.js/_check_obj_bar",
|
||||
new String[] { "tests/badforin2.js/testForIn2" } },
|
||||
new Object[] { "tests/badforin2.js/_check_copy_bar",
|
||||
new String[] { "tests/badforin2.js/testForIn2" } }
|
||||
new String[] { "badforin2.js" } },
|
||||
new Object[] { "badforin2.js",
|
||||
new String[] { "badforin2.js/testForIn", "badforin2.js/_check_obj_foo", "badforin2.js/_check_obj_bar", "badforin2.js/_check_copy_foo", "badforin2.js/_check_copy_bar"} },
|
||||
new Object[] { "badforin2.js/testForIn",
|
||||
new String[] { "badforin2.js/testForIn1", "badforin2.js/testForIn2" } },
|
||||
new Object[] { "badforin2.js/_check_obj_foo",
|
||||
new String[] { "badforin2.js/testForIn1" } },
|
||||
new Object[] { "badforin2.js/_check_copy_foo",
|
||||
new String[] { "badforin2.js/testForIn1" } },
|
||||
new Object[] { "badforin2.js/_check_obj_bar",
|
||||
new String[] { "badforin2.js/testForIn2" } },
|
||||
new Object[] { "badforin2.js/_check_copy_bar",
|
||||
new String[] { "badforin2.js/testForIn2" } }
|
||||
};
|
||||
|
||||
@Test public void testbadforin2WithoutHack() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -137,14 +137,14 @@ public abstract class TestForInLoopHack extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForbadforin2HackPrecision = new Object[][] {
|
||||
new Object[] { "tests/badforin2.js/_check_obj_foo",
|
||||
new String[] { "!tests/badforin2.js/testForIn2" } },
|
||||
new Object[] { "tests/badforin2.js/_check_copy_foo",
|
||||
new String[] { "!tests/badforin2.js/testForIn2" } },
|
||||
new Object[] { "tests/badforin2.js/_check_obj_bar",
|
||||
new String[] { "!tests/badforin2.js/testForIn1" } },
|
||||
new Object[] { "tests/badforin2.js/_check_copy_bar",
|
||||
new String[] { "!tests/badforin2.js/testForIn1" } }
|
||||
new Object[] { "badforin2.js/_check_obj_foo",
|
||||
new String[] { "!badforin2.js/testForIn2" } },
|
||||
new Object[] { "badforin2.js/_check_copy_foo",
|
||||
new String[] { "!badforin2.js/testForIn2" } },
|
||||
new Object[] { "badforin2.js/_check_obj_bar",
|
||||
new String[] { "!badforin2.js/testForIn1" } },
|
||||
new Object[] { "badforin2.js/_check_copy_bar",
|
||||
new String[] { "!badforin2.js/testForIn1" } }
|
||||
};
|
||||
|
||||
@Test public void testbadforin2WithHack() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
|
|
@ -19,7 +19,6 @@ import org.junit.Test;
|
|||
|
||||
import com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.PropertyNameContextSelector;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
|
@ -39,11 +38,11 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
protected static final Object[][] assertionsForArgs = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/args.js" } },
|
||||
new Object[] { ROOT, new String[] { "args.js" } },
|
||||
new Object[] {
|
||||
"tests/args.js",
|
||||
new String[] { "tests/args.js/a" } },
|
||||
new Object[] { "tests/args.js/a", new String[] { "tests/args.js/x", "tests/args.js/y" } } };
|
||||
"args.js",
|
||||
new String[] { "args.js/a" } },
|
||||
new Object[] { "args.js/a", new String[] { "args.js/x", "args.js/y" } } };
|
||||
|
||||
@Test public void testArgs() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
CallGraph CG = JSCallGraphBuilderUtil.makeScriptCG("tests", "args.js");
|
||||
|
@ -51,16 +50,16 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
protected static final Object[][] assertionsForSimple = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/simple.js" } },
|
||||
new Object[] { ROOT, new String[] { "simple.js" } },
|
||||
new Object[] {
|
||||
"tests/simple.js",
|
||||
new String[] { "tests/simple.js/bad", "tests/simple.js/silly", "tests/simple.js/fib", "tests/simple.js/stranger",
|
||||
"tests/simple.js/trivial", "tests/simple.js/rubbish", "tests/simple.js/weirder" } },
|
||||
new Object[] { "tests/simple.js/trivial", new String[] { "tests/simple.js/trivial/inc" } },
|
||||
new Object[] { "tests/simple.js/rubbish",
|
||||
new String[] { "tests/simple.js/weirder", "tests/simple.js/stranger", "tests/simple.js/rubbish" } },
|
||||
new Object[] { "tests/simple.js/fib", new String[] { "tests/simple.js/fib" } },
|
||||
new Object[] { "tests/simple.js/weirder", new String[] { "prologue.js/Math_abs" } } };
|
||||
"simple.js",
|
||||
new String[] { "simple.js/bad", "simple.js/silly", "simple.js/fib", "simple.js/stranger",
|
||||
"simple.js/trivial", "simple.js/rubbish", "simple.js/weirder" } },
|
||||
new Object[] { "simple.js/trivial", new String[] { "simple.js/trivial/inc" } },
|
||||
new Object[] { "simple.js/rubbish",
|
||||
new String[] { "simple.js/weirder", "simple.js/stranger", "simple.js/rubbish" } },
|
||||
new Object[] { "simple.js/fib", new String[] { "simple.js/fib" } },
|
||||
new Object[] { "simple.js/weirder", new String[] { "prologue.js/Math_abs" } } };
|
||||
|
||||
@Test
|
||||
public void testSimple() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -69,12 +68,12 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForObjects = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/objects.js" } },
|
||||
new Object[] { "tests/objects.js",
|
||||
new String[] { "tests/objects.js/objects_are_fun", "tests/objects.js/other", "tests/objects.js/something" } },
|
||||
new Object[] { "tests/objects.js/other",
|
||||
new String[] { "tests/objects.js/something", "tests/objects.js/objects_are_fun/nothing" } },
|
||||
new Object[] { "tests/objects.js/objects_are_fun", new String[] { "tests/objects.js/other", "tests/objects.js/whatever" } } };
|
||||
new Object[] { ROOT, new String[] { "objects.js" } },
|
||||
new Object[] { "objects.js",
|
||||
new String[] { "objects.js/objects_are_fun", "objects.js/other", "objects.js/something" } },
|
||||
new Object[] { "objects.js/other",
|
||||
new String[] { "objects.js/something", "objects.js/objects_are_fun/nothing" } },
|
||||
new Object[] { "objects.js/objects_are_fun", new String[] { "objects.js/other", "objects.js/whatever" } } };
|
||||
|
||||
@Test
|
||||
public void testObjects() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -83,34 +82,34 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] cfgAssertionsForInherit = new Object[][] {
|
||||
new Object[]{"ctor:tests/inherit.js/objectMasquerading/Rectangle",
|
||||
new Object[]{"ctor:inherit.js/objectMasquerading/Rectangle",
|
||||
new int[][]{{1,7},{2},{3,7},{4,7},{5,6},{7},{7}}
|
||||
},
|
||||
new Object[]{"ctor:tests/inherit.js/sharedClassObject/Rectangle",
|
||||
new Object[]{"ctor:inherit.js/sharedClassObject/Rectangle",
|
||||
new int[][]{{1,7},{2},{3,7},{4,7},{5,6},{7},{7}}
|
||||
}
|
||||
};
|
||||
|
||||
private static final Object[][] assertionsForInherit = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/inherit.js" } },
|
||||
new Object[] { ROOT, new String[] { "inherit.js" } },
|
||||
new Object[] {
|
||||
"tests/inherit.js",
|
||||
new String[] { "tests/inherit.js/objectMasquerading", "tests/inherit.js/objectMasquerading/Rectangle/area",
|
||||
"tests/inherit.js/Polygon/shape", "tests/inherit.js/sharedClassObject",
|
||||
"tests/inherit.js/sharedClassObject/Rectangle/area" } },
|
||||
"inherit.js",
|
||||
new String[] { "inherit.js/objectMasquerading", "inherit.js/objectMasquerading/Rectangle/area",
|
||||
"inherit.js/Polygon/shape", "inherit.js/sharedClassObject",
|
||||
"inherit.js/sharedClassObject/Rectangle/area" } },
|
||||
new Object[]{
|
||||
"tests/inherit.js/objectMasquerading",
|
||||
new String[]{"ctor:tests/inherit.js/objectMasquerading/Rectangle"}},
|
||||
"inherit.js/objectMasquerading",
|
||||
new String[]{"ctor:inherit.js/objectMasquerading/Rectangle"}},
|
||||
new Object[]{
|
||||
"ctor:tests/inherit.js/objectMasquerading/Rectangle" ,
|
||||
new String[]{"tests/inherit.js/objectMasquerading/Rectangle"}},
|
||||
new Object[]{"tests/inherit.js/objectMasquerading/Rectangle",
|
||||
new String[]{"tests/inherit.js/Polygon"}},
|
||||
"ctor:inherit.js/objectMasquerading/Rectangle" ,
|
||||
new String[]{"inherit.js/objectMasquerading/Rectangle"}},
|
||||
new Object[]{"inherit.js/objectMasquerading/Rectangle",
|
||||
new String[]{"inherit.js/Polygon"}},
|
||||
new Object[]{
|
||||
"tests/inherit.js/sharedClassObject",
|
||||
new String[]{"ctor:tests/inherit.js/sharedClassObject/Rectangle"}},
|
||||
new Object[]{"ctor:tests/inherit.js/sharedClassObject/Rectangle",
|
||||
new String[]{"tests/inherit.js/sharedClassObject/Rectangle"}}
|
||||
"inherit.js/sharedClassObject",
|
||||
new String[]{"ctor:inherit.js/sharedClassObject/Rectangle"}},
|
||||
new Object[]{"ctor:inherit.js/sharedClassObject/Rectangle",
|
||||
new String[]{"inherit.js/sharedClassObject/Rectangle"}}
|
||||
};
|
||||
|
||||
@Test
|
||||
|
@ -121,8 +120,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForNewfn = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/newfn.js" } },
|
||||
new Object[] { "tests/newfn.js",
|
||||
new Object[] { ROOT, new String[] { "newfn.js" } },
|
||||
new Object[] { "newfn.js",
|
||||
new String[] { "suffix:ctor$1/_fromctor", "suffix:ctor$2/_fromctor", "suffix:ctor$3/_fromctor" } } };
|
||||
|
||||
@Test
|
||||
|
@ -132,11 +131,11 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForControlflow = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/control-flow.js" } },
|
||||
new Object[] { ROOT, new String[] { "control-flow.js" } },
|
||||
new Object[] {
|
||||
"tests/control-flow.js",
|
||||
new String[] { "tests/control-flow.js/testSwitch", "tests/control-flow.js/testDoWhile",
|
||||
"tests/control-flow.js/testWhile", "tests/control-flow.js/testFor", "tests/control-flow.js/testReturn" } } };
|
||||
"control-flow.js",
|
||||
new String[] { "control-flow.js/testSwitch", "control-flow.js/testDoWhile",
|
||||
"control-flow.js/testWhile", "control-flow.js/testFor", "control-flow.js/testReturn" } } };
|
||||
|
||||
@Test
|
||||
public void testControlflow() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -145,12 +144,12 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForMoreControlflow = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/more-control-flow.js" } },
|
||||
new Object[] { ROOT, new String[] { "more-control-flow.js" } },
|
||||
new Object[] {
|
||||
"tests/more-control-flow.js",
|
||||
new String[] { "tests/more-control-flow.js/testSwitch", "tests/more-control-flow.js/testIfConvertedSwitch",
|
||||
"tests/more-control-flow.js/testDoWhile", "tests/more-control-flow.js/testWhile",
|
||||
"tests/more-control-flow.js/testFor", "tests/more-control-flow.js/testReturn" } } };
|
||||
"more-control-flow.js",
|
||||
new String[] { "more-control-flow.js/testSwitch", "more-control-flow.js/testIfConvertedSwitch",
|
||||
"more-control-flow.js/testDoWhile", "more-control-flow.js/testWhile",
|
||||
"more-control-flow.js/testFor", "more-control-flow.js/testReturn" } } };
|
||||
|
||||
@Test
|
||||
public void testMoreControlflow() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -158,9 +157,9 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
verifyGraphAssertions(CG, assertionsForMoreControlflow);
|
||||
}
|
||||
|
||||
private static final Object[][] assertionsForForin = new Object[][] { new Object[] { ROOT, new String[] { "tests/forin.js" } },
|
||||
new Object[] { "tests/forin.js", new String[] { "tests/forin.js/testForIn" } },
|
||||
new Object[] { "tests/forin.js/testForIn", new String[] { "tests/forin.js/testForIn1", "tests/forin.js/testForIn2" } } };
|
||||
private static final Object[][] assertionsForForin = new Object[][] { new Object[] { ROOT, new String[] { "forin.js" } },
|
||||
new Object[] { "forin.js", new String[] { "forin.js/testForIn" } },
|
||||
new Object[] { "forin.js/testForIn", new String[] { "forin.js/testForIn1", "forin.js/testForIn2" } } };
|
||||
|
||||
@Test
|
||||
public void testForin() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -172,16 +171,16 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForSimpleLexical = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/simple-lexical.js" } },
|
||||
new Object[] { "tests/simple-lexical.js", new String[] { "tests/simple-lexical.js/outer" } },
|
||||
new Object[] { ROOT, new String[] { "simple-lexical.js" } },
|
||||
new Object[] { "simple-lexical.js", new String[] { "simple-lexical.js/outer" } },
|
||||
new Object[] {
|
||||
"tests/simple-lexical.js/outer",
|
||||
new String[] { "tests/simple-lexical.js/outer/indirect", "tests/simple-lexical.js/outer/inner",
|
||||
"tests/simple-lexical.js/outer/inner2", "tests/simple-lexical.js/outer/inner3" } },
|
||||
new Object[] { "tests/simple-lexical.js/outer/inner2",
|
||||
new String[] { "tests/simple-lexical.js/outer/inner", "tests/simple-lexical.js/outer/inner3" } },
|
||||
new Object[] { "tests/simple-lexical.js/outer/indirect",
|
||||
new String[] { "tests/simple-lexical.js/outer/inner", "tests/simple-lexical.js/outer/inner3" } } };
|
||||
"simple-lexical.js/outer",
|
||||
new String[] { "simple-lexical.js/outer/indirect", "simple-lexical.js/outer/inner",
|
||||
"simple-lexical.js/outer/inner2", "simple-lexical.js/outer/inner3" } },
|
||||
new Object[] { "simple-lexical.js/outer/inner2",
|
||||
new String[] { "simple-lexical.js/outer/inner", "simple-lexical.js/outer/inner3" } },
|
||||
new Object[] { "simple-lexical.js/outer/indirect",
|
||||
new String[] { "simple-lexical.js/outer/inner", "simple-lexical.js/outer/inner3" } } };
|
||||
|
||||
@Test
|
||||
public void testSimpleLexical() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -196,7 +195,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForLexicalMultiple = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/lexical_multiple_calls.js" } },
|
||||
new Object[] { ROOT, new String[] { "lexical_multiple_calls.js" } },
|
||||
new Object[] { "suffix:lexical_multiple_calls.js", new String[] { "suffix:reachable1" } },
|
||||
new Object[] { "suffix:lexical_multiple_calls.js", new String[] { "suffix:reachable2" } }};
|
||||
|
||||
|
@ -208,19 +207,19 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
|
||||
|
||||
private static final Object[][] assertionsForTry = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/try.js" } },
|
||||
new Object[] { "tests/try.js",
|
||||
new String[] { "tests/try.js/tryCatch", "tests/try.js/tryFinally", "tests/try.js/tryCatchFinally" } },
|
||||
new Object[] { "tests/try.js/tryCatch",
|
||||
new String[] { "tests/try.js/targetOne", "tests/try.js/targetTwo", "tests/try.js/two" } },
|
||||
new Object[] { "tests/try.js/tryFinally",
|
||||
new String[] { "tests/try.js/targetOne", "tests/try.js/targetTwo", "tests/try.js/two" } },
|
||||
new Object[] { "tests/try.js/tryCatchFinally",
|
||||
new String[] { "tests/try.js/targetOne", "tests/try.js/targetTwo", "tests/try.js/three", "tests/try.js/two" } },
|
||||
new Object[] { "tests/try.js/tryCatchTwice",
|
||||
new String[] { "tests/try.js/targetOne", "tests/try.js/targetTwo", "tests/try.js/three", "tests/try.js/two" } },
|
||||
new Object[] { "tests/try.js/testRet",
|
||||
new String[] { "tests/try.js/three", "tests/try.js/two" } }
|
||||
new Object[] { ROOT, new String[] { "try.js" } },
|
||||
new Object[] { "try.js",
|
||||
new String[] { "try.js/tryCatch", "try.js/tryFinally", "try.js/tryCatchFinally" } },
|
||||
new Object[] { "try.js/tryCatch",
|
||||
new String[] { "try.js/targetOne", "try.js/targetTwo", "try.js/two" } },
|
||||
new Object[] { "try.js/tryFinally",
|
||||
new String[] { "try.js/targetOne", "try.js/targetTwo", "try.js/two" } },
|
||||
new Object[] { "try.js/tryCatchFinally",
|
||||
new String[] { "try.js/targetOne", "try.js/targetTwo", "try.js/three", "try.js/two" } },
|
||||
new Object[] { "try.js/tryCatchTwice",
|
||||
new String[] { "try.js/targetOne", "try.js/targetTwo", "try.js/three", "try.js/two" } },
|
||||
new Object[] { "try.js/testRet",
|
||||
new String[] { "try.js/three", "try.js/two" } }
|
||||
};
|
||||
|
||||
@Test
|
||||
|
@ -237,8 +236,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForStringOp = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/string-op.js" } },
|
||||
new Object[] { "tests/string-op.js", new String[] { "tests/string-op.js/getOp", "tests/string-op.js/plusNum" } } };
|
||||
new Object[] { ROOT, new String[] { "string-op.js" } },
|
||||
new Object[] { "string-op.js", new String[] { "string-op.js/getOp", "string-op.js/plusNum" } } };
|
||||
|
||||
@Test
|
||||
public void testStringOp() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -249,11 +248,11 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForUpward = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/upward.js" } },
|
||||
new Object[] { ROOT, new String[] { "upward.js" } },
|
||||
new Object[] {
|
||||
"tests/upward.js",
|
||||
new String[] { "tests/upward.js/Obj/setit", "tests/upward.js/Obj/getit", "tests/upward.js/tester1",
|
||||
"tests/upward.js/tester2" } } };
|
||||
"upward.js",
|
||||
new String[] { "upward.js/Obj/setit", "upward.js/Obj/getit", "upward.js/tester1",
|
||||
"upward.js/tester2" } } };
|
||||
|
||||
@Test
|
||||
public void testUpward() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -262,8 +261,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForStringPrims = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/string-prims.js" } },
|
||||
new Object[] { "tests/string-prims.js", new String[] { "prologue.js/String_prototype_split", "prologue.js/String_prototype_toUpperCase" } } };
|
||||
new Object[] { ROOT, new String[] { "string-prims.js" } },
|
||||
new Object[] { "string-prims.js", new String[] { "prologue.js/String_prototype_split", "prologue.js/String_prototype_toUpperCase" } } };
|
||||
|
||||
@Test
|
||||
public void testStringPrims() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -275,8 +274,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
verifyGraphAssertions(CG, assertionsForStringPrims);
|
||||
}
|
||||
|
||||
private static final Object[][] assertionsForNested = new Object[][] { new Object[] { ROOT, new String[] { "tests/nested.js" } },
|
||||
new Object[] { "tests/nested.js", new String[] { "tests/nested.js/f", "tests/nested.js/f/ff", "tests/nested.js/f/ff/fff" } } };
|
||||
private static final Object[][] assertionsForNested = new Object[][] { new Object[] { ROOT, new String[] { "nested.js" } },
|
||||
new Object[] { "nested.js", new String[] { "nested.js/f", "nested.js/f/ff", "nested.js/f/ff/fff" } } };
|
||||
|
||||
@Test
|
||||
public void testNested() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -286,7 +285,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForInstanceof = new Object[][] { new Object[] { ROOT,
|
||||
new String[] { "tests/instanceof.js" } } };
|
||||
new String[] { "instanceof.js" } } };
|
||||
|
||||
@Test
|
||||
public void testInstanceof() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -297,7 +296,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
|
||||
/*
|
||||
* private static final Object[][] assertionsForWith = new Object[][] { new
|
||||
* Object[] { ROOT, new String[] { "tests/with.js" } } };
|
||||
* Object[] { ROOT, new String[] { "with.js" } } };
|
||||
*
|
||||
* @Test public void testWith() throws IOException, IllegalArgumentException,
|
||||
* CancelException { PropagationCallGraphBuilder B =
|
||||
|
@ -325,8 +324,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForMultivar = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/multivar.js" } },
|
||||
new Object[] { "tests/multivar.js", new String[] { "tests/multivar.js/a", "tests/multivar.js/bf", "tests/multivar.js/c" } } };
|
||||
new Object[] { ROOT, new String[] { "multivar.js" } },
|
||||
new Object[] { "multivar.js", new String[] { "multivar.js/a", "multivar.js/bf", "multivar.js/c" } } };
|
||||
|
||||
@Test
|
||||
public void testMultivar() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
|
@ -335,7 +334,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForPrototypeContamination = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/prototype_contamination_bug.js" } },
|
||||
new Object[] { ROOT, new String[] { "prototype_contamination_bug.js" } },
|
||||
new Object[] { "suffix:test1", new String[] { "suffix:foo_of_A" } },
|
||||
new Object[] { "suffix:test2", new String[] { "suffix:foo_of_B" } } };
|
||||
|
||||
|
@ -370,14 +369,14 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
List<CGNode> succs = Iterator2Collection.toList(cg.getSuccNodes(n));
|
||||
Assert
|
||||
.assertEquals(
|
||||
"[Node: <Code body of function Ltests/function_call.js/foo> Context: Everywhere, Node: <Code body of function Ltests/function_call.js/bar> Context: Everywhere]",
|
||||
"[Node: <Code body of function Lfunction_call.js/foo> Context: Everywhere, Node: <Code body of function Lfunction_call.js/bar> Context: Everywhere]",
|
||||
succs.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Object[][] assertionsForFunctionApply = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/function_apply.js" } },
|
||||
new Object[] { ROOT, new String[] { "function_apply.js" } },
|
||||
new Object[] { "suffix:function_apply.js", new String[] { "suffix:theOne" } },
|
||||
new Object[] { "suffix:function_apply.js", new String[] { "suffix:theTwo" } } };
|
||||
|
||||
|
@ -389,7 +388,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForFunctionApply2 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/function_apply2.js" } },
|
||||
new Object[] { ROOT, new String[] { "function_apply2.js" } },
|
||||
new Object[] { "suffix:function_apply2.js", new String[] { "suffix:theThree" } } };
|
||||
|
||||
@Test
|
||||
|
@ -399,7 +398,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForFunctionApply3 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/function_apply3.js" } },
|
||||
new Object[] { ROOT, new String[] { "function_apply3.js" } },
|
||||
new Object[] { "suffix:apply", new String[] { "suffix:foo" } } };
|
||||
|
||||
@Test
|
||||
|
@ -409,7 +408,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForWrap1 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/wrap1.js" } },
|
||||
new Object[] { ROOT, new String[] { "wrap1.js" } },
|
||||
new Object[] { "suffix:wrap1.js", new String[] { "suffix:i_am_reachable" } } };
|
||||
|
||||
@Test
|
||||
|
@ -419,7 +418,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForWrap2 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/wrap2.js" } },
|
||||
new Object[] { ROOT, new String[] { "wrap2.js" } },
|
||||
new Object[] { "suffix:wrap2.js", new String[] { "suffix:i_am_reachable" } } };
|
||||
|
||||
@Test
|
||||
|
@ -429,7 +428,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForWrap3 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/wrap3.js" } },
|
||||
new Object[] { ROOT, new String[] { "wrap3.js" } },
|
||||
new Object[] { "suffix:wrap3.js", new String[] { "suffix:i_am_reachable" } } };
|
||||
|
||||
@Test
|
||||
|
@ -439,7 +438,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForComplexCall = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/complex_call.js" } },
|
||||
new Object[] { ROOT, new String[] { "complex_call.js" } },
|
||||
new Object[] { "suffix:call.js", new String[] { "suffix:f3" } } };
|
||||
|
||||
@Test
|
||||
|
@ -452,7 +451,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
|
||||
|
||||
private static final Object[][] assertionsForGlobalObj = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/global_object.js" } },
|
||||
new Object[] { ROOT, new String[] { "global_object.js" } },
|
||||
new Object[] { "suffix:global_object.js", new String[] { "suffix:biz" } } };
|
||||
|
||||
@Test
|
||||
|
@ -462,7 +461,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForGlobalObj2 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/global_object2.js" } },
|
||||
new Object[] { ROOT, new String[] { "global_object2.js" } },
|
||||
new Object[] { "suffix:global_object2.js", new String[] { "suffix:foo" } } };
|
||||
|
||||
@Test
|
||||
|
@ -473,7 +472,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
|
||||
|
||||
private static final Object[][] assertionsForReturnThis = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/return_this.js" } },
|
||||
new Object[] { ROOT, new String[] { "return_this.js" } },
|
||||
new Object[] { "suffix:return_this.js", new String[] { "suffix:foo" } },
|
||||
new Object[] { "suffix:return_this.js", new String[] { "suffix:bar" } } };
|
||||
|
||||
|
@ -487,7 +486,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForReturnThis2 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/return_this2.js" } },
|
||||
new Object[] { ROOT, new String[] { "return_this2.js" } },
|
||||
new Object[] { "suffix:return_this2.js", new String[] { "suffix:A" } },
|
||||
new Object[] { "suffix:return_this2.js", new String[] { "suffix:foo" } },
|
||||
new Object[] { "suffix:return_this2.js", new String[] { "suffix:test1" } },
|
||||
|
@ -505,7 +504,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForArguments = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/arguments.js" } },
|
||||
new Object[] { ROOT, new String[] { "arguments.js" } },
|
||||
new Object[] { "suffix:arguments.js", new String[] { "suffix:f" } },
|
||||
new Object[] { "suffix:f", new String[] { "!suffix:g1", "!suffix:g2", "suffix:g3", } }
|
||||
};
|
||||
|
@ -517,7 +516,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForFunctionIsAFunction = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/Function_is_a_function.js" } },
|
||||
new Object[] { ROOT, new String[] { "Function_is_a_function.js" } },
|
||||
new Object[] { "suffix:Function_is_a_function.js", new String[] { "suffix:Function_prototype_call" } } };
|
||||
|
||||
@Test
|
||||
|
@ -527,7 +526,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForLexicalBroken = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/lexical_broken.js" } },
|
||||
new Object[] { ROOT, new String[] { "lexical_broken.js" } },
|
||||
new Object[] { "suffix:lexical_broken.js", new String[] { "suffix:f" } },
|
||||
new Object[] { "suffix:f", new String[] { "suffix:g" } }
|
||||
};
|
||||
|
@ -544,7 +543,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForScopingOverwriteFunction = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/scoping_test.js" } },
|
||||
new Object[] { ROOT, new String[] { "scoping_test.js" } },
|
||||
new Object[] { "suffix:scoping_test.js", new String[] { "suffix:i_am_reachable" } }
|
||||
};
|
||||
|
||||
|
@ -555,7 +554,7 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForNestedParamAssign = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/nested_assign_to_param.js" } },
|
||||
new Object[] { ROOT, new String[] { "nested_assign_to_param.js" } },
|
||||
new Object[] { "suffix:nested_assign_to_param.js", new String[] { "suffix:i_am_reachable" } }
|
||||
};
|
||||
|
||||
|
@ -566,10 +565,10 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForDispatch = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/dispatch.js" } },
|
||||
new Object[] { "tests/dispatch.js", new String[] { "tests/dispatch.js/left_outer", "tests/dispatch.js/right_outer" } },
|
||||
new Object[] { "tests/dispatch.js/left_outer", new String[]{ "tests/dispatch.js/left_inner" } },
|
||||
new Object[] { "tests/dispatch.js/right_outer", new String[]{ "tests/dispatch.js/right_inner" } }
|
||||
new Object[] { ROOT, new String[] { "dispatch.js" } },
|
||||
new Object[] { "dispatch.js", new String[] { "dispatch.js/left_outer", "dispatch.js/right_outer" } },
|
||||
new Object[] { "dispatch.js/left_outer", new String[]{ "dispatch.js/left_inner" } },
|
||||
new Object[] { "dispatch.js/right_outer", new String[]{ "dispatch.js/right_inner" } }
|
||||
};
|
||||
|
||||
@Test
|
||||
|
@ -582,8 +581,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForDispatchSameTarget = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/dispatch_same_target.js" } },
|
||||
new Object[] { "tests/dispatch_same_target.js/f3", new String[] { "tests/dispatch_same_target.js/f4" } }
|
||||
new Object[] { ROOT, new String[] { "dispatch_same_target.js" } },
|
||||
new Object[] { "dispatch_same_target.js/f3", new String[] { "dispatch_same_target.js/f4" } }
|
||||
};
|
||||
|
||||
|
||||
|
@ -598,8 +597,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
|
||||
|
||||
private static final Object[][] assertionsForForInPrototype = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/for_in_prototype.js" } },
|
||||
new Object[] { "tests/for_in_prototype.js", new String[] { "suffix:A",
|
||||
new Object[] { ROOT, new String[] { "for_in_prototype.js" } },
|
||||
new Object[] { "for_in_prototype.js", new String[] { "suffix:A",
|
||||
"suffix:reachable",
|
||||
"suffix:also_reachable" } }
|
||||
};
|
||||
|
@ -611,8 +610,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForArrayIndexConv = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/array_index_conv.js" } },
|
||||
new Object[] { "tests/array_index_conv.js", new String[] { "suffix:reachable1",
|
||||
new Object[] { ROOT, new String[] { "array_index_conv.js" } },
|
||||
new Object[] { "array_index_conv.js", new String[] { "suffix:reachable1",
|
||||
"suffix:reachable2",
|
||||
"suffix:reachable3",
|
||||
"suffix:reachable4" } }
|
||||
|
@ -626,8 +625,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForArrayIndexConv2 = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/array_index_conv2.js" } },
|
||||
new Object[] { "tests/array_index_conv2.js", new String[] { "suffix:invokeOnA" } },
|
||||
new Object[] { ROOT, new String[] { "array_index_conv2.js" } },
|
||||
new Object[] { "array_index_conv2.js", new String[] { "suffix:invokeOnA" } },
|
||||
new Object[] { "suffix:invokeOnA", new String[] { "suffix:reachable",
|
||||
"suffix:also_reachable",
|
||||
"suffix:reachable_too" } }
|
||||
|
@ -644,8 +643,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForDateProperty = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/date-property.js" } },
|
||||
new Object[] { "tests/date-property.js", new String[] { "suffix:_fun" } }
|
||||
new Object[] { ROOT, new String[] { "date-property.js" } },
|
||||
new Object[] { "date-property.js", new String[] { "suffix:_fun" } }
|
||||
};
|
||||
|
||||
@Test
|
||||
|
@ -657,8 +656,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
verifyGraphAssertions(CG, assertionsForDateProperty);
|
||||
}
|
||||
private static final Object[][] assertionsForDeadCode = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/dead.js" } },
|
||||
new Object[] { "tests/dead.js", new String[] { "suffix:twoReturns" } }
|
||||
new Object[] { ROOT, new String[] { "dead.js" } },
|
||||
new Object[] { "dead.js", new String[] { "suffix:twoReturns" } }
|
||||
};
|
||||
|
||||
@Test
|
||||
|
@ -671,10 +670,10 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForShadow = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/shadow_test.js" } },
|
||||
new Object[] { "tests/shadow_test.js", new String[] { "tests/shadow_test.js/test" } },
|
||||
new Object[] { "tests/shadow_test.js/test", new String[] { "tests/shadow_test.js/bad" } },
|
||||
new Object[] { "tests/shadow_test.js/test", new String[] { "tests/shadow_test.js/global_bad" } }
|
||||
new Object[] { ROOT, new String[] { "shadow_test.js" } },
|
||||
new Object[] { "shadow_test.js", new String[] { "shadow_test.js/test" } },
|
||||
new Object[] { "shadow_test.js/test", new String[] { "shadow_test.js/bad" } },
|
||||
new Object[] { "shadow_test.js/test", new String[] { "shadow_test.js/global_bad" } }
|
||||
};
|
||||
|
||||
@Test
|
||||
|
@ -685,8 +684,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForExtend = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/extend.js" } },
|
||||
new Object[] { "tests/extend.js", new String[] { "suffix:bar", "!suffix:foo" } }
|
||||
new Object[] { ROOT, new String[] { "extend.js" } },
|
||||
new Object[] { "extend.js", new String[] { "suffix:bar", "!suffix:foo" } }
|
||||
};
|
||||
|
||||
@Test
|
||||
|
@ -737,8 +736,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForLoops = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/loops.js" } },
|
||||
new Object[] { "tests/loops.js", new String[] { "tests/loops.js/three", "tests/loops.js/four"} }
|
||||
new Object[] { ROOT, new String[] { "loops.js" } },
|
||||
new Object[] { "loops.js", new String[] { "loops.js/three", "loops.js/four"} }
|
||||
};
|
||||
|
||||
@Ignore("need to fix this. bug from Sukyoung's group")
|
||||
|
@ -754,10 +753,10 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
private static final Object[][] assertionsForPrimitiveStrings = new Object[][] {
|
||||
new Object[] { ROOT, new String[] { "tests/primitive_strings.js" } },
|
||||
new Object[] { "tests/primitive_strings.js", new String[] { "tests/primitive_strings.js/f1", "tests/primitive_strings.js/f1"} },
|
||||
new Object[] { "tests/primitive_strings.js/f2", new String[] { "prologue.js/String_prototype_concat" } },
|
||||
new Object[] { "tests/primitive_strings.js/f1", new String[] { "prologue.js/String_prototype_concat" } },
|
||||
new Object[] { ROOT, new String[] { "primitive_strings.js" } },
|
||||
new Object[] { "primitive_strings.js", new String[] { "primitive_strings.js/f1", "primitive_strings.js/f1"} },
|
||||
new Object[] { "primitive_strings.js/f2", new String[] { "prologue.js/String_prototype_concat" } },
|
||||
new Object[] { "primitive_strings.js/f1", new String[] { "prologue.js/String_prototype_concat" } },
|
||||
};
|
||||
|
||||
@Ignore("need to fix this. bug from Sukyoung's group")
|
||||
|
@ -773,8 +772,8 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
}
|
||||
|
||||
Object[][] renamingAssertions = {
|
||||
{ "tests/rename-example.js/f", new Name[]{ new Name(9, 7, "x"), new Name(9, 7, "y") } },
|
||||
{ "tests/rename-example.js/ff", new Name[]{ new Name(11, 10, "x"), new Name(11, 10, "y"), new Name(11, 10, "z") } }
|
||||
{ "rename-example.js/f", new Name[]{ new Name(9, 7, "x"), new Name(9, 7, "y") } },
|
||||
{ "rename-example.js/ff", new Name[]{ new Name(11, 10, "x"), new Name(11, 10, "y"), new Name(11, 10, "z") } }
|
||||
};
|
||||
|
||||
@Test
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil;
|
||||
import com.ibm.wala.cast.js.html.IHtmlParser;
|
||||
import com.ibm.wala.cast.js.html.IHtmlParserFactory;
|
||||
import com.ibm.wala.cast.js.html.JSSourceExtractor;
|
||||
import com.ibm.wala.cast.js.html.WebUtil;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
|
@ -36,12 +37,7 @@ public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape
|
|||
@Override
|
||||
@Before
|
||||
public void setUp() {
|
||||
WebUtil.setFactory(new IHtmlParserFactory() {
|
||||
@Override
|
||||
public IHtmlParser getParser() {
|
||||
return getParser();
|
||||
}
|
||||
});
|
||||
JSSourceExtractor.USE_TEMP_NAME = false;
|
||||
}
|
||||
|
||||
private static final Object[][] assertionsForPage1 = new Object[][] {
|
||||
|
|
|
@ -39,11 +39,13 @@ import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
|||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.Context;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
|
||||
import com.ibm.wala.ipa.callgraph.impl.AbstractRootMethod;
|
||||
import com.ibm.wala.ipa.callgraph.impl.ContextInsensitiveSelector;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.cfa.DefaultSSAInterpreter;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.cfa.DelegatingSSAContextInterpreter;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.cfa.nCFAContextSelector;
|
||||
|
@ -70,17 +72,17 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
|
||||
// standard call graph machinery
|
||||
protected final AnalysisOptions options;
|
||||
protected final AnalysisCache cache;
|
||||
protected final IAnalysisCacheView cache;
|
||||
protected final JavaScriptConstructorFunctions constructors;
|
||||
protected final MethodTargetSelector targetSelector;
|
||||
public final MethodTargetSelector targetSelector;
|
||||
protected final boolean supportFullPointerAnalysis;
|
||||
|
||||
private static final boolean LOG_TIMINGS = true;
|
||||
|
||||
public FieldBasedCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache, boolean supportFullPointerAnalysis) {
|
||||
public FieldBasedCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView iAnalysisCacheView, boolean supportFullPointerAnalysis) {
|
||||
this.cha = cha;
|
||||
this.options = options;
|
||||
this.cache = cache;
|
||||
this.cache = iAnalysisCacheView;
|
||||
this.constructors = new JavaScriptConstructorFunctions(cha);
|
||||
this.targetSelector = setupMethodTargetSelector(cha, constructors, options);
|
||||
this.supportFullPointerAnalysis = supportFullPointerAnalysis;
|
||||
|
@ -89,7 +91,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
private MethodTargetSelector setupMethodTargetSelector(IClassHierarchy cha, JavaScriptConstructorFunctions constructors2, AnalysisOptions options) {
|
||||
MethodTargetSelector result = new JavaScriptConstructTargetSelector(constructors2, options.getMethodTargetSelector());
|
||||
if (options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply()) {
|
||||
result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result));
|
||||
result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result, cache));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -138,13 +140,18 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
* Extract a call graph from a given flow graph.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
protected JSCallGraph extract(FlowGraph flowgraph, Iterable<? extends Entrypoint> eps, IProgressMonitor monitor) throws CancelException {
|
||||
public JSCallGraph extract(FlowGraph flowgraph, Iterable<? extends Entrypoint> eps, IProgressMonitor monitor) throws CancelException {
|
||||
DelegatingSSAContextInterpreter interpreter = new DelegatingSSAContextInterpreter(new AstContextInsensitiveSSAContextInterpreter(options, cache), new DefaultSSAInterpreter(options, cache));
|
||||
return extract(interpreter, flowgraph, eps, monitor);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public JSCallGraph extract(SSAContextInterpreter interpreter, FlowGraph flowgraph, Iterable<? extends Entrypoint> eps, IProgressMonitor monitor) throws CancelException {
|
||||
// set up call graph
|
||||
final JSCallGraph cg = new JSCallGraph(cha, options, cache);
|
||||
cg.init();
|
||||
|
||||
// setup context interpreters
|
||||
DelegatingSSAContextInterpreter interpreter = new DelegatingSSAContextInterpreter(new AstContextInsensitiveSSAContextInterpreter(options, cache), new DefaultSSAInterpreter(options, cache));
|
||||
if (options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply()) {
|
||||
interpreter = new DelegatingSSAContextInterpreter(new JavaScriptFunctionApplyContextInterpreter(options, cache), interpreter);
|
||||
}
|
||||
|
@ -206,7 +213,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
return cg;
|
||||
}
|
||||
|
||||
private boolean handleFunctionCallOrApplyInvocation(FlowGraph flowgraph, IProgressMonitor monitor, final JSCallGraph cg,
|
||||
public boolean handleFunctionCallOrApplyInvocation(FlowGraph flowgraph, IProgressMonitor monitor, final JSCallGraph cg,
|
||||
CallVertex callVertex, CGNode caller, CallSiteReference site,
|
||||
IMethod target) throws CancelException {
|
||||
// use to get 1-level of call string for Function.prototype.call, to
|
||||
|
@ -220,6 +227,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
OrdinalSet<FuncVertex> reflectiveTargets = getReflectiveTargets(flowgraph, callVertex, monitor);
|
||||
System.err.println("adding callees " + reflectiveTargets + " for " + caller);
|
||||
// there should only be one call site in the synthetic method
|
||||
// CallSiteReference reflectiveCallSite = cache.getIRFactory().makeIR(functionPrototypeCallNode.getMethod(), Everywhere.EVERYWHERE, options.getSSAOptions()).iterateCallSites().next();
|
||||
CallSiteReference reflectiveCallSite = functionPrototypeCallNode.getIR().iterateCallSites().next();
|
||||
for (FuncVertex f : reflectiveTargets) {
|
||||
IMethod reflectiveTgtMethod = targetSelector.getCalleeTarget(functionPrototypeCallNode, reflectiveCallSite, f.getConcreteType());
|
||||
|
@ -228,7 +236,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
return ret;
|
||||
}
|
||||
|
||||
private boolean addEdgeToJSCallGraph(final JSCallGraph cg, CallSiteReference site, IMethod target, CGNode caller)
|
||||
public boolean addEdgeToJSCallGraph(final JSCallGraph cg, CallSiteReference site, IMethod target, CGNode caller)
|
||||
throws CancelException {
|
||||
return addCGEdgeWithContext(cg, site, target, caller, Everywhere.EVERYWHERE);
|
||||
}
|
||||
|
@ -276,7 +284,7 @@ public abstract class FieldBasedCallGraphBuilder {
|
|||
/**
|
||||
* Extract call edges from the flow graph into high-level representation.
|
||||
*/
|
||||
protected Set<Pair<CallVertex, FuncVertex>> extractCallGraphEdges(FlowGraph flowgraph, IProgressMonitor monitor) throws CancelException {
|
||||
public Set<Pair<CallVertex, FuncVertex>> extractCallGraphEdges(FlowGraph flowgraph, IProgressMonitor monitor) throws CancelException {
|
||||
VertexFactory factory = flowgraph.getVertexFactory();
|
||||
final Set<Pair<CallVertex, FuncVertex>> result = HashSetFactory.make();
|
||||
|
||||
|
|
|
@ -18,13 +18,11 @@ import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.FuncVertex;
|
|||
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.VarVertex;
|
||||
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.VertexFactory;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions;
|
||||
import com.ibm.wala.cast.js.ipa.summaries.JavaScriptConstructorFunctions;
|
||||
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
|
||||
import com.ibm.wala.cast.js.types.JavaScriptMethods;
|
||||
import com.ibm.wala.cast.types.AstMethodReference;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.util.CancelException;
|
||||
import com.ibm.wala.util.MonitorUtil;
|
||||
|
@ -46,8 +44,8 @@ public class OptimisticCallgraphBuilder extends FieldBasedCallGraphBuilder {
|
|||
|
||||
private final boolean handleCallApply;
|
||||
|
||||
public OptimisticCallgraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache, boolean supportFullPointerAnalysis) {
|
||||
super(cha, options, cache, supportFullPointerAnalysis);
|
||||
public OptimisticCallgraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView iAnalysisCacheView, boolean supportFullPointerAnalysis) {
|
||||
super(cha, options, iAnalysisCacheView, supportFullPointerAnalysis);
|
||||
handleCallApply = options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Iterator;
|
|||
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.FlowGraph;
|
||||
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.FuncVertex;
|
||||
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.VertexFactory;
|
||||
import com.ibm.wala.cast.js.ipa.summaries.JavaScriptConstructorFunctions;
|
||||
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
|
||||
import com.ibm.wala.cast.js.types.JavaScriptTypes;
|
||||
import com.ibm.wala.cast.loader.AstMethod;
|
||||
|
@ -24,7 +23,7 @@ import com.ibm.wala.classLoader.IClass;
|
|||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.ssa.DefUse;
|
||||
import com.ibm.wala.ssa.IR;
|
||||
|
@ -42,8 +41,8 @@ import com.ibm.wala.util.MonitorUtil.IProgressMonitor;
|
|||
*
|
||||
*/
|
||||
public class PessimisticCallGraphBuilder extends FieldBasedCallGraphBuilder {
|
||||
public PessimisticCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache, boolean supportFullPointerAnalysis) {
|
||||
super(cha, options, cache, supportFullPointerAnalysis);
|
||||
public PessimisticCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView iAnalysisCacheView, boolean supportFullPointerAnalysis) {
|
||||
super(cha, options, iAnalysisCacheView, supportFullPointerAnalysis);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,15 +21,12 @@ import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.VarVertex;
|
|||
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.Vertex;
|
||||
import com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph.vertices.VertexFactory;
|
||||
import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions;
|
||||
import com.ibm.wala.cast.js.ipa.summaries.JavaScriptConstructorFunctions;
|
||||
import com.ibm.wala.cast.js.ssa.JavaScriptInvoke;
|
||||
import com.ibm.wala.cast.js.types.JavaScriptMethods;
|
||||
import com.ibm.wala.cast.types.AstMethodReference;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.ssa.IR;
|
||||
import com.ibm.wala.util.CancelException;
|
||||
import com.ibm.wala.util.MonitorUtil;
|
||||
import com.ibm.wala.util.MonitorUtil.IProgressMonitor;
|
||||
|
@ -69,7 +66,7 @@ public class WorklistBasedOptimisticCallgraphBuilder extends FieldBasedCallGraph
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Set<Pair<CallVertex,FuncVertex>> extractCallGraphEdges(FlowGraph flowgraph, IProgressMonitor monitor) throws CancelException {
|
||||
public Set<Pair<CallVertex,FuncVertex>> extractCallGraphEdges(FlowGraph flowgraph, IProgressMonitor monitor) throws CancelException {
|
||||
VertexFactory factory = flowgraph.getVertexFactory();
|
||||
Set<Vertex> worklist = HashSetFactory.make();
|
||||
Map<Vertex, Set<FuncVertex>> reachingFunctions = HashMapFactory.make();
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
package com.ibm.wala.cast.js.callgraph.fieldbased.flowgraph;
|
||||
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.util.functions.Function;
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class FilteredFlowGraphBuilder extends FlowGraphBuilder {
|
|||
|
||||
private final Function<IMethod, Boolean> filter;
|
||||
|
||||
public FilteredFlowGraphBuilder(IClassHierarchy cha, AnalysisCache cache, boolean fullPointerAnalysis, Function<IMethod, Boolean> filter) {
|
||||
public FilteredFlowGraphBuilder(IClassHierarchy cha, IAnalysisCacheView cache, boolean fullPointerAnalysis, Function<IMethod, Boolean> filter) {
|
||||
super(cha, cache, fullPointerAnalysis);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
|
|
@ -39,9 +39,9 @@ import com.ibm.wala.classLoader.IField;
|
|||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.classLoader.NewSiteReference;
|
||||
import com.ibm.wala.classLoader.ProgramCounter;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.FilteredPointerKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.FilteredPointerKey.TypeFilter;
|
||||
|
@ -180,7 +180,7 @@ public class FlowGraph implements Iterable<Vertex> {
|
|||
return graph.iterator();
|
||||
}
|
||||
|
||||
public PointerAnalysis<ObjectVertex> getPointerAnalysis(final CallGraph cg, final AnalysisCache cache, final IProgressMonitor monitor) throws CancelException {
|
||||
public PointerAnalysis<ObjectVertex> getPointerAnalysis(final CallGraph cg, final IAnalysisCacheView cache, final IProgressMonitor monitor) throws CancelException {
|
||||
return new PointerAnalysis<ObjectVertex>() {
|
||||
|
||||
private final Map<Pair<PrototypeField,ObjectVertex>,PrototypeFieldVertex> proto = HashMapFactory.make();
|
||||
|
@ -189,7 +189,7 @@ public class FlowGraph implements Iterable<Vertex> {
|
|||
|
||||
private final ExtensionGraph<Vertex> dataflow = new ExtensionGraph<Vertex>(graph);
|
||||
|
||||
protected IR getIR(final AnalysisCache cache, FuncVertex func) {
|
||||
protected IR getIR(final IAnalysisCacheView cache, FuncVertex func) {
|
||||
return cache.getIR(func.getConcreteType().getMethod(AstMethodReference.fnSelector));
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ import com.ibm.wala.cast.loader.AstMethod.LexicalInformation;
|
|||
import com.ibm.wala.cast.types.AstMethodReference;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.ssa.IR;
|
||||
import com.ibm.wala.ssa.SSAGetCaughtExceptionInstruction;
|
||||
|
@ -60,10 +60,10 @@ import com.ibm.wala.util.intset.IntSet;
|
|||
*/
|
||||
public class FlowGraphBuilder {
|
||||
private final IClassHierarchy cha;
|
||||
private final AnalysisCache cache;
|
||||
private final IAnalysisCacheView cache;
|
||||
private final boolean supportFullPointerAnalysis;
|
||||
|
||||
public FlowGraphBuilder(IClassHierarchy cha, AnalysisCache cache, boolean supportPointerAnalysis) {
|
||||
public FlowGraphBuilder(IClassHierarchy cha, IAnalysisCacheView cache, boolean supportPointerAnalysis) {
|
||||
this.cha = cha;
|
||||
this.cache = cache;
|
||||
this.supportFullPointerAnalysis = supportPointerAnalysis;
|
||||
|
@ -104,9 +104,6 @@ public class FlowGraphBuilder {
|
|||
|
||||
public void visitFunction(FlowGraph flowgraph, IMethod method) {
|
||||
{
|
||||
if (method.toString().contains("ctor") && method.toString().contains("dollar_init")) {
|
||||
System.err.println("found it");
|
||||
}
|
||||
IR ir = cache.getIR(method);
|
||||
FlowGraphSSAVisitor visitor = new FlowGraphSSAVisitor(ir, flowgraph);
|
||||
|
||||
|
|
|
@ -34,17 +34,19 @@ import com.ibm.wala.classLoader.Module;
|
|||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.client.AbstractAnalysisEngine;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilderCancelException;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.SeqClassHierarchyFactory;
|
||||
import com.ibm.wala.util.CancelException;
|
||||
import com.ibm.wala.util.MonitorUtil.IProgressMonitor;
|
||||
import com.ibm.wala.util.collections.HashSetFactory;
|
||||
|
@ -72,7 +74,7 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
|
|||
@Override
|
||||
public IClassHierarchy buildClassHierarchy() {
|
||||
try {
|
||||
return ClassHierarchyFactory.make(getScope(), loaderFactory, JavaScriptLoader.JS);
|
||||
return setClassHierarchy(SeqClassHierarchyFactory.make(getScope(), loaderFactory, JavaScriptLoader.JS));
|
||||
} catch (ClassHierarchyException e) {
|
||||
Assertions.UNREACHABLE(e.toString());
|
||||
return null;
|
||||
|
@ -99,8 +101,8 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
|
|||
}
|
||||
|
||||
@Override
|
||||
public AnalysisCache makeDefaultCache() {
|
||||
return new AnalysisCache(AstIRFactory.makeDefaultFactory());
|
||||
public IAnalysisCacheView makeDefaultCache() {
|
||||
return new AnalysisCacheImpl(AstIRFactory.makeDefaultFactory());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,7 +142,7 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
|
|||
|
||||
|
||||
@Override
|
||||
protected CallGraphBuilder<ObjectVertex> getCallGraphBuilder(final IClassHierarchy cha, AnalysisOptions options, final AnalysisCache cache) {
|
||||
protected CallGraphBuilder<ObjectVertex> getCallGraphBuilder(final IClassHierarchy cha, AnalysisOptions options, final IAnalysisCacheView cache) {
|
||||
Set<Entrypoint> roots = HashSetFactory.make();
|
||||
for(Entrypoint e : options.getEntrypoints()) {
|
||||
roots.add(e);
|
||||
|
@ -176,7 +178,7 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
|
|||
}
|
||||
|
||||
@Override
|
||||
public AnalysisCache getAnalysisCache() {
|
||||
public IAnalysisCacheView getAnalysisCache() {
|
||||
return cache;
|
||||
}
|
||||
|
||||
|
@ -192,7 +194,7 @@ public abstract class JavaScriptAnalysisEngine<I extends InstanceKey> extends Ab
|
|||
public static class PropagationJavaScriptAnalysisEngine extends JavaScriptAnalysisEngine<InstanceKey> {
|
||||
|
||||
@Override
|
||||
protected CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
protected CallGraphBuilder getCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
return new ZeroCFABuilderFactory().make((JSAnalysisOptions) options, cache, cha, scope, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.ibm.wala.cast.js.ipa.callgraph.JSZeroOrOneXCFABuilder;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraphBuilder;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
|
||||
|
@ -26,7 +27,7 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
|
|||
*/
|
||||
public class ZeroCFABuilderFactory {
|
||||
|
||||
public CallGraphBuilder make(JSAnalysisOptions options, AnalysisCache cache, IClassHierarchy cha, AnalysisScope scope,
|
||||
public CallGraphBuilder make(JSAnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope,
|
||||
boolean keepPointsTo) {
|
||||
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
|
||||
options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector()));
|
||||
|
|
|
@ -17,18 +17,18 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.htmlparser.jericho.Config;
|
||||
import net.htmlparser.jericho.Element;
|
||||
import net.htmlparser.jericho.Logger;
|
||||
import net.htmlparser.jericho.LoggerProvider;
|
||||
import net.htmlparser.jericho.Source;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||
import com.ibm.wala.cast.js.html.IHtmlCallback;
|
||||
import com.ibm.wala.cast.js.html.IHtmlParser;
|
||||
import com.ibm.wala.util.collections.HashSetFactory;
|
||||
import com.ibm.wala.util.warnings.Warning;
|
||||
|
||||
import net.htmlparser.jericho.Config;
|
||||
import net.htmlparser.jericho.Element;
|
||||
import net.htmlparser.jericho.Logger;
|
||||
import net.htmlparser.jericho.LoggerProvider;
|
||||
import net.htmlparser.jericho.Source;
|
||||
|
||||
|
||||
/**
|
||||
* @author danielk
|
||||
|
|
|
@ -17,16 +17,16 @@ import java.net.MalformedURLException;
|
|||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
import net.htmlparser.jericho.Attribute;
|
||||
import net.htmlparser.jericho.Element;
|
||||
import net.htmlparser.jericho.Segment;
|
||||
|
||||
import com.ibm.wala.cast.js.html.ITag;
|
||||
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
||||
import com.ibm.wala.cast.tree.impl.AbstractSourcePosition;
|
||||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
import com.ibm.wala.util.collections.Pair;
|
||||
|
||||
import net.htmlparser.jericho.Attribute;
|
||||
import net.htmlparser.jericho.Element;
|
||||
import net.htmlparser.jericho.Segment;
|
||||
|
||||
/**
|
||||
* ITag impel for Jericho generated tags
|
||||
* @author danielk
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ArgumentSpecialization {
|
|||
@Override
|
||||
public IR getIR(CGNode node) {
|
||||
if (node.getMethod() instanceof Retranslatable) {
|
||||
return getAnalysisCache().getSSACache().findOrCreateIR(node.getMethod(), node.getContext(), options.getSSAOptions());
|
||||
return getAnalysisCache().getIR(node.getMethod(), node.getContext());
|
||||
} else {
|
||||
return super.getIR(node);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class ArgumentSpecialization {
|
|||
@Override
|
||||
public DefUse getDU(CGNode node) {
|
||||
if (node.getMethod() instanceof Retranslatable) {
|
||||
return getAnalysisCache().getSSACache().findOrCreateDU(node.getMethod(), node.getContext(), options.getSSAOptions());
|
||||
return getAnalysisCache().getDefUse(getIR(node));
|
||||
} else {
|
||||
return super.getDU(node);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.ibm.wala.classLoader.IClass;
|
|||
import com.ibm.wala.classLoader.IField;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ConcreteTypeKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ConstantKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
|
@ -33,7 +34,7 @@ import com.ibm.wala.util.strings.Atom;
|
|||
*/
|
||||
public abstract class JSCFABuilder extends JSSSAPropagationCallGraphBuilder {
|
||||
|
||||
public JSCFABuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public JSCFABuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(cha, options, cache, new AstCFAPointerKeys() {
|
||||
|
||||
private boolean isBogusKey(InstanceKey K) {
|
||||
|
|
|
@ -22,9 +22,9 @@ import com.ibm.wala.cfg.InducedCFG;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.classLoader.NewSiteReference;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.callgraph.impl.FakeRootMethod;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
|
@ -37,7 +37,7 @@ import com.ibm.wala.util.collections.HashSetFactory;
|
|||
|
||||
public class JSCallGraph extends AstCallGraph {
|
||||
|
||||
public JSCallGraph(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public JSCallGraph(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(cha, options, cache);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class JSCallGraph extends AstCallGraph {
|
|||
|
||||
public static class JSFakeRoot extends ScriptFakeRoot {
|
||||
|
||||
public JSFakeRoot(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public JSFakeRoot(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(fakeRoot, cha.lookupClass(JavaScriptTypes.FakeRoot), cha, options, cache);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,14 @@
|
|||
package com.ibm.wala.cast.js.ipa.callgraph;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Reader;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -41,12 +44,16 @@ import com.ibm.wala.cfg.AbstractCFG;
|
|||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.ClassLoaderFactory;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.Module;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.classLoader.SourceURLModule;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.ClassHierarchyClassTargetSelector;
|
||||
import com.ibm.wala.ipa.callgraph.impl.ClassHierarchyMethodTargetSelector;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
|
@ -54,6 +61,7 @@ import com.ibm.wala.ssa.SymbolTable;
|
|||
import com.ibm.wala.types.MethodReference;
|
||||
import com.ibm.wala.types.TypeName;
|
||||
import com.ibm.wala.types.TypeReference;
|
||||
import com.ibm.wala.util.collections.NonNullSingletonIterator;
|
||||
|
||||
public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil {
|
||||
|
||||
|
@ -84,7 +92,9 @@ public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGra
|
|||
* (keepIRs),
|
||||
*/roots);
|
||||
|
||||
com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha);
|
||||
options.setSelector(new ClassHierarchyMethodTargetSelector(cha));
|
||||
options.setSelector(new ClassHierarchyClassTargetSelector(cha));
|
||||
|
||||
options.setSelector(new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector()));
|
||||
|
||||
options.setUseConstantSpecificKeys(true);
|
||||
|
@ -175,7 +185,7 @@ public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGra
|
|||
return loadAdditionalFile(cha, cl, new SourceURLModule(url));
|
||||
}
|
||||
|
||||
public static Set<String> loadAdditionalFile(IClassHierarchy cha, JavaScriptLoader cl, SourceModule M)
|
||||
public static Set<String> loadAdditionalFile(IClassHierarchy cha, JavaScriptLoader cl, ModuleEntry M)
|
||||
throws IOException {
|
||||
try {
|
||||
TranslatorToCAst toCAst = getTranslatorFactory().make(new CAstImpl(), M);
|
||||
|
@ -244,13 +254,76 @@ public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGra
|
|||
}
|
||||
}
|
||||
|
||||
public static SourceModule getPrologueFile(final String name) {
|
||||
return new SourceURLModule(JSCallGraphUtil.class.getClassLoader().getResource(name)) {
|
||||
public static class Bootstrap implements SourceModule, Module, ModuleEntry {
|
||||
private String name;
|
||||
private InputStream stream;
|
||||
private final URL url;
|
||||
|
||||
public Bootstrap(String name, InputStream stream, URL url) {
|
||||
this.name = name;
|
||||
this.stream = stream;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<? extends ModuleEntry> getEntries() {
|
||||
return new NonNullSingletonIterator<Bootstrap>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClassFile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSourceFile() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModuleFile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module asModule() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reader getInputReader() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getURL() {
|
||||
return url;
|
||||
}
|
||||
};
|
||||
|
||||
public static Module getPrologueFile(final String name) {
|
||||
return new Bootstrap(name, JSCallGraphUtil.class.getClassLoader().getResourceAsStream(name), JSCallGraphUtil.class.getClassLoader().getResource(name));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.ExplicitCallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.AbstractFieldPointerKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ConcreteTypeKey;
|
||||
|
@ -79,7 +80,6 @@ import com.ibm.wala.types.TypeReference;
|
|||
import com.ibm.wala.util.CancelException;
|
||||
import com.ibm.wala.util.CancelRuntimeException;
|
||||
import com.ibm.wala.util.MonitorUtil;
|
||||
import com.ibm.wala.util.MonitorUtil.IProgressMonitor;
|
||||
import com.ibm.wala.util.collections.HashSetFactory;
|
||||
import com.ibm.wala.util.intset.IntSet;
|
||||
import com.ibm.wala.util.intset.IntSetAction;
|
||||
|
@ -150,7 +150,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
this.scriptBaseURL = url;
|
||||
}
|
||||
|
||||
protected JSSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
||||
protected JSSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache,
|
||||
PointerKeyFactory pointerKeyFactory) {
|
||||
super(cha, options, cache, pointerKeyFactory);
|
||||
globalObject = new GlobalObjectKey(cha.lookupClass(JavaScriptTypes.Root));
|
||||
|
@ -555,12 +555,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
private Position getInstructionPosition(SSAInstruction instruction) {
|
||||
IMethod method = node.getMethod();
|
||||
if (method instanceof AstMethod) {
|
||||
SSAInstruction[] instructions = ir.getInstructions();
|
||||
for (int ind = basicBlock.getFirstInstructionIndex(); ind <= basicBlock.getLastInstructionIndex(); ind++) {
|
||||
if (instruction.equals(instructions[ind])) {
|
||||
return ((AstMethod) method).getSourcePosition(ind);
|
||||
}
|
||||
}
|
||||
return ((AstMethod) method).getSourcePosition(instruction.iindex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1027,6 +1022,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
|
||||
public static void processCallingConstraintsInternal(AstSSAPropagationCallGraphBuilder builder, CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target,
|
||||
InstanceKey[][] constParams, PointerKey uniqueCatchKey) {
|
||||
|
||||
IR sourceIR = builder.getCFAContextInterpreter().getIR(caller);
|
||||
SymbolTable sourceST = sourceIR.getSymbolTable();
|
||||
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
*****************************************************************************/
|
||||
package com.ibm.wala.cast.js.ipa.callgraph;
|
||||
|
||||
import com.ibm.wala.cast.ipa.callgraph.OneLevelForLexicalAccessFunctions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.ContextSelector;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
|
||||
import com.ibm.wala.ipa.callgraph.impl.ContextInsensitiveSelector;
|
||||
import com.ibm.wala.ipa.callgraph.impl.DelegatingContextSelector;
|
||||
|
@ -32,13 +32,13 @@ public class JSZeroOrOneXCFABuilder extends JSCFABuilder {
|
|||
private static final boolean USE_OBJECT_SENSITIVITY = false;
|
||||
|
||||
|
||||
public JSZeroOrOneXCFABuilder(IClassHierarchy cha, JSAnalysisOptions options, AnalysisCache cache,
|
||||
public JSZeroOrOneXCFABuilder(IClassHierarchy cha, JSAnalysisOptions options, IAnalysisCacheView cache,
|
||||
ContextSelector appContextSelector, SSAContextInterpreter appContextInterpreter, int instancePolicy, boolean doOneCFA) {
|
||||
super(cha, options, cache);
|
||||
|
||||
SSAContextInterpreter contextInterpreter = setupSSAContextInterpreter(cha, options, cache, appContextInterpreter);
|
||||
|
||||
setupMethodTargetSelector(cha, options);
|
||||
setupMethodTargetSelector(cha, options, cache);
|
||||
|
||||
setupContextSelector(options, appContextSelector, doOneCFA);
|
||||
|
||||
|
@ -71,11 +71,11 @@ public class JSZeroOrOneXCFABuilder extends JSCFABuilder {
|
|||
}
|
||||
|
||||
|
||||
private void setupMethodTargetSelector(IClassHierarchy cha, JSAnalysisOptions options) {
|
||||
private void setupMethodTargetSelector(IClassHierarchy cha, JSAnalysisOptions options, IAnalysisCacheView cache) {
|
||||
MethodTargetSelector targetSelector = new JavaScriptConstructTargetSelector(cha, options
|
||||
.getMethodTargetSelector());
|
||||
if (options.handleCallApply()) {
|
||||
targetSelector = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(targetSelector));
|
||||
targetSelector = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(targetSelector, cache));
|
||||
}
|
||||
if (options.useLoadFileTargetSelector()) {
|
||||
targetSelector = new LoadFileTargetSelector(targetSelector, this);
|
||||
|
@ -83,7 +83,7 @@ public class JSZeroOrOneXCFABuilder extends JSCFABuilder {
|
|||
options.setSelector(targetSelector);
|
||||
}
|
||||
|
||||
private SSAContextInterpreter setupSSAContextInterpreter(IClassHierarchy cha, JSAnalysisOptions options, AnalysisCache cache,
|
||||
private SSAContextInterpreter setupSSAContextInterpreter(IClassHierarchy cha, JSAnalysisOptions options, IAnalysisCacheView cache,
|
||||
SSAContextInterpreter appContextInterpreter) {
|
||||
SSAContextInterpreter contextInterpreter = makeDefaultContextInterpreters(appContextInterpreter, options, cha);
|
||||
if (options.handleCallApply()) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.ContextItem;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ssa.ConstantValue;
|
||||
import com.ibm.wala.ssa.DefUse;
|
||||
import com.ibm.wala.ssa.IR;
|
||||
|
@ -38,7 +39,7 @@ public class JavaScriptFunctionApplyContextInterpreter extends AstContextInsensi
|
|||
|
||||
private static final TypeName APPLY_TYPE_NAME = TypeName.findOrCreate("Lprologue.js/Function_prototype_apply");
|
||||
|
||||
public JavaScriptFunctionApplyContextInterpreter(AnalysisOptions options, AnalysisCache cache) {
|
||||
public JavaScriptFunctionApplyContextInterpreter(AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(options, cache);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.ibm.wala.classLoader.CallSiteReference;
|
|||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
|
||||
import com.ibm.wala.ssa.IR;
|
||||
import com.ibm.wala.ssa.SSAAbstractInvokeInstruction;
|
||||
|
@ -61,9 +62,11 @@ public class JavaScriptFunctionDotCallTargetSelector implements MethodTargetSele
|
|||
private static final TypeName CALL_TYPE_NAME = TypeName.findOrCreate("Lprologue.js/Function_prototype_call");
|
||||
private final MethodTargetSelector base;
|
||||
|
||||
public JavaScriptFunctionDotCallTargetSelector(MethodTargetSelector base) {
|
||||
this.base = base;
|
||||
private IAnalysisCacheView cache;
|
||||
|
||||
public JavaScriptFunctionDotCallTargetSelector(MethodTargetSelector base, IAnalysisCacheView cache2) {
|
||||
this.base = base;
|
||||
this.cache = cache2;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -19,16 +19,16 @@ import com.ibm.wala.cast.js.ipa.callgraph.correlations.CorrelationFinder;
|
|||
import com.ibm.wala.cast.js.ipa.callgraph.correlations.extraction.ClosureExtractor;
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.Context;
|
||||
import com.ibm.wala.ipa.callgraph.ContextItem;
|
||||
import com.ibm.wala.ipa.callgraph.ContextKey;
|
||||
import com.ibm.wala.ipa.callgraph.ContextSelector;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ConstantKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.SelectiveCPAContext;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.FilteredPointerKey.SingleInstanceFilter;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.SelectiveCPAContext;
|
||||
import com.ibm.wala.ssa.DefUse;
|
||||
import com.ibm.wala.ssa.ReflectiveMemberAccess;
|
||||
import com.ibm.wala.ssa.SSAAbstractInvokeInstruction;
|
||||
|
@ -107,7 +107,7 @@ public class PropertyNameContextSelector implements ContextSelector {
|
|||
}
|
||||
}
|
||||
|
||||
private final AnalysisCache cache;
|
||||
private final IAnalysisCacheView cache;
|
||||
private final ContextSelector base;
|
||||
private final int index;
|
||||
|
||||
|
@ -143,11 +143,11 @@ public class PropertyNameContextSelector implements ContextSelector {
|
|||
return dependentParameters;
|
||||
}
|
||||
|
||||
public PropertyNameContextSelector(AnalysisCache cache, ContextSelector base) {
|
||||
public PropertyNameContextSelector(IAnalysisCacheView cache, ContextSelector base) {
|
||||
this(cache, 2, base);
|
||||
}
|
||||
|
||||
public PropertyNameContextSelector(AnalysisCache cache, int index, ContextSelector base) {
|
||||
public PropertyNameContextSelector(IAnalysisCacheView cache, int index, ContextSelector base) {
|
||||
this.cache = cache;
|
||||
this.index = index;
|
||||
this.base = base;
|
||||
|
|
|
@ -24,8 +24,8 @@ import com.ibm.wala.cast.tree.CAstEntity;
|
|||
import com.ibm.wala.cast.tree.CAstNode;
|
||||
import com.ibm.wala.cast.tree.CAstSourcePositionMap;
|
||||
import com.ibm.wala.cast.tree.impl.CAstControlFlowRecorder;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriter;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstBasicRewriter.NoKey;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriter;
|
||||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
import com.ibm.wala.util.collections.HashSetFactory;
|
||||
import com.ibm.wala.util.collections.Pair;
|
||||
|
|
|
@ -13,8 +13,8 @@ package com.ibm.wala.cast.js.ipa.callgraph.correlations.extraction;
|
|||
|
||||
import com.ibm.wala.cast.tree.CAstNode;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstBasicRewriter;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriter;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstBasicRewriter.NoKey;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriter;
|
||||
|
||||
/**
|
||||
* Representation of a node's position in a CAst entity's syntax tree. The position is stored as a zipper
|
||||
|
|
|
@ -11,9 +11,13 @@
|
|||
|
||||
package com.ibm.wala.cast.js.ipa.summaries;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -27,10 +31,12 @@ import com.ibm.wala.cast.types.AstMethodReference;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.classLoader.Module;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
import com.ibm.wala.classLoader.NewSiteReference;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.ipa.summaries.MethodSummary;
|
||||
import com.ibm.wala.shrikeBT.IConditionalBranchInstruction.IOperator;
|
||||
import com.ibm.wala.shrikeBT.IConditionalBranchInstruction.Operator;
|
||||
import com.ibm.wala.ssa.ConstantValue;
|
||||
import com.ibm.wala.ssa.IR;
|
||||
|
@ -40,6 +46,7 @@ import com.ibm.wala.types.MethodReference;
|
|||
import com.ibm.wala.types.TypeName;
|
||||
import com.ibm.wala.types.TypeReference;
|
||||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
import com.ibm.wala.util.collections.NonNullSingletonIterator;
|
||||
import com.ibm.wala.util.collections.Pair;
|
||||
|
||||
public class JavaScriptConstructorFunctions {
|
||||
|
@ -434,7 +441,7 @@ public class JavaScriptConstructorFunctions {
|
|||
if (!ST.isStringConstant(callStmt.getUse(i)))
|
||||
return makeFunctionConstructor(cls, cls);
|
||||
|
||||
StringBuffer fun = new StringBuffer("function _fromctor (");
|
||||
final StringBuffer fun = new StringBuffer("function _fromctor (");
|
||||
for (int j = 1; j < callStmt.getNumberOfUses() - 1; j++) {
|
||||
if (j != 1)
|
||||
fun.append(",");
|
||||
|
@ -446,13 +453,83 @@ public class JavaScriptConstructorFunctions {
|
|||
fun.append("}");
|
||||
|
||||
try {
|
||||
String fileName = "ctor$" + ++ctorCount;
|
||||
File f = new File(System.getProperty("java.io.tmpdir") + File.separator + fileName);
|
||||
FileWriter FO = new FileWriter(f);
|
||||
FO.write(fun.toString());
|
||||
FO.close();
|
||||
final String fileName = "ctor$" + ++ctorCount;
|
||||
ModuleEntry ME = new SourceModule() {
|
||||
|
||||
Set<String> fnNames = JSCallGraphUtil.loadAdditionalFile(cha, cl, f.toURI().toURL());
|
||||
@Override
|
||||
public String getName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isClassFile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSourceFile() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
return new InputStream() {
|
||||
private int i = 0;
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
if (i >= fun.length()) {
|
||||
return -1;
|
||||
} else {
|
||||
return fun.codePointAt(i++);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModuleFile() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module asModule() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Module getContainer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<? extends ModuleEntry> getEntries() {
|
||||
return new NonNullSingletonIterator<ModuleEntry>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Reader getInputReader() {
|
||||
return new StringReader(fun.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getURL() {
|
||||
try {
|
||||
return new URL("file://" + fileName);
|
||||
} catch (MalformedURLException e) {
|
||||
assert false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Set<String> fnNames = JSCallGraphUtil.loadAdditionalFile(cha, cl, ME);
|
||||
IClass fcls = null;
|
||||
for(String nm : fnNames) {
|
||||
if (nm.endsWith("_fromctor")) {
|
||||
|
@ -460,9 +537,7 @@ public class JavaScriptConstructorFunctions {
|
|||
}
|
||||
}
|
||||
|
||||
assert fcls != null : "cannot find class for " + fileName + " in " + f;
|
||||
|
||||
f.delete();
|
||||
assert fcls != null : "cannot find class for " + fileName;
|
||||
|
||||
if (fcls != null)
|
||||
return makeFunctionConstructor(cls, fcls);
|
||||
|
|
|
@ -1015,7 +1015,7 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected TranslatorToCAst getTranslatorToCAst(final CAst ast, ModuleEntry module) {
|
||||
TranslatorToCAst translator = translatorFactory.make(ast, (SourceModule)module);
|
||||
TranslatorToCAst translator = translatorFactory.make(ast, module);
|
||||
if(preprocessor != null)
|
||||
translator.addRewriter(preprocessor, true);
|
||||
return translator;
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.ibm.wala.cast.tree.rewrite.AstLoopUnwinder.UnwindKey;
|
|||
import com.ibm.wala.cast.tree.rewrite.CAstRewriter;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriter.RewriteContext;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
import com.ibm.wala.classLoader.SourceFileModule;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
|
||||
|
@ -36,7 +37,7 @@ public abstract class JavaScriptLoopUnwindingTranslatorFactory
|
|||
protected abstract TranslatorToCAst translateInternal(CAst Ast, SourceModule M, String N);
|
||||
|
||||
@Override
|
||||
public TranslatorToCAst make(CAst ast, final SourceModule M) {
|
||||
public TranslatorToCAst make(CAst ast, final ModuleEntry M) {
|
||||
String N;
|
||||
if (M instanceof SourceFileModule) {
|
||||
N = ((SourceFileModule) M).getClassName();
|
||||
|
@ -44,7 +45,7 @@ public abstract class JavaScriptLoopUnwindingTranslatorFactory
|
|||
N = M.getName();
|
||||
}
|
||||
|
||||
TranslatorToCAst xlator = translateInternal(ast, M, N);
|
||||
TranslatorToCAst xlator = translateInternal(ast, (SourceModule)M, N);
|
||||
xlator.addRewriter(new CAstRewriterFactory<CAstRewriter.RewriteContext<AstLoopUnwinder.UnwindKey>,AstLoopUnwinder.UnwindKey>() {
|
||||
@Override
|
||||
public CAstRewriter<RewriteContext<UnwindKey>, UnwindKey> createCAstRewriter(CAst ast) {
|
||||
|
|
|
@ -12,7 +12,7 @@ package com.ibm.wala.cast.js.translator;
|
|||
|
||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||
import com.ibm.wala.cast.tree.CAst;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
|
||||
/**
|
||||
* Factory interface for creating translators that generate the CAst for some
|
||||
|
@ -21,6 +21,6 @@ import com.ibm.wala.classLoader.SourceModule;
|
|||
*/
|
||||
public interface JavaScriptTranslatorFactory {
|
||||
|
||||
TranslatorToCAst make(CAst ast, SourceModule M);
|
||||
TranslatorToCAst make(CAst ast, ModuleEntry M);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import com.ibm.wala.cast.tree.CAstControlFlowMap;
|
|||
import com.ibm.wala.cast.tree.CAstNode;
|
||||
import com.ibm.wala.cast.tree.impl.CAstOperator;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriter;
|
||||
import com.ibm.wala.cast.tree.rewrite.CAstRewriter.CopyKey;
|
||||
import com.ibm.wala.util.collections.Pair;
|
||||
import com.ibm.wala.util.debug.Assertions;
|
||||
|
||||
|
@ -29,7 +28,7 @@ import com.ibm.wala.util.debug.Assertions;
|
|||
*/
|
||||
public class PropertyReadExpander extends CAstRewriter<PropertyReadExpander.RewriteContext, PropertyReadExpander.ExpanderKey> {
|
||||
|
||||
static enum ExpanderKey implements CopyKey<ExpanderKey> {
|
||||
static enum ExpanderKey implements com.ibm.wala.cast.tree.rewrite.CAstRewriter.CopyKey<ExpanderKey> {
|
||||
EVERYWHERE, EXTRA {
|
||||
@Override
|
||||
public ExpanderKey parent() { return EVERYWHERE; }
|
||||
|
|
|
@ -16,8 +16,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ibm.wala.cast.tree.CAstNode;
|
||||
|
@ -27,6 +25,8 @@ import com.ibm.wala.cast.util.CAstPattern.Segments;
|
|||
import com.ibm.wala.cast.util.CAstPrinter;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
public class TestCAstPattern extends WalaTestCase {
|
||||
|
||||
private static final int NAME_ASSERTION_SINGLE = 501;
|
||||
|
|
|
@ -18,8 +18,6 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import com.ibm.wala.cast.ipa.callgraph.CAstCallGraphUtil;
|
||||
import com.ibm.wala.cast.ir.ssa.AstIRFactory;
|
||||
import com.ibm.wala.cast.loader.SingleClassLoaderFactory;
|
||||
|
@ -38,6 +36,8 @@ import com.ibm.wala.ssa.SSAOptions;
|
|||
import com.ibm.wala.util.collections.HashMapFactory;
|
||||
import com.ibm.wala.util.collections.Pair;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
public abstract class TestCAstTranslator extends WalaTestCase {
|
||||
|
||||
protected static class TranslatorAssertions {
|
||||
|
|
|
@ -13,8 +13,6 @@ package com.ibm.wala.cast.test;
|
|||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import com.ibm.wala.cast.loader.AstMethod;
|
||||
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
|
@ -26,6 +24,8 @@ import com.ibm.wala.ssa.SSACFG;
|
|||
import com.ibm.wala.ssa.SSAInstruction;
|
||||
import com.ibm.wala.util.collections.NonNullSingletonIterator;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
public abstract class TestCallGraphShape extends WalaTestCase {
|
||||
|
||||
protected void verifyCFGAssertions(CallGraph CG, Object[][] assertionData) {
|
||||
|
|
|
@ -20,10 +20,10 @@ import com.ibm.wala.cfg.InducedCFG;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.Context;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.AbstractRootMethod;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.callgraph.impl.ExplicitCallGraph;
|
||||
|
@ -40,17 +40,17 @@ import com.ibm.wala.util.collections.HashSetFactory;
|
|||
import com.ibm.wala.util.functions.Function;
|
||||
|
||||
public class AstCallGraph extends ExplicitCallGraph {
|
||||
public AstCallGraph(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public AstCallGraph(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(cha, options, cache);
|
||||
}
|
||||
|
||||
public static class AstFakeRoot extends AbstractRootMethod {
|
||||
|
||||
public AstFakeRoot(MethodReference rootMethod, IClass declaringClass, IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public AstFakeRoot(MethodReference rootMethod, IClass declaringClass, IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(rootMethod, declaringClass, cha, options, cache);
|
||||
}
|
||||
|
||||
public AstFakeRoot(MethodReference rootMethod, IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public AstFakeRoot(MethodReference rootMethod, IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(rootMethod, cha, options, cache);
|
||||
}
|
||||
|
||||
|
@ -68,11 +68,11 @@ public class AstCallGraph extends ExplicitCallGraph {
|
|||
|
||||
public static abstract class ScriptFakeRoot extends AstFakeRoot {
|
||||
|
||||
public ScriptFakeRoot(MethodReference rootMethod, IClass declaringClass, IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public ScriptFakeRoot(MethodReference rootMethod, IClass declaringClass, IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(rootMethod, declaringClass, cha, options, cache);
|
||||
}
|
||||
|
||||
public ScriptFakeRoot(MethodReference rootMethod, IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public ScriptFakeRoot(MethodReference rootMethod, IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(rootMethod, cha, options, cache);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.Context;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.cfa.ContextInsensitiveSSAInterpreter;
|
||||
import com.ibm.wala.ssa.IR;
|
||||
import com.ibm.wala.util.collections.EmptyIterator;
|
||||
|
@ -33,7 +34,7 @@ import com.ibm.wala.util.collections.EmptyIterator;
|
|||
*/
|
||||
public class AstContextInsensitiveSSAContextInterpreter extends ContextInsensitiveSSAInterpreter {
|
||||
|
||||
public AstContextInsensitiveSSAContextInterpreter(AnalysisOptions options, AnalysisCache cache) {
|
||||
public AstContextInsensitiveSSAContextInterpreter(AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(options, cache);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.ExplicitCallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.AbstractFieldPointerKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.HeapModel;
|
||||
|
@ -115,7 +116,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
|
||||
public abstract GlobalObjectKey getGlobalObject(Atom language);
|
||||
|
||||
protected AstSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
||||
protected AstSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache,
|
||||
PointerKeyFactory pointerKeyFactory) {
|
||||
super(cha, options, cache, pointerKeyFactory);
|
||||
}
|
||||
|
@ -379,7 +380,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
int lvn = ((LocalPointerKey) lexicalKey).getValueNumber();
|
||||
IR lir = getBuilder().getCFAContextInterpreter().getIR(lnode);
|
||||
SymbolTable lsymtab = lir.getSymbolTable();
|
||||
DefUse ldu = getAnalysisCache().getSSACache().findOrCreateDU(lir, lnode.getContext());
|
||||
DefUse ldu = getAnalysisCache().getDefUse(lir);
|
||||
if (contentsAreInvariant(lsymtab, ldu, lvn)) {
|
||||
InstanceKey[] ik = getInvariantContents(lsymtab, ldu, lnode, lvn);
|
||||
system.recordImplicitPointsToSet(lexicalKey);
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.Collections;
|
|||
import com.ibm.wala.cast.loader.SingleClassLoaderFactory;
|
||||
import com.ibm.wala.classLoader.ArrayClassLoader;
|
||||
import com.ibm.wala.classLoader.Language;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.classLoader.Module;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.types.ClassLoaderReference;
|
||||
import com.ibm.wala.util.debug.Assertions;
|
||||
|
@ -40,7 +40,7 @@ public class CAstAnalysisScope extends AnalysisScope {
|
|||
}
|
||||
}
|
||||
|
||||
public CAstAnalysisScope(SourceModule[] sources, SingleClassLoaderFactory loaders, Collection<Language> languages)
|
||||
public CAstAnalysisScope(Module[] sources, SingleClassLoaderFactory loaders, Collection<Language> languages)
|
||||
throws IOException {
|
||||
this(loaders, languages);
|
||||
for (int i = 0; i < sources.length; i++) {
|
||||
|
|
|
@ -24,9 +24,10 @@ import org.apache.commons.io.input.BOMInputStream;
|
|||
import com.ibm.wala.cast.loader.SingleClassLoaderFactory;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.classLoader.Language;
|
||||
import com.ibm.wala.classLoader.Module;
|
||||
import com.ibm.wala.classLoader.SourceFileModule;
|
||||
import com.ibm.wala.classLoader.SourceModule;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
|
@ -83,14 +84,14 @@ public class CAstCallGraphUtil {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static AnalysisScope makeScope(SourceModule[] files, SingleClassLoaderFactory loaders, Language language)
|
||||
public static AnalysisScope makeScope(Module[] files, SingleClassLoaderFactory loaders, Language language)
|
||||
throws IOException {
|
||||
CAstAnalysisScope result = new CAstAnalysisScope(files, loaders, Collections.singleton(language));
|
||||
return result;
|
||||
}
|
||||
|
||||
public static AnalysisCache makeCache(IRFactory<IMethod> factory) {
|
||||
return new AnalysisCache(factory);
|
||||
return new AnalysisCacheImpl(factory);
|
||||
}
|
||||
|
||||
public static String getShortName(CGNode nd) {
|
||||
|
|
|
@ -19,9 +19,9 @@ import com.ibm.wala.cast.util.TargetLanguageSelector;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.AbstractRootMethod;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.callgraph.impl.FakeRootMethod;
|
||||
|
@ -50,7 +50,7 @@ import com.ibm.wala.util.strings.Atom;
|
|||
public class CrossLanguageCallGraph extends AstCallGraph {
|
||||
|
||||
public CrossLanguageCallGraph(TargetLanguageSelector<AbstractRootMethod, CrossLanguageCallGraph> roots, IClassHierarchy cha,
|
||||
AnalysisOptions options, AnalysisCache cache) {
|
||||
AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(cha, options, cache);
|
||||
this.roots = roots;
|
||||
}
|
||||
|
@ -93,11 +93,11 @@ public class CrossLanguageCallGraph extends AstCallGraph {
|
|||
|
||||
public class CrossLanguageFakeRoot extends ScriptFakeRoot {
|
||||
|
||||
public CrossLanguageFakeRoot(IClass declaringClass, IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public CrossLanguageFakeRoot(IClass declaringClass, IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(FakeRootMethod.rootMethod, declaringClass, cha, options, cache);
|
||||
}
|
||||
|
||||
public CrossLanguageFakeRoot(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache) {
|
||||
public CrossLanguageFakeRoot(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
|
||||
super(FakeRootMethod.rootMethod, cha, options, cache);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Map;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.classLoader.Language;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.MethodTargetSelector;
|
||||
import com.ibm.wala.types.MethodReference;
|
||||
|
|
|
@ -23,9 +23,9 @@ import com.ibm.wala.ipa.callgraph.propagation.InstanceKeyFactory;
|
|||
import com.ibm.wala.ipa.callgraph.propagation.PointerKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder;
|
||||
import com.ibm.wala.types.TypeReference;
|
||||
import com.ibm.wala.util.Predicate;
|
||||
import com.ibm.wala.util.collections.CompoundIterator;
|
||||
import com.ibm.wala.util.collections.EmptyIterator;
|
||||
import com.ibm.wala.util.Predicate;
|
||||
import com.ibm.wala.util.collections.FilterIterator;
|
||||
import com.ibm.wala.util.collections.NonNullSingletonIterator;
|
||||
import com.ibm.wala.util.collections.Pair;
|
||||
|
|
|
@ -27,6 +27,7 @@ public class StandardFunctionTargetSelector implements MethodTargetSelector {
|
|||
private final MethodTargetSelector base;
|
||||
|
||||
public StandardFunctionTargetSelector(IClassHierarchy cha, MethodTargetSelector base) {
|
||||
assert cha != null;
|
||||
this.cha = cha;
|
||||
this.base = base;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package com.ibm.wala.cast.ir.ssa;
|
||||
|
||||
import com.ibm.wala.shrikeBT.IBinaryOpInstruction;
|
||||
import com.ibm.wala.shrikeBT.IUnaryOpInstruction;
|
||||
|
||||
public enum CAstBinaryOp implements IBinaryOpInstruction.IOperator {
|
||||
CONCAT, EQ, NE, LT, GE, GT, LE, STRICT_EQ, STRICT_NE;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
*****************************************************************************/
|
||||
package com.ibm.wala.cast.ir.ssa;
|
||||
|
||||
import com.ibm.wala.shrikeBT.IBinaryOpInstruction;
|
||||
import com.ibm.wala.shrikeBT.IUnaryOpInstruction;
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package com.ibm.wala.cast.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
@ -21,6 +20,29 @@ import com.ibm.wala.cast.tree.CAstNode;
|
|||
import com.ibm.wala.cast.tree.CAstSourcePositionMap;
|
||||
|
||||
public class CAstPrinter {
|
||||
private static final class StringWriter extends Writer {
|
||||
private final StringBuffer sb;
|
||||
|
||||
private StringWriter(StringBuffer sb) {
|
||||
this.sb = sb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(char[] cbuf, int off, int len) throws IOException {
|
||||
sb.append(new String(cbuf, off, len));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
private static CAstPrinter instance= new CAstPrinter();
|
||||
|
||||
public static void setPrinter(CAstPrinter printer) {
|
||||
|
@ -124,30 +146,16 @@ public class CAstPrinter {
|
|||
|
||||
public String doPrint(CAstNode top, CAstSourcePositionMap pos) {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
Writer writer = new Writer() {
|
||||
@Override
|
||||
public void write(char[] cbuf, int off, int len) throws IOException {
|
||||
sb.append(new String(cbuf, off, len));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
// do nothing
|
||||
}
|
||||
};
|
||||
Writer writer = new StringWriter(sb);
|
||||
printTo(top, pos, writer);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String doPrint(CAstEntity ce) {
|
||||
StringWriter writer = new StringWriter();
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
StringWriter writer = new StringWriter(sb);
|
||||
printTo(ce, writer);
|
||||
return writer.toString();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String print(CAstEntity ce) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/ConstructAllIRs.java"/>
|
||||
|
@ -6,6 +6,7 @@
|
|||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5" javaProject="com.ibm.wala.core.tests" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.ibm.wala.core.tests"/> </runtimeClasspathEntry> "/>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package com.ibm.wala.core.tests.arraybounds;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
|
@ -9,8 +12,6 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
import org.junit.rules.ErrorCollector;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import com.ibm.wala.analysis.arraybounds.ArrayOutOfBoundsAnalysis;
|
||||
import com.ibm.wala.analysis.arraybounds.ArrayOutOfBoundsAnalysis.UnnecessaryCheck;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.ibm.wala.core.tests.arraybounds;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.CoreMatchers.anyOf;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.everyItem;
|
||||
import static org.hamcrest.CoreMatchers.hasItem;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashSet;
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.junit.Test;
|
|||
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -38,7 +38,7 @@ public class AcyclicCallGraphTest extends WalaTestCase {
|
|||
"Lrecurse/NList");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
IBinaryNaturalRelation backEdges = Acyclic.computeBackEdges(cg, cg.getFakeRootNode());
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.junit.Test;
|
|||
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -57,7 +57,7 @@ public class CPATest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, testClass);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
builder.setContextSelector(new CPAContextSelector(builder.getContextSelector()));
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.ibm.wala.core.tests.demandpa.AbstractPtrTest;
|
|||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -76,7 +77,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
TestConstants.JAVA_CUP_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
doCallGraphs(options, new AnalysisCache(), cha, scope, useShortProfile());
|
||||
doCallGraphs(options, new AnalysisCacheImpl(), cha, scope, useShortProfile());
|
||||
}
|
||||
|
||||
@Test public void testBcelVerifier() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
|
@ -86,7 +87,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
TestConstants.BCEL_VERIFIER_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
doCallGraphs(options, new AnalysisCache(), cha, scope);
|
||||
doCallGraphs(options, new AnalysisCacheImpl(), cha, scope);
|
||||
}
|
||||
|
||||
@Test public void testJLex() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
|
@ -96,7 +97,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
.makeMainEntrypoints(scope, cha, TestConstants.JLEX_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
doCallGraphs(options, new AnalysisCache(), cha, scope);
|
||||
doCallGraphs(options, new AnalysisCacheImpl(), cha, scope);
|
||||
}
|
||||
|
||||
@Test public void testCornerCases() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
|
@ -106,7 +107,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = new AllApplicationEntrypoints(scope, cha);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
doCallGraphs(options, new AnalysisCache(), cha, scope);
|
||||
doCallGraphs(options, new AnalysisCacheImpl(), cha, scope);
|
||||
|
||||
// we expect a warning or two about class Abstract1, which has no concrete
|
||||
// subclasses
|
||||
|
@ -126,7 +127,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
TestConstants.HELLO_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
doCallGraphs(options, new AnalysisCache(), cha, scope);
|
||||
doCallGraphs(options, new AnalysisCacheImpl(), cha, scope);
|
||||
}
|
||||
|
||||
@Test public void testStaticInit() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
|
@ -136,7 +137,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
"LstaticInit/TestStaticInit");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
boolean foundDoNothing = false;
|
||||
for (CGNode n : cg) {
|
||||
if (n.toString().contains("doNothing")) {
|
||||
|
@ -146,7 +147,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
}
|
||||
Assert.assertTrue(foundDoNothing);
|
||||
options.setHandleStaticInit(false);
|
||||
cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
for (CGNode n : cg) {
|
||||
Assert.assertTrue(!n.toString().contains("doNothing"));
|
||||
}
|
||||
|
@ -159,7 +160,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
"Llambda/SortingExample");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
boolean foundSortForward = false;
|
||||
for (CGNode n : cg) {
|
||||
if (n.toString().contains("sortForward")) {
|
||||
|
@ -176,7 +177,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
"LstaticInit/TestSystemProperties");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options);
|
||||
for (CGNode n : cg) {
|
||||
if (n.toString().equals("Node: < Application, LstaticInit/TestSystemProperties, main([Ljava/lang/String;)V > Context: Everywhere")) {
|
||||
|
@ -201,7 +202,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
TestConstants.RECURSE_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
doCallGraphs(options, new AnalysisCache(), cha, scope);
|
||||
doCallGraphs(options, new AnalysisCacheImpl(), cha, scope);
|
||||
}
|
||||
|
||||
@Test public void testHelloAllEntrypoints() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
|
@ -211,7 +212,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = new AllApplicationEntrypoints(scope, cha);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
doCallGraphs(options, new AnalysisCache(), cha, scope);
|
||||
doCallGraphs(options, new AnalysisCacheImpl(), cha, scope);
|
||||
}
|
||||
|
||||
@Test public void testIO() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
|
||||
|
@ -220,7 +221,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = makePrimordialPublicEntrypoints(scope, cha, "java/io");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
}
|
||||
|
||||
public static Iterable<Entrypoint> makePrimordialPublicEntrypoints(AnalysisScope scope, ClassHierarchy cha, String pkg) {
|
||||
|
@ -259,7 +260,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = makePrimordialMainEntrypoints(scope, cha);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -269,7 +270,7 @@ public class CallGraphTest extends WalaTestCase {
|
|||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = Util.makeMainEntrypoints(scope, cha, "Ldemandpa/TestArraysCopyOf");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
AnalysisCache cache = new AnalysisCache();
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.junit.Test;
|
|||
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -51,7 +51,7 @@ public class ClassConstantTest extends WalaTestCase {
|
|||
// make call graph
|
||||
Iterable<Entrypoint> entrypoints = Util.makeMainEntrypoints(scope, cha, TestConstants.CLASSCONSTANT_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
// System.out.println("\nCall graph:");
|
||||
// Trace.println(cg);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -47,7 +47,7 @@ public class CloneTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = new AllApplicationEntrypoints(scope, cha);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraph cg = CallGraphTestUtil.buildRTA(options, new AnalysisCache(),cha, scope);
|
||||
CallGraph cg = CallGraphTestUtil.buildRTA(options, new AnalysisCacheImpl(),cha, scope);
|
||||
|
||||
// Find node corresponding to java.text.MessageFormat.clone()
|
||||
TypeReference t = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/text/MessageFormat");
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.junit.Test;
|
|||
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -44,7 +44,7 @@ public class DefaultMethodsTest extends WalaTestCase {
|
|||
"LdefaultMethods/DefaultMethods");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
// Find node corresponding to main
|
||||
TypeReference tm = TypeReference.findOrCreate(ClassLoaderReference.Application, "LdefaultMethods/DefaultMethods");
|
||||
|
|
|
@ -11,22 +11,18 @@
|
|||
package com.ibm.wala.core.tests.callGraph;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
||||
import com.ibm.wala.ipa.callgraph.impl.AllApplicationEntrypoints;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
|
@ -48,7 +44,7 @@ public class FinalizerTest extends WalaTestCase {
|
|||
"Lfinalizers/Finalizers");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
// Find node corresponding to finalize
|
||||
TypeReference t = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lfinalizers/Finalizers");
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.analysis.reflection.java7.MethodHandles;
|
||||
import com.ibm.wala.core.tests.shrike.DynamicCallGraphTestBase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
|
@ -55,7 +56,7 @@ public class Java7CallGraphTest extends DynamicCallGraphTestBase {
|
|||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "Lpack/ocamljavaMain");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
AnalysisCache cache = new AnalysisCache();
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -49,7 +49,7 @@ public class LambdaTest extends WalaTestCase {
|
|||
"Llambda/SortingExample");
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
// Find compareTo
|
||||
TypeReference str = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/String");
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -29,6 +29,7 @@ import com.ibm.wala.ipa.callgraph.Entrypoint;
|
|||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
import com.ibm.wala.ssa.DefaultIRFactory;
|
||||
import com.ibm.wala.ssa.SSAOptions;
|
||||
import com.ibm.wala.ssa.SSAPiNodePolicy;
|
||||
import com.ibm.wala.types.ClassLoaderReference;
|
||||
|
@ -82,7 +83,7 @@ public class PiNodeCallGraphTest extends WalaTestCase {
|
|||
SSAPiNodePolicy policy = usePiNodes ? SSAOptions.getAllBuiltInPiNodes() : null;
|
||||
options.getSSAOptions().setPiNodePolicy(policy);
|
||||
|
||||
return CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
return CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(new DefaultIRFactory(), options.getSSAOptions()), cha, scope, false);
|
||||
}
|
||||
|
||||
private void checkCallAssertions(CallGraph cg, int desiredNumberOfTargets, int desiredNumberOfCalls, int numLocalCastCallees) {
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.ibm.wala.classLoader.IClass;
|
|||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -93,7 +93,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
Warnings.clear();
|
||||
CallGraphTest.doCallGraphs(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphTest.doCallGraphs(options, new AnalysisCacheImpl(), cha, scope);
|
||||
for (Iterator<Warning> it = Warnings.iterator(); it.hasNext();) {
|
||||
Warning w = it.next();
|
||||
if (w.toString().indexOf("com/ibm/jvm") > 0) {
|
||||
|
@ -117,7 +117,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT2_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "<clinit>", "()V");
|
||||
|
@ -136,7 +136,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT3_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Ljava/lang/Class");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "newInstance", "()Ljava/lang/Object;");
|
||||
|
@ -168,7 +168,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT4_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Ljava/lang/Class");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "newInstance", "()Ljava/lang/Object;");
|
||||
|
@ -198,7 +198,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT5_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Ljava/lang/Class");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "newInstance", "()Ljava/lang/Object;");
|
||||
|
@ -228,7 +228,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT6_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Ljava/lang/Class");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "newInstance", "()Ljava/lang/Object;");
|
||||
|
@ -255,7 +255,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT7_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
final String mainClass = "Lreflection/Reflect7";
|
||||
TypeReference mainTr = TypeReference.findOrCreate(ClassLoaderReference.Application, mainClass);
|
||||
|
@ -338,7 +338,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT8_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -356,7 +356,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT9_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -374,7 +374,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT10_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -392,7 +392,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT11_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Object");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "wait", "()V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -410,7 +410,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT12_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "m", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -431,7 +431,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT13_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "m", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -452,7 +452,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT14_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "s", "(Ljava/lang/Object;Ljava/lang/Object;)V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -474,7 +474,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT15_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "<init>", "(Ljava/lang/Object;Ljava/lang/Object;)V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -501,7 +501,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT16_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -519,7 +519,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT17_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "t", "(Ljava/lang/Integer;)V");
|
||||
CGNode node = cg.getNode(cg.getClassHierarchy().resolveMethod(mr), Everywhere.EVERYWHERE);
|
||||
|
@ -537,7 +537,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT18_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "t", "(Ljava/lang/Integer;)V");
|
||||
CGNode node = cg.getNode(cg.getClassHierarchy().resolveMethod(mr), Everywhere.EVERYWHERE);
|
||||
|
@ -558,7 +558,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT19_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -576,7 +576,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT20_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "o", "(Ljava/lang/Object;Ljava/lang/Object;)V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -595,7 +595,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT21_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "<init>", "(Ljava/lang/Object;Ljava/lang/Object;)V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -614,7 +614,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT22_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "<init>", "(Ljava/lang/Integer;)V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -633,7 +633,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECT23_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lreflection/Helper");
|
||||
MethodReference mr = MethodReference.findOrCreate(tr, "u", "(Ljava/lang/Integer;)V");
|
||||
Set<CGNode> nodes = cg.getNodes(mr);
|
||||
|
@ -679,7 +679,7 @@ public class ReflectionTest extends WalaTestCase {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
|
||||
TestConstants.REFLECTGETMETHODCONTEXT_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
Set<CGNode> cgn;
|
||||
cgn = cg.getNodes(mabar); Assert.assertTrue(cgn.isEmpty());
|
||||
cgn = cg.getNodes(mabaz); Assert.assertTrue(cgn.isEmpty());
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -51,7 +51,7 @@ public class SyntheticTest extends WalaTestCase {
|
|||
SubtypesEntrypoint e = new SubtypesEntrypoint(m, cha);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, Collections.<Entrypoint>singleton(e));
|
||||
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
|
||||
TypeReference tA = TypeReference.findOrCreate(ClassLoaderReference.Application, "LmultiTypes/Foo$A");
|
||||
MethodReference barA = MethodReference.findOrCreate(tA, "bar", "()V");
|
||||
|
|
|
@ -18,8 +18,9 @@ import com.ibm.wala.classLoader.IClass;
|
|||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
|
@ -46,7 +47,7 @@ public class CodeDeletedTest extends WalaTestCase {
|
|||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
TypeReference ref = TypeReference.findOrCreate(ClassLoaderReference.Application, "LCodeDeleted");
|
||||
IClass klass = cha.lookupClass(ref);
|
||||
AnalysisCache cache = new AnalysisCache();
|
||||
IAnalysisCacheView cache = new AnalysisCacheImpl();
|
||||
for (IMethod m : klass.getDeclaredMethods()) {
|
||||
if (m.toString().contains("foo")) {
|
||||
// should throw WalaRuntimeException
|
||||
|
|
|
@ -12,8 +12,6 @@ package com.ibm.wala.core.tests.cha;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
|
@ -24,6 +22,8 @@ import com.ibm.wala.util.config.AnalysisScopeReader;
|
|||
import com.ibm.wala.util.io.FileProvider;
|
||||
import com.ibm.wala.util.strings.StringStuff;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
public class ExclusionsTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -57,6 +57,7 @@ import com.ibm.wala.demandpa.flowgraph.IFlowLabel;
|
|||
import com.ibm.wala.demandpa.util.MemoryAccessMap;
|
||||
import com.ibm.wala.demandpa.util.PABasedMemoryAccessMap;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -234,7 +235,7 @@ public abstract class AbstractPtrTest {
|
|||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
final AnalysisCache analysisCache = new AnalysisCache();
|
||||
final AnalysisCache analysisCache = new AnalysisCacheImpl();
|
||||
CallGraphBuilder cgBuilder = Util.makeZeroCFABuilder(options, analysisCache, cha, scope);
|
||||
final CallGraph cg = cgBuilder.makeCallGraph(options, null);
|
||||
// System.err.println(cg.toString());
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ibm.wala.core.tests.exceptionpruning;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -16,6 +17,7 @@ import com.ibm.wala.analysis.exceptionanalysis.ExceptionAnalysis2EdgeFilter;
|
|||
import com.ibm.wala.cfg.ControlFlowGraph;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -79,7 +81,7 @@ public class ExceptionAnalysis2EdgeFilterTest {
|
|||
options.getSSAOptions().setPiNodePolicy(new AllIntegerDueToBranchePiPolicy());
|
||||
|
||||
ReferenceCleanser.registerClassHierarchy(cha);
|
||||
AnalysisCache cache = new AnalysisCache();
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
ReferenceCleanser.registerCache(cache);
|
||||
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cache, cha, scope);
|
||||
cg = builder.makeCallGraph(options, null);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.ibm.wala.core.tests.exceptionpruning;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.anyOf;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -19,6 +19,7 @@ import com.ibm.wala.analysis.exceptionanalysis.IntraproceduralExceptionAnalysis;
|
|||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -74,7 +75,7 @@ public class ExceptionAnalysisTest {
|
|||
options.getSSAOptions().setPiNodePolicy(new AllIntegerDueToBranchePiPolicy());
|
||||
|
||||
ReferenceCleanser.registerClassHierarchy(cha);
|
||||
AnalysisCache cache = new AnalysisCache();
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
ReferenceCleanser.registerCache(cache);
|
||||
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, cache, cha, scope);
|
||||
cg = builder.makeCallGraph(options, null);
|
||||
|
|
|
@ -14,8 +14,6 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ibm.wala.cfg.CFGSanitizer;
|
||||
|
@ -39,6 +37,8 @@ import com.ibm.wala.util.config.AnalysisScopeReader;
|
|||
import com.ibm.wala.util.graph.Graph;
|
||||
import com.ibm.wala.util.io.FileProvider;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
/**
|
||||
* Test integrity of CFGs
|
||||
*/
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.ibm.wala.classLoader.Language;
|
|||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
|
@ -127,7 +128,7 @@ public class CFGTest extends WalaTestCase {
|
|||
MethodReference mr = StringStuff.makeMethodReference("cfg.MonitorTest.sync1()V");
|
||||
|
||||
IMethod m = cha.resolveMethod(mr);
|
||||
AnalysisCache cache = makeAnalysisCache();
|
||||
IAnalysisCacheView cache = makeAnalysisCache();
|
||||
IR ir = cache.getIR(m);
|
||||
System.out.println(ir);
|
||||
SSACFG controlFlowGraph = ir.getControlFlowGraph();
|
||||
|
@ -139,7 +140,7 @@ public class CFGTest extends WalaTestCase {
|
|||
MethodReference mr = StringStuff.makeMethodReference("cfg.MonitorTest.sync2()V");
|
||||
|
||||
IMethod m = cha.resolveMethod(mr);
|
||||
AnalysisCache cache = makeAnalysisCache();
|
||||
IAnalysisCacheView cache = makeAnalysisCache();
|
||||
IR ir = cache.getIR(m);
|
||||
System.out.println(ir);
|
||||
SSACFG controlFlowGraph = ir.getControlFlowGraph();
|
||||
|
@ -154,7 +155,7 @@ public class CFGTest extends WalaTestCase {
|
|||
MethodReference mr = StringStuff.makeMethodReference("cfg.MonitorTest.sync3()V");
|
||||
|
||||
IMethod m = cha.resolveMethod(mr);
|
||||
AnalysisCache cache = makeAnalysisCache();
|
||||
IAnalysisCacheView cache = makeAnalysisCache();
|
||||
IR ir = cache.getIR(m);
|
||||
SSACFG controlFlowGraph = ir.getControlFlowGraph();
|
||||
Assert.assertEquals(1, controlFlowGraph.getSuccNodeCount(controlFlowGraph.getBlockForInstruction(33)));
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.ibm.wala.classLoader.IMethod;
|
|||
import com.ibm.wala.classLoader.ShrikeCTMethod;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
|
@ -81,7 +81,7 @@ public class CornerCasesTest extends WalaTestCase {
|
|||
ShrikeCTMethod m = (ShrikeCTMethod) klass.getMethod(new Selector(Atom.findOrCreateAsciiAtom("foo"), Descriptor
|
||||
.findOrCreateUTF8("()Ljava/lang/Object;")));
|
||||
Assert.assertTrue(m != null);
|
||||
IR ir = new AnalysisCache().getSSACache().findOrCreateIR(m, Everywhere.EVERYWHERE, options.getSSAOptions());
|
||||
IR ir = new AnalysisCacheImpl().getSSACache().findOrCreateIR(m, Everywhere.EVERYWHERE, options.getSSAOptions());
|
||||
TypeInference.make(ir, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.ibm.wala.classLoader.IMethod;
|
|||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
|
@ -72,7 +73,7 @@ public class LocalNamesTest extends WalaTestCase {
|
|||
(new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
|
||||
options = new AnalysisOptions(scope, null);
|
||||
cache = new AnalysisCache();
|
||||
cache = new AnalysisCacheImpl();
|
||||
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions());
|
||||
|
||||
try {
|
||||
|
|
|
@ -20,8 +20,9 @@ import com.ibm.wala.classLoader.IMethod;
|
|||
import com.ibm.wala.classLoader.Language;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
|
@ -48,7 +49,7 @@ public class MultiNewArrayTest extends WalaTestCase {
|
|||
Assert.assertTrue(klass != null);
|
||||
IMethod m = klass.getMethod(Selector.make(Language.JAVA, "testNewMultiArray()V"));
|
||||
Assert.assertTrue(m != null);
|
||||
AnalysisCache cache = new AnalysisCache();
|
||||
IAnalysisCacheView cache = new AnalysisCacheImpl();
|
||||
IR ir = cache.getIRFactory().makeIR(m, Everywhere.EVERYWHERE, new SSAOptions());
|
||||
Assert.assertTrue(ir != null);
|
||||
SSAInstruction[] instructions = ir.getInstructions();
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -64,7 +64,7 @@ public class MultiDimArrayTest extends WalaTestCase {
|
|||
.makeMainEntrypoints(scope, cha, TestConstants.MULTI_DIM_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCache(),cha, scope);
|
||||
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(),cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -47,7 +47,7 @@ public class TypeBasedArrayAliasTest extends WalaTestCase {
|
|||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
// RTA yields a TypeBasedPointerAnalysis
|
||||
CallGraphBuilder builder = Util.makeRTABuilder(options, new AnalysisCache(),cha, scope);
|
||||
CallGraphBuilder builder = Util.makeRTABuilder(options, new AnalysisCacheImpl(),cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
|
||||
|
|
|
@ -12,13 +12,11 @@ package com.ibm.wala.core.tests.ptrs;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -40,6 +38,8 @@ import com.ibm.wala.types.TypeReference;
|
|||
import com.ibm.wala.util.CancelException;
|
||||
import com.ibm.wala.util.intset.OrdinalSet;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
public class ZeroLengthArrayTest {
|
||||
|
||||
@Test
|
||||
|
@ -51,7 +51,7 @@ public class ZeroLengthArrayTest {
|
|||
TestConstants.ZERO_LENGTH_ARRAY_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
// System.err.println(pa);
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.junit.Test;
|
|||
|
||||
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
|
@ -47,7 +47,7 @@ public class DynamicCallGraphTest extends DynamicCallGraphTestBase {
|
|||
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
|
||||
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
return CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false);
|
||||
return CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCacheImpl(), cha, scope, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.junit.Test;
|
|||
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.examples.drivers.PDFSlice;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -104,7 +104,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE1_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -134,7 +134,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE2_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMethod(cg, "baz");
|
||||
|
@ -158,7 +158,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE3_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMethod(cg, "main");
|
||||
|
@ -181,7 +181,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE4_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -204,7 +204,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE5_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode n = findMethod(cg, "baz");
|
||||
|
@ -234,7 +234,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE7_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -262,7 +262,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE8_MAIN);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode process = findMethod(cg, Descriptor.findOrCreateUTF8("()V"), Atom.findOrCreateUnicodeAtom("process"));
|
||||
|
@ -288,7 +288,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD1);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -311,7 +311,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD2);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -334,7 +334,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD3);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -357,7 +357,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD4);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -387,7 +387,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD5);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -411,7 +411,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTCD6);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -435,7 +435,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTID);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -458,7 +458,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTARRAYS);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -482,7 +482,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTFIELDS);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -506,7 +506,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTTHIN1);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -540,7 +540,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTGLOBAL);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -565,7 +565,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTMULTITARGET);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -588,7 +588,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTRECURSION);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -613,7 +613,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TEST_PRIM_GETTER_SETTER);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode test = findMethod(cg, "test");
|
||||
|
@ -648,7 +648,7 @@ public class SlicerTest {
|
|||
Util.addDefaultBypassLogic(options, scope, Util.class.getClassLoader(), cha);
|
||||
ContextSelector appSelector = null;
|
||||
SSAContextInterpreter appInterpreter = null;
|
||||
SSAPropagationCallGraphBuilder builder = new nCFABuilder(1, cha, options, new AnalysisCache(), appSelector, appInterpreter);
|
||||
SSAPropagationCallGraphBuilder builder = new nCFABuilder(1, cha, options, new AnalysisCacheImpl(), appSelector, appInterpreter);
|
||||
// nCFABuilder uses type-based heap abstraction by default, but we want allocation sites
|
||||
// NOTE: we disable ZeroXInstanceKeys.SMUSH_PRIMITIVE_HOLDERS for this test, since IntWrapper
|
||||
// is a primitive holder
|
||||
|
@ -680,7 +680,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTTHROWCATCH);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -705,7 +705,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTMESSAGEFORMAT);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
@ -731,7 +731,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_TESTINETADDR);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
SDG sdg = new SDG(cg, builder.getPointerAnalysis(), DataDependenceOptions.NO_BASE_NO_HEAP, ControlDependenceOptions.FULL);
|
||||
GraphIntegrity.check(sdg);
|
||||
|
@ -746,7 +746,7 @@ public class SlicerTest {
|
|||
TestConstants.SLICE_JUSTTHROW);
|
||||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder builder = Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
CallGraph cg = builder.makeCallGraph(options, null);
|
||||
|
||||
CGNode main = findMainMethod(cg);
|
||||
|
|
|
@ -23,9 +23,10 @@ import com.ibm.wala.classLoader.ClassLoaderFactoryImpl;
|
|||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.core.tests.util.WalaTestCase;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.IAnalysisCacheView;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
|
@ -56,7 +57,7 @@ public class TypeInferenceTest extends WalaTestCase {
|
|||
|
||||
private static AnalysisOptions options;
|
||||
|
||||
private static AnalysisCache cache;
|
||||
private static IAnalysisCacheView cache;
|
||||
|
||||
public static void main(String[] args) {
|
||||
justThisTest(TypeInferenceTest.class);
|
||||
|
@ -68,7 +69,7 @@ public class TypeInferenceTest extends WalaTestCase {
|
|||
scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA, (new FileProvider()).getFile("J2SEClassHierarchyExclusions.txt"), MY_CLASSLOADER);
|
||||
|
||||
options = new AnalysisOptions(scope, null);
|
||||
cache = new AnalysisCache();
|
||||
cache = new AnalysisCacheImpl();
|
||||
ClassLoaderFactory factory = new ClassLoaderFactoryImpl(scope.getExclusions());
|
||||
|
||||
try {
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.junit.runner.JUnitCore;
|
|||
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
|
||||
import com.ibm.wala.core.tests.ir.AnnotationTest;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyFactory;
|
||||
|
@ -67,7 +68,7 @@ public abstract class WalaTestCase {
|
|||
}
|
||||
|
||||
protected AnalysisCache makeAnalysisCache() {
|
||||
return new AnalysisCache();
|
||||
return new AnalysisCacheImpl();
|
||||
}
|
||||
|
||||
public static IClassHierarchy makeCHA() throws IOException, ClassHierarchyException {
|
||||
|
|
|
@ -57,7 +57,7 @@ import com.ibm.wala.demandpa.flowgraph.IFlowLabel;
|
|||
import com.ibm.wala.demandpa.util.CallGraphMapUtil;
|
||||
import com.ibm.wala.demandpa.util.MemoryAccessMap;
|
||||
import com.ibm.wala.demandpa.util.SimpleMemoryAccessMap;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -151,13 +151,13 @@ public class CompareToZeroOneCFADriver {
|
|||
}
|
||||
|
||||
private static void doTests(AnalysisScope scope, final ClassHierarchy cha, AnalysisOptions options) throws IllegalArgumentException, CancelException {
|
||||
final SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
final SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
final CallGraph oldCG = builder.makeCallGraph(options,null);
|
||||
final PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
|
||||
|
||||
// now, run our analysis
|
||||
// build an RTA call graph
|
||||
CallGraphBuilder rtaBuilder = Util.makeRTABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder rtaBuilder = Util.makeRTABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
final CallGraph cg = rtaBuilder.makeCallGraph(options, null);
|
||||
// System.err.println(cg.toString());
|
||||
|
||||
|
@ -228,7 +228,7 @@ public class CompareToZeroOneCFADriver {
|
|||
|
||||
private static IDemandPointerAnalysis makeDemandPointerAnalysis(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope,
|
||||
CallGraph cg, MemoryAccessMap fam) {
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
// return new TestNewGraphPointsTo(cg, builder, fam, cha, warnings);
|
||||
DemandRefinementPointsTo fullDemandPointsTo = DemandRefinementPointsTo.makeWithDefaultFlowGraph(cg, builder, fam, cha, options, new DummyStateMachine.Factory<IFlowLabel>());
|
||||
// fullDemandPointsTo.setOnTheFly(true);
|
||||
|
|
|
@ -58,7 +58,7 @@ import com.ibm.wala.demandpa.alg.statemachine.DummyStateMachine;
|
|||
import com.ibm.wala.demandpa.flowgraph.IFlowLabel;
|
||||
import com.ibm.wala.demandpa.util.MemoryAccessMap;
|
||||
import com.ibm.wala.demandpa.util.SimpleMemoryAccessMap;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
@ -117,7 +117,7 @@ public class TestAgainstSimpleDriver {
|
|||
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
|
||||
|
||||
// build an RTA call graph
|
||||
CallGraphBuilder rtaBuilder = Util.makeRTABuilder(options, new AnalysisCache(), cha, scope);
|
||||
CallGraphBuilder rtaBuilder = Util.makeRTABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
final CallGraph cg = rtaBuilder.makeCallGraph(options, null);
|
||||
// System.err.println(cg.toString());
|
||||
|
||||
|
@ -164,7 +164,7 @@ public class TestAgainstSimpleDriver {
|
|||
|
||||
private static IDemandPointerAnalysis makeDemandPointerAnalysis(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope,
|
||||
CallGraph cg, MemoryAccessMap fam) {
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCache(), cha, scope);
|
||||
SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope);
|
||||
// return new TestNewGraphPointsTo(cg, builder, fam, cha, warnings);
|
||||
DemandRefinementPointsTo fullDemandPointsTo = DemandRefinementPointsTo.makeWithDefaultFlowGraph(cg, builder, fam, cha, options, new DummyStateMachine.Factory<IFlowLabel>());
|
||||
// fullDemandPointsTo.setCGRefinePolicy(new AlwaysRefineCGPolicy());
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.io.IOException;
|
|||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
|
@ -67,7 +68,7 @@ public class ConstructAllIRs {
|
|||
|
||||
// register class hierarchy and AnalysisCache with the reference cleanser, so that their soft references are appropriately wiped
|
||||
ReferenceCleanser.registerClassHierarchy(cha);
|
||||
AnalysisCache cache = new AnalysisCache();
|
||||
AnalysisCache cache = new AnalysisCacheImpl();
|
||||
ReferenceCleanser.registerCache(cache);
|
||||
AnalysisOptions options = new AnalysisOptions();
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue