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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,4 +26,4 @@ public class Array1 {
|
|||
sum += ary[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,4 @@ public class ArrayLiteral1 {
|
|||
int[] a= new int[] { 0, 1, 2, 3, 5 };
|
||||
Object[] b= new Object[] { null, "hi", new Integer(55), new int[] { 3, 1, 4 } };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,4 +42,4 @@ public class Breaks {
|
|||
(new Breaks()).testBreakFromIf("whatever", new Ref(args));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,4 +34,4 @@ public class Casts {
|
|||
int i2 = i1 + s1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,4 +35,4 @@ class SubFunkySupers extends FunkySupers {
|
|||
|
||||
//class EE { class X {} }
|
||||
//class Y extends EE.X { Y(EE e) { e.super(); } }
|
||||
// DOESNT WORK IN POLYGLOT!!!
|
||||
// DOESNT WORK IN POLYGLOT!!!
|
||||
|
|
|
@ -37,4 +37,4 @@ class Derived extends Base {
|
|||
public String bar(int x) {
|
||||
return Integer.toHexString(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,4 @@ class Sub extends InnerClassSuper {
|
|||
so.test();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,4 +84,4 @@ public class MiniaturSliceBug {
|
|||
(new MiniaturSliceBug()).validNonDispatchedCall(new IntWrapper(-1));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@ public class Scoping1 {
|
|||
System.out.println(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,4 @@ public class Scoping2 {
|
|||
System.out.println(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,4 @@ public class StaticNesting {
|
|||
value= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,4 +167,4 @@ public class InnerClassAA {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,4 @@ class Sub extends InnerClassSuperA {
|
|||
so.test();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,4 +72,4 @@ public class GenericMemberClasses<T>
|
|||
System.out.println(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,4 +69,4 @@ public class NotSoSimpleEnums {
|
|||
(new NotSoSimpleEnums()).doit(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,4 @@ public class NonPrimaryTopLevel {
|
|||
|
||||
class Foo {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
@ -75,4 +74,4 @@ public abstract class AbstractFieldBasedTest extends TestJSCallGraphShape {
|
|||
System.out.println(callsite + " -> " + callee);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -396,4 +396,4 @@ public abstract class TestPointerAnalyses {
|
|||
public void testInherit() throws IOException, WalaException, CancelException {
|
||||
testTestScript("tests", "inherit.js", nameFilter("tests/inherit.js"), new CheckPointers());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -137,14 +139,19 @@ 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 {
|
||||
@SuppressWarnings("deprecation")
|
||||
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);
|
||||
|
||||
|
|
|
@ -31,4 +31,4 @@ public class UnknownVertex extends Vertex {
|
|||
public String toString() {
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -20,4 +20,4 @@ public interface FileMapping {
|
|||
*/
|
||||
public abstract IncludedPosition getIncludedPosition(Position line);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
@Override
|
||||
public String getName() {
|
||||
return 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -82,4 +82,4 @@ public class ObjectSensitivityContextSelector implements ContextSelector {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -224,4 +224,4 @@ public class PropertyNameContextSelector implements ContextSelector {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,4 +47,4 @@ public abstract class Correlation {
|
|||
public abstract Position getEndPosition(SSASourcePositionMap positions);
|
||||
public abstract String pp(SSASourcePositionMap positions);
|
||||
public abstract <T> T accept(CorrelationVisitor<T> visitor);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,4 +60,4 @@ public final class CorrelationSummary {
|
|||
public SSASourcePositionMap getPositions() {
|
||||
return positions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,4 +60,4 @@ public class EscapeCorrelation extends Correlation {
|
|||
public <T> T accept(CorrelationVisitor<T> visitor) {
|
||||
return visitor.visitEscapeCorrelation(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,4 +54,4 @@ public class ReadWriteCorrelation extends Correlation {
|
|||
public <T> T accept(CorrelationVisitor<T> visitor) {
|
||||
return visitor.visitReadWriteCorrelation(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,4 +34,4 @@ public class SSASourcePositionMap {
|
|||
public Position getPosition(SSAInstruction inst) {
|
||||
return method.getSourcePosition(instrIndices.getMappedIndex(inst));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -242,4 +242,4 @@ public abstract class CAstRewriterExt extends CAstRewriter<NodePos, NoKey> {
|
|||
super(Ast, recursive, rootContext);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,4 +53,4 @@ public class CorrelatedPairExtractorFactory implements CAstRewriterFactory<NodeP
|
|||
};
|
||||
return new ClosureExtractor(ast, policyFactory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -186,4 +186,4 @@ class ExtractedFunction implements CAstEntity {
|
|||
public String toString() {
|
||||
return "<JS function " + name + ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
Set<String> fnNames = JSCallGraphUtil.loadAdditionalFile(cha, cl, f.toURI().toURL());
|
||||
final String fileName = "ctor$" + ++ctorCount;
|
||||
ModuleEntry ME = new SourceModule() {
|
||||
|
||||
@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,10 +537,8 @@ public class JavaScriptConstructorFunctions {
|
|||
}
|
||||
}
|
||||
|
||||
assert fcls != null : "cannot find class for " + fileName + " in " + f;
|
||||
assert fcls != null : "cannot find class for " + fileName;
|
||||
|
||||
f.delete();
|
||||
|
||||
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; }
|
||||
|
|
|
@ -71,4 +71,4 @@ public class JavaScriptTypes extends AstTypeReference {
|
|||
|
||||
public static final TypeReference RegExpObject = TypeReference.findOrCreate(jsLoader, "LRegExpObject");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -79,4 +79,4 @@ public class ArgumentInstanceContext implements Context {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -115,4 +115,4 @@ public abstract class ScriptEntryPoints implements Iterable<Entrypoint> {
|
|||
assert false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
|
@ -50,4 +50,4 @@ public class AbstractClassEntity extends AbstractDataEntity {
|
|||
public Collection<CAstQualifier> getQualifiers() {
|
||||
return type.getQualifiers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,4 +89,4 @@ public abstract class AbstractCodeEntity extends AbstractEntity {
|
|||
public void setAst(CAstNode Ast) {
|
||||
this.Ast = Ast;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,4 +54,4 @@ abstract class AbstractDataEntity extends AbstractEntity {
|
|||
public int getArgumentCount() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,4 +74,4 @@ public abstract class AbstractEntity implements CAstEntity {
|
|||
}
|
||||
scopedEntities.get(construct).add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,4 +68,4 @@ class AbstractFieldEntity extends AbstractDataEntity {
|
|||
public Collection<CAstQualifier> getQualifiers() {
|
||||
return modifiers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,4 +76,4 @@ public class AbstractScriptEntity extends AbstractCodeEntity {
|
|||
public String getFileName() {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue