changes for hybrid analysis
This commit is contained in:
parent
c5b538eade
commit
0975441a43
|
@ -12,6 +12,7 @@ package com.ibm.wala.cast.java.ipa.callgraph;
|
|||
|
||||
import com.ibm.wala.analysis.typeInference.TypeInference;
|
||||
import com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder;
|
||||
import com.ibm.wala.cast.ipa.callgraph.GlobalObjectKey;
|
||||
import com.ibm.wala.cast.java.analysis.typeInference.AstJavaTypeInference;
|
||||
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl.JavaClass;
|
||||
import com.ibm.wala.cast.java.ssa.AstJavaInstructionVisitor;
|
||||
|
@ -37,6 +38,7 @@ import com.ibm.wala.ssa.SymbolTable;
|
|||
import com.ibm.wala.types.MethodReference;
|
||||
import com.ibm.wala.util.debug.Assertions;
|
||||
import com.ibm.wala.util.intset.IntSetAction;
|
||||
import com.ibm.wala.util.strings.Atom;
|
||||
|
||||
public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraphBuilder {
|
||||
|
||||
|
@ -298,7 +300,7 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ConstraintVisitor makeVisitor(CGNode node) {
|
||||
public ConstraintVisitor makeVisitor(CGNode node) {
|
||||
return new AstJavaConstraintVisitor(this, node);
|
||||
}
|
||||
|
||||
|
@ -309,4 +311,10 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
|
|||
String containingClass = reference.getDeclaringClass().getName().toString();
|
||||
return definingMethod.equals(containingClass + "/" + selector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GlobalObjectKey getGlobalObject(Atom language) {
|
||||
Assertions.UNREACHABLE();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Set;
|
|||
|
||||
import com.ibm.wala.analysis.typeInference.TypeInference;
|
||||
import com.ibm.wala.cast.ipa.callgraph.AstSSAPropagationCallGraphBuilder;
|
||||
import com.ibm.wala.cast.ipa.callgraph.ReflectedFieldPointerKey;
|
||||
import com.ibm.wala.cast.ipa.callgraph.GlobalObjectKey;
|
||||
import com.ibm.wala.cast.ir.ssa.AstGlobalRead;
|
||||
import com.ibm.wala.cast.ir.ssa.AstGlobalWrite;
|
||||
import com.ibm.wala.cast.ir.ssa.AstIsDefinedInstruction;
|
||||
|
@ -113,6 +113,14 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
*/
|
||||
public static final String GLOBAL_OBJ_VAR_NAME = "__WALA__int3rnal__global";
|
||||
|
||||
private final GlobalObjectKey globalObject;
|
||||
|
||||
@Override
|
||||
public GlobalObjectKey getGlobalObject(Atom language) {
|
||||
assert language.equals(JavaScriptTypes.jsName);
|
||||
return globalObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* is field a direct (WALA-internal) reference to the global object?
|
||||
*/
|
||||
|
@ -140,6 +148,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
protected JSSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
||||
PointerKeyFactory pointerKeyFactory) {
|
||||
super(cha, options, cache, pointerKeyFactory);
|
||||
globalObject = new GlobalObjectKey(cha.lookupClass(JavaScriptTypes.Root));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -195,14 +204,12 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
prototypeRef = x;
|
||||
}
|
||||
|
||||
private final GlobalObjectKey globalObject = new GlobalObjectKey(cha.lookupClass(JavaScriptTypes.Object));
|
||||
|
||||
public PointerKey getPointerKeyForGlobalVar(String varName) {
|
||||
FieldReference fieldRef = FieldReference.findOrCreate(JavaScriptTypes.Root, Atom.findOrCreateUnicodeAtom(varName),
|
||||
JavaScriptTypes.Root);
|
||||
IField f = cha.resolveField(fieldRef);
|
||||
assert f != null : "couldn't resolve " + varName;
|
||||
return getPointerKeyForInstanceField(globalObject, f);
|
||||
return getPointerKeyForInstanceField(getGlobalObject(JavaScriptTypes.jsName), f);
|
||||
}
|
||||
@Override
|
||||
protected ExplicitCallGraph createEmptyCallGraph(IClassHierarchy cha, AnalysisOptions options) {
|
||||
|
@ -357,7 +364,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
IField f = jsAnalysis.builder.getCallGraph().getClassHierarchy().resolveField(field);
|
||||
assert f != null;
|
||||
MutableSparseIntSet S = MutableSparseIntSet.makeEmpty();
|
||||
InstanceKey globalObj = ((JSSSAPropagationCallGraphBuilder) jsAnalysis.builder).globalObject;
|
||||
InstanceKey globalObj = ((AstSSAPropagationCallGraphBuilder) jsAnalysis.builder).getGlobalObject(JavaScriptTypes.jsName);
|
||||
PointerKey fkey = analysis.getHeapModel().getPointerKeyForInstanceField(globalObj, f);
|
||||
if (fkey != null) {
|
||||
OrdinalSet pointees = analysis.getPointsToSet(fkey);
|
||||
|
@ -402,7 +409,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
// ///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
protected JSConstraintVisitor makeVisitor(CGNode node) {
|
||||
public JSConstraintVisitor makeVisitor(CGNode node) {
|
||||
if (AstSSAPropagationCallGraphBuilder.DEBUG_PROPERTIES) {
|
||||
final IMethod method = node.getMethod();
|
||||
if (method instanceof AstMethod) {
|
||||
|
@ -432,11 +439,6 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
super(builder, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSSSAPropagationCallGraphBuilder getBuilder() {
|
||||
return (JSSSAPropagationCallGraphBuilder) builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitUnaryOp(SSAUnaryOpInstruction inst) {
|
||||
if (inst.getOpcode() == IUnaryOpInstruction.Operator.NEG) {
|
||||
|
@ -490,7 +492,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
if (hasNoInterestingUses(lval)) {
|
||||
system.recordImplicitPointsToSet(def);
|
||||
} else {
|
||||
InstanceKey globalObj = getBuilder().globalObject;
|
||||
InstanceKey globalObj = getBuilder().getGlobalObject(JavaScriptTypes.jsName);
|
||||
if (directGlobalObjectRef(field)) {
|
||||
// points-to set is just the global object
|
||||
system.newConstraint(def, globalObj);
|
||||
|
@ -510,7 +512,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
IField f = getClassHierarchy().resolveField(field);
|
||||
assert f != null : "could not resolve referenced global " + field;
|
||||
assert !f.getFieldTypeReference().isPrimitiveType();
|
||||
InstanceKey globalObj = getBuilder().globalObject;
|
||||
InstanceKey globalObj = getBuilder().getGlobalObject(JavaScriptTypes.jsName);
|
||||
system.findOrCreateIndexForInstanceKey(globalObj);
|
||||
PointerKey p = getPointerKeyForInstanceField(globalObj, f);
|
||||
|
||||
|
@ -572,6 +574,9 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
if (instruction.getDeclaredTarget().equals(JavaScriptMethods.dispatchReference)) {
|
||||
handleJavascriptDispatch(instruction);
|
||||
} else {
|
||||
if (! instruction.getDeclaredTarget().equals(JavaScriptMethods.ctorReference)) {
|
||||
System.err.println(instruction);
|
||||
}
|
||||
visitInvokeInternal(instruction, new DefaultInvariantComputer());
|
||||
}
|
||||
}
|
||||
|
@ -985,12 +990,15 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
@Override
|
||||
protected void processCallingConstraints(CGNode caller, SSAAbstractInvokeInstruction instruction, CGNode target,
|
||||
InstanceKey[][] constParams, PointerKey uniqueCatchKey) {
|
||||
processCallingConstraintsInternal(this, caller, instruction, target, constParams, uniqueCatchKey);
|
||||
}
|
||||
|
||||
|
||||
IR sourceIR = getCFAContextInterpreter().getIR(caller);
|
||||
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();
|
||||
|
||||
IR targetIR = getCFAContextInterpreter().getIR(target);
|
||||
IR targetIR = builder.getCFAContextInterpreter().getIR(target);
|
||||
SymbolTable targetST = targetIR.getSymbolTable();
|
||||
|
||||
JSConstraintVisitor targetVisitor = null;
|
||||
|
@ -1000,7 +1008,7 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
for (int n = 0; vns != null && n < vns.length; n++) {
|
||||
if ("arguments".equals(vns[n])) {
|
||||
av = v;
|
||||
targetVisitor = makeVisitor(target);
|
||||
targetVisitor = (JSConstraintVisitor) builder.makeVisitor(target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1015,12 +1023,12 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
|
||||
// pass actual arguments to formals in the normal way
|
||||
for (int i = 0; i < Math.min(paramCount, argCount); i++) {
|
||||
InstanceKey[] fn = new InstanceKey[] { getInstanceKeyForConstant(JavaScriptTypes.String, ""+(i-num_pseudoargs)) };
|
||||
PointerKey F = getTargetPointerKey(target, i);
|
||||
InstanceKey[] fn = new InstanceKey[] { builder.getInstanceKeyForConstant(JavaScriptTypes.String, ""+(i-num_pseudoargs)) };
|
||||
PointerKey F = builder.getTargetPointerKey(target, i);
|
||||
|
||||
if (constParams != null && constParams[i] != null) {
|
||||
for (int j = 0; j < constParams[i].length; j++) {
|
||||
system.newConstraint(F, constParams[i][j]);
|
||||
builder.getSystem().newConstraint(F, constParams[i][j]);
|
||||
}
|
||||
|
||||
if (av != -1 && i >= num_pseudoargs) {
|
||||
|
@ -1028,8 +1036,8 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
}
|
||||
|
||||
} else {
|
||||
PointerKey A = getPointerKeyForLocal(caller, instruction.getUse(i));
|
||||
system.newConstraint(F, (F instanceof FilteredPointerKey) ? filterOperator : assignOperator, A);
|
||||
PointerKey A = builder.getPointerKeyForLocal(caller, instruction.getUse(i));
|
||||
builder.getSystem().newConstraint(F, (F instanceof FilteredPointerKey) ? builder.filterOperator : assignOperator, A);
|
||||
|
||||
if (av != -1 && i >= num_pseudoargs) {
|
||||
targetVisitor.newFieldWrite(target, av, fn, F);
|
||||
|
@ -1041,11 +1049,11 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
if (paramCount < argCount) {
|
||||
if (av != -1) {
|
||||
for (int i = paramCount; i < argCount; i++) {
|
||||
InstanceKey[] fn = new InstanceKey[] { getInstanceKeyForConstant(JavaScriptTypes.String, ""+(i-num_pseudoargs)) };
|
||||
InstanceKey[] fn = new InstanceKey[] { builder.getInstanceKeyForConstant(JavaScriptTypes.String, ""+(i-num_pseudoargs)) };
|
||||
if (constParams != null && constParams[i] != null && i >= num_pseudoargs) {
|
||||
targetVisitor.newFieldWrite(target, av, fn, constParams[i]);
|
||||
} else if(i >= num_pseudoargs) {
|
||||
PointerKey A = getPointerKeyForLocal(caller, instruction.getUse(i));
|
||||
PointerKey A = builder.getPointerKeyForLocal(caller, instruction.getUse(i));
|
||||
targetVisitor.newFieldWrite(target, av, fn, A);
|
||||
}
|
||||
}
|
||||
|
@ -1055,37 +1063,37 @@ public class JSSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraph
|
|||
// extra formal parameters get null (extra args are ignored here)
|
||||
else if (argCount < paramCount) {
|
||||
int nullvn = sourceST.getNullConstant();
|
||||
DefUse sourceDU = getCFAContextInterpreter().getDU(caller);
|
||||
InstanceKey[] nullkeys = getInvariantContents(sourceST, sourceDU, caller, nullvn, this);
|
||||
DefUse sourceDU = builder.getCFAContextInterpreter().getDU(caller);
|
||||
InstanceKey[] nullkeys = builder.getInvariantContents(sourceST, sourceDU, caller, nullvn, builder);
|
||||
for (int i = argCount; i < paramCount; i++) {
|
||||
PointerKey F = getPointerKeyForLocal(target, targetST.getParameter(i));
|
||||
PointerKey F = builder.getPointerKeyForLocal(target, targetST.getParameter(i));
|
||||
for (int k = 0; k < nullkeys.length; k++) {
|
||||
system.newConstraint(F, nullkeys[k]);
|
||||
builder.getSystem().newConstraint(F, nullkeys[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// write `length' in argument objects
|
||||
if (av != -1) {
|
||||
InstanceKey[] svn = new InstanceKey[] { getInstanceKeyForConstant(JavaScriptTypes.Number, argCount-1) };
|
||||
InstanceKey[] lnv = new InstanceKey[] { getInstanceKeyForConstant(JavaScriptTypes.String, "length") };
|
||||
InstanceKey[] svn = new InstanceKey[] { builder.getInstanceKeyForConstant(JavaScriptTypes.Number, argCount-1) };
|
||||
InstanceKey[] lnv = new InstanceKey[] { builder.getInstanceKeyForConstant(JavaScriptTypes.String, "length") };
|
||||
targetVisitor.newFieldWrite(target, av, lnv, svn);
|
||||
}
|
||||
|
||||
// return values
|
||||
if (instruction.getDef(0) != -1) {
|
||||
PointerKey RF = getPointerKeyForReturnValue(target);
|
||||
PointerKey RA = getPointerKeyForLocal(caller, instruction.getDef(0));
|
||||
system.newConstraint(RA, assignOperator, RF);
|
||||
PointerKey RF = builder.getPointerKeyForReturnValue(target);
|
||||
PointerKey RA = builder.getPointerKeyForLocal(caller, instruction.getDef(0));
|
||||
builder.getSystem().newConstraint(RA, assignOperator, RF);
|
||||
}
|
||||
|
||||
PointerKey EF = getPointerKeyForExceptionalReturnValue(target);
|
||||
PointerKey EF = builder.getPointerKeyForExceptionalReturnValue(target);
|
||||
if (SHORT_CIRCUIT_SINGLE_USES && uniqueCatchKey != null) {
|
||||
// e has exactly one use. so, represent e implicitly
|
||||
system.newConstraint(uniqueCatchKey, assignOperator, EF);
|
||||
builder.getSystem().newConstraint(uniqueCatchKey, assignOperator, EF);
|
||||
} else {
|
||||
PointerKey EA = getPointerKeyForLocal(caller, instruction.getDef(1));
|
||||
system.newConstraint(EA, assignOperator, EF);
|
||||
PointerKey EA = builder.getPointerKeyForLocal(caller, instruction.getDef(1));
|
||||
builder.getSystem().newConstraint(EA, assignOperator, EF);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ import com.ibm.wala.util.intset.IntSetAction;
|
|||
import com.ibm.wala.util.intset.IntSetUtil;
|
||||
import com.ibm.wala.util.intset.MutableIntSet;
|
||||
import com.ibm.wala.util.intset.MutableMapping;
|
||||
import com.ibm.wala.util.strings.Atom;
|
||||
|
||||
public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCallGraphBuilder {
|
||||
|
||||
|
@ -112,6 +113,8 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public abstract GlobalObjectKey getGlobalObject(Atom language);
|
||||
|
||||
protected AstSSAPropagationCallGraphBuilder(IClassHierarchy cha, AnalysisOptions options, AnalysisCache cache,
|
||||
PointerKeyFactory pointerKeyFactory) {
|
||||
super(cha, options, cache, pointerKeyFactory);
|
||||
|
@ -326,7 +329,8 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
//
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
protected ConstraintVisitor makeVisitor(ExplicitCallGraph.ExplicitNode node) {
|
||||
@Override
|
||||
public ConstraintVisitor makeVisitor(CGNode node) {
|
||||
return new AstConstraintVisitor(this, node);
|
||||
}
|
||||
|
||||
|
@ -1259,5 +1263,4 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
|
|||
*/
|
||||
protected abstract boolean sameMethod(final CGNode opNode, final String definingMethod);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,12 +22,12 @@ import com.ibm.wala.util.intset.IntSet;
|
|||
import com.ibm.wala.util.strings.Atom;
|
||||
|
||||
/**
|
||||
* A ContextSelector implementation adapted to work for analysi across
|
||||
* A ContextSelector implementation adapted to work for analysis across
|
||||
* multiple languages. This context selector delegates to one of several
|
||||
* child selectors based on the language of the code body for which a
|
||||
* context is being selected.
|
||||
*
|
||||
* This provides a convenient way to integrate multiple, lanuage-specific
|
||||
* This provides a convenient way to integrate multiple, language-specific
|
||||
* specialized context policies---such as the ones used for clone() in
|
||||
* Java and runtime primitives in JavaScript.
|
||||
*
|
||||
|
|
|
@ -30,9 +30,9 @@ import com.ibm.wala.util.strings.Atom;
|
|||
*/
|
||||
public class CrossLanguageInstanceKeys implements InstanceKeyFactory {
|
||||
|
||||
private final Map languageSelectors;
|
||||
private final Map<Atom,InstanceKeyFactory> languageSelectors;
|
||||
|
||||
public CrossLanguageInstanceKeys(Map languageSelectors) {
|
||||
public CrossLanguageInstanceKeys(Map<Atom,InstanceKeyFactory> languageSelectors) {
|
||||
this.languageSelectors = languageSelectors;
|
||||
}
|
||||
|
||||
|
@ -49,11 +49,11 @@ public class CrossLanguageInstanceKeys implements InstanceKeyFactory {
|
|||
// }
|
||||
|
||||
private InstanceKeyFactory getSelector(NewSiteReference site) {
|
||||
return (InstanceKeyFactory)languageSelectors.get(getLanguage(site));
|
||||
return languageSelectors.get(getLanguage(site));
|
||||
}
|
||||
|
||||
private InstanceKeyFactory getSelector(TypeReference type) {
|
||||
return (InstanceKeyFactory)languageSelectors.get(getLanguage(type));
|
||||
return languageSelectors.get(getLanguage(type));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ 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;
|
||||
|
@ -36,9 +37,9 @@ public class CrossLanguageMethodTargetSelector
|
|||
implements MethodTargetSelector
|
||||
{
|
||||
|
||||
private final Map languageSelectors;
|
||||
private final Map<Atom,MethodTargetSelector> languageSelectors;
|
||||
|
||||
public CrossLanguageMethodTargetSelector(Map languageSelectors) {
|
||||
public CrossLanguageMethodTargetSelector(Map<Atom, MethodTargetSelector> languageSelectors) {
|
||||
this.languageSelectors = languageSelectors;
|
||||
}
|
||||
|
||||
|
@ -54,7 +55,7 @@ public class CrossLanguageMethodTargetSelector
|
|||
}
|
||||
|
||||
private MethodTargetSelector getSelector(CallSiteReference site) {
|
||||
return (MethodTargetSelector)languageSelectors.get(getLanguage(site));
|
||||
return languageSelectors.get(getLanguage(site));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,11 +34,11 @@ import com.ibm.wala.util.strings.Atom;
|
|||
|
||||
public abstract class CrossLanguageSSAPropagationCallGraphBuilder extends AstSSAPropagationCallGraphBuilder {
|
||||
|
||||
private final TargetLanguageSelector<ConstraintVisitor, ExplicitCallGraph.ExplicitNode> visitors;
|
||||
private final TargetLanguageSelector<ConstraintVisitor, CGNode> visitors;
|
||||
|
||||
private final TargetLanguageSelector<InterestingVisitor, Integer> interesting;
|
||||
|
||||
protected abstract TargetLanguageSelector<ConstraintVisitor, ExplicitCallGraph.ExplicitNode> makeMainVisitorSelector();
|
||||
protected abstract TargetLanguageSelector<ConstraintVisitor, CGNode> makeMainVisitorSelector();
|
||||
|
||||
protected abstract TargetLanguageSelector<InterestingVisitor, Integer> makeInterestingVisitorSelector();
|
||||
|
||||
|
@ -69,7 +69,7 @@ public abstract class CrossLanguageSSAPropagationCallGraphBuilder extends AstSSA
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ConstraintVisitor makeVisitor(ExplicitCallGraph.ExplicitNode node) {
|
||||
public ConstraintVisitor makeVisitor(CGNode node) {
|
||||
return visitors.get(getLanguage(node), node);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.ibm.wala.cast.js.ipa.callgraph;
|
||||
package com.ibm.wala.cast.ipa.callgraph;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class GlobalObjectKey implements InstanceKey {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JS Global Object";
|
||||
return "Global Object";
|
||||
}
|
||||
|
||||
@Override
|
|
@ -39,8 +39,12 @@ import com.ibm.wala.util.strings.Atom;
|
|||
|
||||
public abstract class AnnotationTest extends WalaTestCase {
|
||||
|
||||
protected static IClassHierarchy cha;
|
||||
private final IClassHierarchy cha;
|
||||
|
||||
protected AnnotationTest(IClassHierarchy cha) {
|
||||
this.cha = cha;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClassAnnotations1() throws Exception {
|
||||
TypeReference typeUnderTest = TypeReference.findOrCreate(ClassLoaderReference.Application, "Lannotations/AnnotatedClass1");
|
||||
|
|
|
@ -2,14 +2,12 @@ package com.ibm.wala.core.tests.ir;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
|
||||
import com.ibm.wala.core.tests.util.TestConstants;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchy;
|
||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.util.config.AnalysisScopeReader;
|
||||
import com.ibm.wala.util.io.FileProvider;
|
||||
|
||||
|
@ -19,16 +17,13 @@ public class JVMLAnnotationTest extends AnnotationTest {
|
|||
justThisTest(JVMLAnnotationTest.class);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void before() throws IOException, ClassHierarchyException {
|
||||
private static IClassHierarchy makeCHA() throws IOException, ClassHierarchyException {
|
||||
AnalysisScope scope = AnalysisScopeReader.readJavaScope(TestConstants.WALA_TESTDATA,
|
||||
(new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS), AnnotationTest.class.getClassLoader());
|
||||
cha = ClassHierarchy.make(scope);
|
||||
return ClassHierarchy.make(scope);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void after() {
|
||||
cha = null;
|
||||
public JVMLAnnotationTest() throws ClassHierarchyException, IOException {
|
||||
super(makeCHA());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package com.ibm.wala.core.tests.util;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.After;import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.runner.JUnitCore;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ public abstract class AbstractURLModule implements Module, ModuleEntry {
|
|||
private final URL url;
|
||||
|
||||
public AbstractURLModule(URL url) {
|
||||
assert url != null;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
|
@ -85,4 +86,9 @@ public abstract class AbstractURLModule implements Module, ModuleEntry {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "module:" + url.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ public class PointerAnalysisImpl extends AbstractPointerAnalysis {
|
|||
}
|
||||
}
|
||||
|
||||
protected static class ImplicitPointsToSetVisitor extends SSAInstruction.Visitor {
|
||||
public static class ImplicitPointsToSetVisitor extends SSAInstruction.Visitor {
|
||||
protected final PointerAnalysisImpl analysis;
|
||||
|
||||
protected final CGNode node;
|
||||
|
|
|
@ -89,7 +89,7 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder {
|
|||
/**
|
||||
* Governing class hierarchy
|
||||
*/
|
||||
final protected IClassHierarchy cha;
|
||||
public final IClassHierarchy cha;
|
||||
|
||||
/**
|
||||
* Special rules for bypassing Java calls
|
||||
|
@ -121,6 +121,10 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder {
|
|||
*/
|
||||
protected PropagationSystem system;
|
||||
|
||||
public PropagationSystem getSystem() {
|
||||
return system;
|
||||
}
|
||||
|
||||
/**
|
||||
* Algorithm used to solve the system of constraints
|
||||
*/
|
||||
|
|
|
@ -1946,7 +1946,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
|
|||
protected static class InterestingVisitor extends SSAInstruction.Visitor {
|
||||
protected final int vn;
|
||||
|
||||
protected InterestingVisitor(int vn) {
|
||||
public InterestingVisitor(int vn) {
|
||||
this.vn = vn;
|
||||
}
|
||||
|
||||
|
@ -2071,7 +2071,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
|
|||
* @param target
|
||||
* @return an IClass which represents
|
||||
*/
|
||||
protected PointerKey getTargetPointerKey(CGNode target, int index) {
|
||||
public PointerKey getTargetPointerKey(CGNode target, int index) {
|
||||
int vn;
|
||||
if (target.getIR() != null) {
|
||||
vn = target.getIR().getSymbolTable().getParameter(index);
|
||||
|
@ -2154,7 +2154,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
|
|||
* @param valueNumber
|
||||
* @return the complete set of instances that the local with vn=valueNumber may point to.
|
||||
*/
|
||||
protected InstanceKey[] getInvariantContents(SymbolTable symbolTable, DefUse du, CGNode node, int valueNumber, HeapModel hm) {
|
||||
public InstanceKey[] getInvariantContents(SymbolTable symbolTable, DefUse du, CGNode node, int valueNumber, HeapModel hm) {
|
||||
return getInvariantContents(symbolTable, du, node, valueNumber, hm, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class AnalysisScopeReader {
|
|||
}
|
||||
|
||||
|
||||
protected static AnalysisScope read(AnalysisScope scope, String scopeFileName, File exclusionsFile, ClassLoader javaLoader,
|
||||
public static AnalysisScope read(AnalysisScope scope, String scopeFileName, File exclusionsFile, ClassLoader javaLoader,
|
||||
FileProvider fp) throws IOException {
|
||||
BufferedReader r = null;
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
||||
<setAttribute key="additional_plugins">
|
||||
<setEntry value="com.ibm.wala.ide.jdt.test:1.3.4.qualifier:default:true"/>
|
||||
<setEntry value="com.ibm.wala.ide.jdt:1.3.4.qualifier:default:true"/>
|
||||
</setAttribute>
|
||||
<booleanAttribute key="append.args" value="true"/>
|
||||
<booleanAttribute key="askclear" value="false"/>
|
||||
<booleanAttribute key="automaticAdd" value="true"/>
|
||||
<booleanAttribute key="automaticValidate" value="false"/>
|
||||
<stringAttribute key="bootstrap" value=""/>
|
||||
<stringAttribute key="checked" value="[NONE]"/>
|
||||
<booleanAttribute key="clearConfig" value="true"/>
|
||||
<booleanAttribute key="clearws" value="true"/>
|
||||
<booleanAttribute key="clearwslog" value="false"/>
|
||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||
<booleanAttribute key="default" value="false"/>
|
||||
<stringAttribute key="featureDefaultLocation" value="workspace"/>
|
||||
<stringAttribute key="featurePluginResolution" value="workspace"/>
|
||||
<booleanAttribute key="includeOptional" value="true"/>
|
||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.ibm.wala.ide.jdt.test"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.ide.jdt.test"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.ide.jdt.test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
|
||||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
|
||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||
<setAttribute key="selected_features">
|
||||
<setEntry value="com.ibm.wala-feature:default"/>
|
||||
<setEntry value="com.ibm.wala.ide-feature:default"/>
|
||||
<setEntry value="com.ibm.wala.tests-feature:default"/>
|
||||
<setEntry value="com.ibm.wala.tests.ide:default"/>
|
||||
<setEntry value="org.eclipse.e4.rcp:default"/>
|
||||
<setEntry value="org.eclipse.ecf.core.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.core.ssl.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.filetransfer.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.filetransfer.httpclient4.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.filetransfer.httpclient4.ssl.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.filetransfer.ssl.feature:default"/>
|
||||
<setEntry value="org.eclipse.emf.common:default"/>
|
||||
<setEntry value="org.eclipse.emf.ecore:default"/>
|
||||
<setEntry value="org.eclipse.equinox.p2.core.feature:default"/>
|
||||
<setEntry value="org.eclipse.equinox.p2.extras.feature:default"/>
|
||||
<setEntry value="org.eclipse.equinox.p2.rcp.feature:default"/>
|
||||
<setEntry value="org.eclipse.equinox.p2.user.ui:default"/>
|
||||
<setEntry value="org.eclipse.help:default"/>
|
||||
<setEntry value="org.eclipse.jdt:default"/>
|
||||
<setEntry value="org.eclipse.pde:default"/>
|
||||
<setEntry value="org.eclipse.platform:default"/>
|
||||
<setEntry value="org.eclipse.rcp:default"/>
|
||||
</setAttribute>
|
||||
<booleanAttribute key="show_selected_only" value="false"/>
|
||||
<booleanAttribute key="tracing" value="false"/>
|
||||
<booleanAttribute key="useCustomFeatures" value="true"/>
|
||||
<booleanAttribute key="useDefaultConfig" value="true"/>
|
||||
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
||||
<booleanAttribute key="useProduct" value="true"/>
|
||||
</launchConfiguration>
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
||||
<setAttribute key="additional_plugins">
|
||||
<setEntry value="com.ibm.wala.ide.jdt.test:1.3.4.qualifier:default:true"/>
|
||||
<setEntry value="com.ibm.wala.ide.jdt:1.3.4.qualifier:default:true"/>
|
||||
</setAttribute>
|
||||
<booleanAttribute key="append.args" value="true"/>
|
||||
<booleanAttribute key="askclear" value="false"/>
|
||||
<booleanAttribute key="automaticAdd" value="true"/>
|
||||
<booleanAttribute key="automaticValidate" value="false"/>
|
||||
<stringAttribute key="bootstrap" value=""/>
|
||||
<stringAttribute key="checked" value="[NONE]"/>
|
||||
<booleanAttribute key="clearConfig" value="true"/>
|
||||
<booleanAttribute key="clearws" value="true"/>
|
||||
<booleanAttribute key="clearwslog" value="false"/>
|
||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||
<booleanAttribute key="default" value="false"/>
|
||||
<stringAttribute key="featureDefaultLocation" value="workspace"/>
|
||||
<stringAttribute key="featurePluginResolution" value="workspace"/>
|
||||
<booleanAttribute key="includeOptional" value="true"/>
|
||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.ibm.wala.ide.jdt.test"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="/tmp/jdt.out"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.ide.jdt.test"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.ide.jdt.test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
|
||||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
|
||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||
<setAttribute key="selected_features">
|
||||
<setEntry value="com.ibm.wala-feature:default"/>
|
||||
<setEntry value="com.ibm.wala.ide-feature:default"/>
|
||||
<setEntry value="com.ibm.wala.tests-feature:default"/>
|
||||
<setEntry value="com.ibm.wala.tests.ide:default"/>
|
||||
<setEntry value="org.eclipse.e4.rcp:default"/>
|
||||
<setEntry value="org.eclipse.ecf.core.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.core.ssl.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.filetransfer.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.filetransfer.httpclient4.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.filetransfer.httpclient4.ssl.feature:default"/>
|
||||
<setEntry value="org.eclipse.ecf.filetransfer.ssl.feature:default"/>
|
||||
<setEntry value="org.eclipse.emf.common:default"/>
|
||||
<setEntry value="org.eclipse.emf.ecore:default"/>
|
||||
<setEntry value="org.eclipse.equinox.p2.core.feature:default"/>
|
||||
<setEntry value="org.eclipse.equinox.p2.extras.feature:default"/>
|
||||
<setEntry value="org.eclipse.equinox.p2.rcp.feature:default"/>
|
||||
<setEntry value="org.eclipse.equinox.p2.user.ui:default"/>
|
||||
<setEntry value="org.eclipse.help:default"/>
|
||||
<setEntry value="org.eclipse.jdt:default"/>
|
||||
<setEntry value="org.eclipse.pde:default"/>
|
||||
<setEntry value="org.eclipse.platform:default"/>
|
||||
<setEntry value="org.eclipse.rcp:default"/>
|
||||
</setAttribute>
|
||||
<booleanAttribute key="show_selected_only" value="false"/>
|
||||
<booleanAttribute key="tracing" value="false"/>
|
||||
<booleanAttribute key="useCustomFeatures" value="true"/>
|
||||
<booleanAttribute key="useDefaultConfig" value="true"/>
|
||||
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
||||
<booleanAttribute key="useProduct" value="true"/>
|
||||
</launchConfiguration>
|
Loading…
Reference in New Issue