This commit is contained in:
Juergen Graf 2014-07-30 15:05:15 +02:00
parent 357ac26dee
commit 8f6ec6bc54
10 changed files with 16 additions and 35 deletions

View File

@ -94,7 +94,7 @@ public class JavaScriptModRef extends AstModRef {
protected static class JavaScriptModVisitor extends AstModVisitor implements JSInstructionVisitor {
protected JavaScriptModVisitor(CGNode n, Collection<PointerKey> result, ExtendedHeapModel h, PointerAnalysis pa) {
protected JavaScriptModVisitor(CGNode n, Collection<PointerKey> result, ExtendedHeapModel h, PointerAnalysis<InstanceKey> pa) {
super(n, result, (AstHeapModel)h, pa);
}

View File

@ -141,7 +141,7 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
protected PropagationSystem makeSystem(AnalysisOptions options) {
return new PropagationSystem(callGraph, pointerKeyFactory, instanceKeyFactory) {
@Override
public PointerAnalysis makePointerAnalysis(PropagationCallGraphBuilder builder) {
public PointerAnalysis<InstanceKey> makePointerAnalysis(PropagationCallGraphBuilder builder) {
return new AstPointerAnalysisImpl(builder, cg, pointsToMap, instanceKeys, pointerKeyFactory, instanceKeyFactory);
}
};
@ -613,7 +613,6 @@ public abstract class AstSSAPropagationCallGraphBuilder extends SSAPropagationCa
* {@link AstConstraintVisitor#handleRootLexicalReference(String, String, CGNode)}
* .
*/
@SuppressWarnings("unused")
private void doLexicalPointerKeys(boolean funargsOnly) {
for (int i = 0; i < accesses.length; i++) {
final String name = accesses[i].variableName;

View File

@ -1307,6 +1307,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
SSAConditionalBranchInstruction branch = (SSAConditionalBranchInstruction) inst;
inst = insts.ConditionalBranchInstruction(x, branch.getOperator(), branch.getType(), branch.getUse(0), branch.getUse(1), target);
}
instructions[x++] = inst;
}
}

View File

@ -128,7 +128,7 @@ public class ModRef {
});
}
public ExtendedHeapModel makeHeapModel(PointerAnalysis pa) {
public ExtendedHeapModel makeHeapModel(PointerAnalysis<InstanceKey> pa) {
return new DelegatingExtendedHeapModel(pa.getHeapModel());
}
/**

View File

@ -58,32 +58,26 @@ public class AnalysisScopeReader {
FileProvider fp) throws IOException {
BufferedReader r = null;
try {
/** BEGIN Custom change: try to load from jar as fallback */
// Now reading from jar is included in WALA, but we can't use their version, because they load from
// jar by default and use filesystem as fallback. We want it the other way round. E.g. to deliver default
// configuration files with the jar, but use userprovided ones if present in the working directory.
// InputStream scopeFileInputStream = fp.getInputStreamFromClassLoader(scopeFileName, javaLoader);
File scopeFile = new File(scopeFileName);
/** END Custom change: try to load from jar as fallback */
String line;
// assume the scope file is UTF-8 encoded; ASCII files will also be handled properly
// TODO allow specifying encoding as a parameter?
/** BEGIN Custom change: try to load from jar as fallback */
if (scopeFile.exists()) {
r = new BufferedReader(new InputStreamReader(new FileInputStream(scopeFile), "UTF-8"));
} else {
// try to read from jar
InputStream inFromJar = scope.getClass().getClassLoader().getResourceAsStream(scopeFileName);
/** BEGIN Custom change: Fixes in AndroidAnalysisScope */
if (inFromJar == null) {
throw new IllegalArgumentException("Unable to retreive " + scopeFileName + " from the jar using the loader of " +
scope.getClass());
}
/** END Custom change: Fixes in AndroidAnalysisScope */
r = new BufferedReader(new InputStreamReader(inFromJar));
}
/** END Custom change: try to load from jar as fallback */
while ((line = r.readLine()) != null) {
processScopeDefLine(scope, javaLoader, line);
}

View File

@ -172,7 +172,6 @@ public class FileProvider {
return new NestedJarFileModule(parent, entry);
} else if (url.getProtocol().equals("rsrc")) {
return new ResourceJarFileModule(url);
/** BEGIN Custom change: try to load from input stream as fallback */
} else if (url.getProtocol().equals("file")) {
String filePath = filePathFromURL(url);
return new JarFileModule(new JarFile(filePath, false));
@ -180,7 +179,6 @@ public class FileProvider {
final URLConnection in = url.openConnection();
final JarInputStream jarIn = new JarInputStream(in.getInputStream());
return new JarStreamModule(jarIn);
/** END Custom change: try to load from input stream as fallback */
}
}

View File

@ -26,17 +26,16 @@ public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractV
@Override
public void copyState(T other) {
final IntSetVariable<?> isv = (IntSetVariable<?>) other;
if (V == null) {
if (isv.V == null) {
if (other.V == null) {
return;
} else {
V = IntSetUtil.getDefaultIntSetFactory().makeCopy(isv.V);
V = IntSetUtil.getDefaultIntSetFactory().makeCopy(other.V);
return;
}
} else {
if (isv.V != null) {
V.copySet(isv.V);
if (other.V != null) {
V.copySet(other.V);
}
}
}
@ -62,14 +61,12 @@ public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractV
* @return true iff the contents of this variable changes.
*/
public boolean addAll(T other) {
final IntSetVariable<?> isv = (IntSetVariable<?>) other;
if (V == null) {
copyState(other);
return (V != null);
} else {
if (isv.V != null) {
boolean result = addAll(isv.V);
if (other.V != null) {
boolean result = addAll(other.V);
return result;
} else {
return false;
@ -78,15 +75,13 @@ public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractV
}
public boolean sameValue(IntSetVariable other) {
final IntSetVariable<?> isv = (IntSetVariable<?>) other;
if (V == null) {
return (isv.V == null);
return (other.V == null);
} else {
if (isv.V == null) {
if (other.V == null) {
return false;
} else {
return V.sameValue(isv.V);
return V.sameValue(other.V);
}
}
}
@ -159,10 +154,8 @@ public abstract class IntSetVariable<T extends IntSetVariable> extends AbstractV
}
return (V != null);
} else {
final IntSetVariable<?> isv = (IntSetVariable<?>) other;
if (isv.V != null) {
boolean result = addAllInIntersection(isv.V, filter);
if (other.V != null) {
boolean result = addAllInIntersection(other.V, filter);
return result;
} else {
return false;

View File

@ -28,7 +28,7 @@ public class CollectionFilter<T> implements Filter<T> {
this.S = S;
}
/**
/*
* @see com.ibm.wala.util.Filter#accepts(java.lang.Object)
*/
@Override

View File

@ -103,7 +103,6 @@ public class OrdinalSet<T> implements Iterable<T> {
return new OrdinalSet<T>(isect, A.mapping);
}
/** BEGIN Custom change: equals for OrdinalSets */
/**
* @return true if the contents of two sets are equal
*/
@ -121,7 +120,6 @@ public class OrdinalSet<T> implements Iterable<T> {
return false;
}
/** END Custom change: equals for OrdinalSets */
/**
* Creates the union of two ordinal sets.
*

View File

@ -89,11 +89,9 @@ public class DotUtil {
throw new IllegalArgumentException("g is null");
}
File f = DotUtil.writeDotFile(g, labels, title, dotFile);
/** BEGIN Custom change: spawn exe only when set */
if (dotExe != null) {
spawnDot(dotExe, outputFile, f);
}
/** END Custom change: spawn exe only when set */
}
public static void spawnDot(String dotExe, String outputFile, File dotFile) throws WalaException {