remove custom change markers for code that will be merged to main branch

This commit is contained in:
Juergen Graf 2014-07-31 13:10:47 +02:00
parent 7769c5b126
commit c05415720e
16 changed files with 42 additions and 105 deletions

View File

@ -188,11 +188,9 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
while (instructions[j] instanceof SSAPhiInstruction) {
b.addPhi((SSAPhiInstruction) instructions[j]);
j++;
/** BEGIN Custom change */
if (j >= instructions.length) {
break;
}
/** END Custom change */
}
if (DEBUG) {
@ -244,14 +242,12 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
@Override
public void visitGoto(SSAGotoInstruction instruction) {
/** BEGIN Custom change */
System.err.println("Breaking Basic block after instruction " + instruction + " index " + index);
breakBasicBlock(index); // Breaks __after__ the GoTo-Instruction
final int jumpTarget = getIndexFromIIndex(instruction.getTarget());
assert(instructions[jumpTarget] != null) : "GoTo cant go to null";
System.err.println("Breaking Basic block before instruction " + instructions[jumpTarget] + " index " + jumpTarget + " -1");
breakBasicBlock(jumpTarget - 1); // Breaks __before__ the target
/** END Custom change */
if (DEBUG) { System.err.println("Breaking Basic block after instruction " + instruction + " index " + index); }
breakBasicBlock(index); // Breaks __after__ the GoTo-Instruction
final int jumpTarget = getIndexFromIIndex(instruction.getTarget());
assert(instructions[jumpTarget] != null) : "GoTo cant go to null";
if (DEBUG) { System.err.println("Breaking Basic block before instruction " + instructions[jumpTarget] + " index " + jumpTarget + " -1"); }
breakBasicBlock(jumpTarget - 1); // Breaks __before__ the target
}
@Override
@ -439,12 +435,10 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
*/
private void addExceptionalEdges(SSAInstruction last) {
if (last == null) {
/** BEGIN Custom change */
// XXX: Bug here?
// throw new IllegalStateException("Missing last SSA-Instruction in basic block (null)."); // XXX: When does this happen?
System.err.println("Missing last SSA-Instruction in basic block (null).");
return;
/** END Custom change */
// XXX: Bug here?
// throw new IllegalStateException("Missing last SSA-Instruction in basic block (null)."); // XXX: When does this happen?
System.err.println("Missing last SSA-Instruction in basic block (null).");
return;
}
if (last.isPEI()) {
// we don't currently model catch blocks here ... instead just link
@ -470,7 +464,6 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
SSAInstruction last = getInstructions()[getLastInstructionIndex()];
addExceptionalEdges(last);
/** BEGIN Custom change: Add GoTo Instruction */
if (last instanceof SSAGotoInstruction) {
int tgt = ((SSAGotoInstruction)last).getTarget();
@ -498,7 +491,6 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
addNormalEdgeTo(target);
}
}
/** END Custom change: Add GoTo Instruction */
int normalSuccNodeNumber = getGraphNodeId() + 1;
if (last.isFallThrough()) {
@ -663,7 +655,6 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
}
}
/** BEGIN Custom change: Needed for GoTo Instruction */
/**
* Get the position of a instruction with a given iindex in the internal list.
*
@ -703,7 +694,6 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
throw new IllegalStateException("The searched iindex (" + iindex + ") does not exist! In " +
getMethod() + ", Contenxt: " + this.context);
}
/** END Custom change: Needed for GoTo Instruction */
public Collection<SSAPhiInstruction> getAllPhiInstructions() {
Collection<SSAPhiInstruction> result = HashSetFactory.make();

View File

@ -338,7 +338,6 @@ public abstract class AbstractRootMethod extends SyntheticMethod {
return lv;
}
/** BEGIN Custom change: advanced synthetic instructions */
public void addSetInstance(final FieldReference ref, final int baseObject, final int value) {
statements.add(insts.PutInstruction(statements.size(), baseObject, value, ref));
}
@ -356,7 +355,7 @@ public abstract class AbstractRootMethod extends SyntheticMethod {
statements.add(insts.ArrayLoadInstruction(statements.size(), result, baseObject, indexValue, elementType));
return result;
}
/** END Custom change: advanced synthetic instructions */
public RTAContextInterpreter getInterpreter() {
return new RTAContextInterpreter() {

View File

@ -106,12 +106,9 @@ public class Util {
InputStream s = cl.getResourceAsStream(xmlFile);
XMLMethodSummaryReader summary = new XMLMethodSummaryReader(s, scope);
/** BEGIN Custom change: load xml from file system as a fallback */
addBypassLogic(options, scope, cl, summary, cha);
/** END Custom change: load xml from file system as a fallback */
}
/** BEGIN Custom change: load xml from file system as a fallback */
public static void addBypassLogic(AnalysisOptions options, AnalysisScope scope, ClassLoader cl, XMLMethodSummaryReader summary,
IClassHierarchy cha) throws IllegalArgumentException {
if (scope == null) {
@ -136,7 +133,6 @@ public class Util {
options.setSelector(cs);
}
/** END Custom change: load xml from file system as a fallback */
/**
* @param scope
* @param cha
@ -538,12 +534,9 @@ public class Util {
}
public static void addDefaultBypassLogic(AnalysisOptions options, AnalysisScope scope, ClassLoader cl, IClassHierarchy cha) {
/** BEGIN Custom change: load xml from file system as a fallback */
if (nativeSpec == null) return;
if (cl.getResourceAsStream(nativeSpec) != null) {
/** END Custom change: load xml from file system as fallback */
addBypassLogic(options, scope, cl, nativeSpec, cha);
/** BEGIN Custom change: load xml from file system as a fallback */
} else {
// try to load from filesystem
try {
@ -555,7 +548,6 @@ public class Util {
e.printStackTrace();
}
}
/** END Custom change: load xml from file system as fallback */
}
}

View File

@ -254,7 +254,7 @@ public class PropagationSystem extends DefaultFixedPointSolver<PointsToSetVariab
* @param key
* @return the dataflow variable that tracks the points-to set for key
*/
public PointsToSetVariable findOrCreatePointsToSet(final PointerKey key) {
public PointsToSetVariable findOrCreatePointsToSet(PointerKey key) {
if (key == null) {
throw new IllegalArgumentException("null key");
@ -282,6 +282,12 @@ public class PropagationSystem extends DefaultFixedPointSolver<PointsToSetVariab
pk = key;
}
FilteredPointerKey fpk = (FilteredPointerKey) pk;
if (fpk == null) {
Assertions.UNREACHABLE("fpk is null");
}
if (key == null) {
Assertions.UNREACHABLE("key is null");
}
if (fpk.getTypeFilter() == null) {
Assertions.UNREACHABLE("fpk.getTypeFilter() is null");
}

View File

@ -166,13 +166,11 @@ public class TypeBasedPointerAnalysis extends AbstractPointerAnalysis {
FilteredPointerKey.TypeFilter filter = i.getTypeFilter();
assert filter instanceof FilteredPointerKey.SingleClassFilter;
return ((FilteredPointerKey.SingleClassFilter) filter).getConcreteType();
/** BEGIN Custom change: search matching return value keys */
} else if (key instanceof ExceptionReturnValueKey) {
return getCallGraph().getClassHierarchy().lookupClass(TypeReference.JavaLangException);
} else if (key instanceof ReturnValueKey) {
ReturnValueKey r = (ReturnValueKey) key;
return getCallGraph().getClassHierarchy().lookupClass(r.getNode().getMethod().getReturnType());
/** END Custom change: search matching return value keys */
} else {
Assertions.UNREACHABLE("inferType " + key.getClass());
return null;

View File

@ -108,13 +108,7 @@ public class BypassMethodTargetSelector implements MethodTargetSelector {
}
// first, see if we'd like to bypass the CHA-based target for the site
MethodReference ref = site.getDeclaredTarget();
IMethod chaTarget;
try {
chaTarget = chaMethodTargetSelector.getCalleeTarget(caller, site, dispatchType);
} catch (IllegalArgumentException e) {
System.err.println("Context: " + caller.getContext() + " CallerMethod: " + caller.getMethod() + " site: " + site);
throw e;
}
IMethod chaTarget = chaMethodTargetSelector.getCalleeTarget(caller, site, dispatchType);
IMethod target = (chaTarget == null) ? findOrCreateSyntheticMethod(ref, site.isStatic()) : findOrCreateSyntheticMethod(chaTarget,
site.isStatic());

View File

@ -117,9 +117,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
private final static int E_CONSTANT = 14;
/** BEGIN Custom change: Support also array-load instructions */
private final static int E_AALOAD = 15;
/** END Custom change: Support also array-load instructions */
private final static Map<String, Integer> elementMap = HashMapFactory.make(14);
static {
@ -138,9 +136,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
elementMap.put("getfield", new Integer(E_GETFIELD));
elementMap.put("throw", new Integer(E_ATHROW));
elementMap.put("constant", new Integer(E_CONSTANT));
/** BEGIN Custom change: Support also array-load instructions */
elementMap.put("aaload", new Integer(E_AALOAD));
/** END Custom change: Support also array-load instructions */
}
//
@ -336,11 +332,9 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
case E_AASTORE:
processAastore(atts);
break;
/** BEGIN Custom change: Support also array-load instructions */
case E_AALOAD:
processAaload(atts);
break;
/** END Custom change: Support also array-load instructions */
case E_RETURN:
processReturn(atts);
break;
@ -400,9 +394,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
case E_POISON:
case E_PUTSTATIC:
case E_PUTFIELD:
/** BEGIN Custom change: Support also array-load instructions */
case E_AALOAD:
/** END Custom change: Support also array-load instructions */
case E_AASTORE:
case E_ATHROW:
case E_SUMMARY_SPEC:
@ -729,7 +721,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
TypeReference.JavaLangObject);
governingMethod.addStatement(S);
}
/** BEGIN Custom change: Support also array-load instructions */
/**
* Process an element indicating an Aaload
*
@ -754,7 +746,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
Assertions.UNREACHABLE("Must specify index for aaload " + governingMethod);
}
// get the value def'fed
// get the value def'fed
String defVar = atts.getValue(A_DEF);
if (symbolTable.keySet().contains(defVar)) {
Assertions.UNREACHABLE("Cannot def variable twice: " + defVar + " in " + governingMethod);
@ -768,7 +760,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
TypeReference.JavaLangObject);
governingMethod.addStatement(S);
}
/** END Custom change: Support also array-load instructions */
/**
* Process an element indicating a return statement.
*

View File

@ -121,7 +121,6 @@ public final class WalaProperties {
}
final InputStream propertyStream = loader.getResourceAsStream(fileName);
if (propertyStream == null) {
/** BEGIN Custom change: create default properties if no file exists */
// create default properties
Properties defprop = new Properties();
defprop.setProperty(OUTPUT_DIR, "./out");
@ -133,7 +132,6 @@ public final class WalaProperties {
defprop.setProperty(J2SE_DIR, j2selib);
return defprop;
/** END Custom change: create default properties if no file exists */
}
Properties result = new Properties();
result.load(propertyStream);
@ -145,7 +143,6 @@ public final class WalaProperties {
return result;
}
/** BEGIN Custom change: create default properties if no file exists */
public static String guessJavaLib() throws IOException {
final Properties p = System.getProperties();
final String home = System.getProperty("java.home");
@ -175,7 +172,6 @@ public final class WalaProperties {
}
}
/** END Custom change: create default properties if no file exists */
/**
* @deprecated because when running under eclipse, there may be no such directory.
* Need to handle that case.

View File

@ -449,10 +449,7 @@ public class SSACFG implements ControlFlowGraph<SSAInstruction, ISSABasicBlock>
}
}
/* BEGIN custom change: some parts of dalvik frontend need to call this method, so its
* visibility is changed from default to public */
public SSAPiInstruction getPiForRefAndPath(int n, Object path) {
/* END custom change */
return piInstructions.get(new RefPathKey(n, this, path));
}
@ -464,10 +461,7 @@ public class SSACFG implements ControlFlowGraph<SSAInstruction, ISSABasicBlock>
* @param path can be the successor block in the pi instruction
* @param pi
*/
/* BEGIN custom change: some parts of dalvik frontend need to call this method, so its
* visibility is changed from default to public */
public void addPiForRefAndPath(int n, Object path, SSAPiInstruction pi) {
/* END custom change */
piInstructions.put(new RefPathKey(n, this, path), pi);
blockPiInstructions.add(pi);
}

View File

@ -147,14 +147,12 @@ public class ExplodedControlFlowGraph implements ControlFlowGraph<SSAInstruction
}
if (eb.isEntryBlock() || eb.instructionIndex == eb.original.getLastInstructionIndex()) {
List<IExplodedBasicBlock> result = new ArrayList<IExplodedBasicBlock>();
/** BEGIN Custom change: fix */
ISSABasicBlock orig = eb.original;
if (eb.isEntryBlock() && orig == null) {
orig = ir.getControlFlowGraph().entry();
}
for (ISSABasicBlock s : ir.getControlFlowGraph().getExceptionalSuccessors(orig)) {
/** END Custom change: fix */
if (s.equals(ir.getControlFlowGraph().exit())) {
result.add(exit());
} else {
@ -381,7 +379,6 @@ public class ExplodedControlFlowGraph implements ControlFlowGraph<SSAInstruction
@Override
public boolean hasEdge(IExplodedBasicBlock src, IExplodedBasicBlock dst) throws UnimplementedError {
/** BEGIN Custom change: implement hasEdge */
for (Iterator<IExplodedBasicBlock> it = getSuccNodes(src); it.hasNext();) {
IExplodedBasicBlock succ = it.next();
if (succ == dst) {
@ -390,7 +387,6 @@ public class ExplodedControlFlowGraph implements ControlFlowGraph<SSAInstruction
}
return false;
/** END Custom change: implement hasEdge */
}
@Override

View File

@ -408,7 +408,6 @@ public final class TypeReference implements Serializable {
return findOrCreate(cl, TypeName.string2TypeName(typeName));
}
/** BEGIN Custom change: search types */
public static synchronized TypeReference find(ClassLoaderReference cl, String typeName) {
return find(cl, TypeName.string2TypeName(typeName));
}
@ -419,7 +418,6 @@ public final class TypeReference implements Serializable {
* @param cl the classloader (defining/initiating depending on usage)
*/
public static synchronized TypeReference find(ClassLoaderReference cl, TypeName typeName) {
if (cl == null) {
throw new IllegalArgumentException("null cl");
}
@ -442,7 +440,7 @@ public final class TypeReference implements Serializable {
return val;
}
/** END Custom change: search types */
public static TypeReference findOrCreateArrayOf(TypeReference t) {
if (t == null) {
throw new IllegalArgumentException("t is null");

View File

@ -100,7 +100,6 @@ public class AnalysisScopeReader {
return scope;
}
/** BEGIN Custom change: Fixes in AndroidAnalysisScope */
protected static AnalysisScope read(AnalysisScope scope, final URI scopeFileURI, final File exclusionsFile, ClassLoader javaLoader,
FileProvider fp) throws IOException {
BufferedReader r = null;
@ -136,7 +135,6 @@ public class AnalysisScopeReader {
return scope;
}
/** END Custom change: Fixes in AndroidAnalysisScope */
public static void processScopeDefLine(AnalysisScope scope, ClassLoader javaLoader, String line) throws IOException {
if (line == null) {

View File

@ -23,7 +23,6 @@ public class FileSuffixes {
private static final String WAR_SUFFIX = ".war";
/** BEGIN Custom change: Fixes in AndroidAnalysisScope */
private static final String DEX_SUFFIX = ".dex";
private static final String APK_SUFFIX = ".apk";
@ -36,19 +35,19 @@ public class FileSuffixes {
*/
public static boolean isDexFile(final URI uri) {
if (uri == null) {
throw new IllegalArgumentException("uri is null");
throw new IllegalArgumentException("uri is null");
}
if (uri.toString().startsWith("jar:")) {
try {
final String filePart = uri.toURL().getFile().toLowerCase();
return isDexFile(filePart);
} catch (java.net.MalformedURLException e) {
throw new IllegalArgumentException(e);
}
try {
final String filePart = uri.toURL().getFile().toLowerCase();
return isDexFile(filePart);
} catch (java.net.MalformedURLException e) {
throw new IllegalArgumentException(e);
}
} else {
assert (uri.getPath() != null);
return isDexFile(uri.getPath());
assert (uri.getPath() != null);
return isDexFile(uri.getPath());
}
}
@ -80,7 +79,6 @@ public class FileSuffixes {
}
return fileName.toLowerCase().endsWith(APK_SUFFIX);
}
/** END Custom change: Fixes in AndroidAnalysisScope */
/**
* Does the file name represent a .class file?
@ -159,12 +157,10 @@ public class FileSuffixes {
}
}
/** BEGIN Custom change: Fixes in AndroidAnalysisScope */
/**
* Does the URI point to a ressource in a jar-file
*/
public static boolean isRessourceFromJar(final URI uri) {
return uri.toString().startsWith("jar:"); // How Pretty
}
/** END Custom change: Fixes in AndroidAnalysisScope */
/**
* Does the URI point to a ressource in a jar-file
*/
public static boolean isRessourceFromJar(final URI uri) {
return uri.toString().startsWith("jar:"); // How Pretty
}
}

View File

@ -156,7 +156,6 @@ public final class Atom implements Serializable {
return UTF8Convert.fromUTF8(val);
}
/** BEGIN Custom change: Handy helper functions */
/**
* New Atom containing first count bytes
*/
@ -181,7 +180,6 @@ public final class Atom implements Serializable {
return true;
}
/** END Custom change: Handy helper functions */
/**
* Return array descriptor corresponding to "this" array-element descriptor. this: array-element descriptor - something like "I"
@ -421,7 +419,6 @@ public final class Atom implements Serializable {
return false;
}
/** BEGIN Custom change: Handy helper functions */
public int rIndex(byte b) {
for (int i = val.length - 1; i >=0; --i) {
if (val[i] == b) {
@ -430,7 +427,6 @@ public final class Atom implements Serializable {
}
return -1;
}
/** END Custom change: Handy helper functions */
private static Atom concat(byte c, byte[] bs) {
byte[] val = new byte[bs.length + 1];
@ -446,15 +442,11 @@ public final class Atom implements Serializable {
return concat(c, b.b);
}
/** BEGIN Custom change: Handy helper functions */
public static Atom concat(Atom a, Atom b) {
if ((a == null ) || (b == null)) {
public static Atom concat(Atom ma, Atom mb) {
if ((ma == null ) || (mb == null)) {
throw new IllegalArgumentException("argument may not be null!");
}
Atom ma = (Atom) a;
Atom mb = (Atom) b;
byte[] val = new byte[ma.val.length + mb.val.length];
System.arraycopy(ma.val, 0, val, 0, ma.val.length);
@ -462,7 +454,6 @@ public final class Atom implements Serializable {
return findOrCreate(val);
}
/** END Custom change: Handy helper functions */
public static boolean isArrayDescriptor(ImmutableByteArray b) {
if (b == null) {

View File

@ -718,9 +718,8 @@ public class StringStuff {
return dotForm.toString();
}
/** BEGIN Custom change: quite handy */
/**
* Rerturn th right potion of the string up to '.' or '/' stripping ';'
* Return the right position of the string up to '.' or '/' stripping ';'
*/
public static String toBasename(String typeName) {
int start = 0;
@ -738,5 +737,4 @@ public class StringStuff {
return typeName.substring(start, stop);
}
/** END Custom change: quite handy */
}

View File

@ -21,10 +21,9 @@ public class MonitorUtil {
* Use this interface to decouple core utilities from the Eclipse layer
*/
public interface IProgressMonitor {
/** BEGIN Custom change */
/** Constant indicating an unknown amount of work. */
public static final int UNKNOWN = -1;
/** END Custom change */
void beginTask(String task, int totalWork);