remove dependency from slf4j logger in wala.core project
This commit is contained in:
parent
8f6ec6bc54
commit
7ad38161b1
|
@ -5,6 +5,5 @@
|
|||
<classpathentry kind="src" path="dat"/>
|
||||
<classpathentry kind="src" path="lib"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="lib" path="lib/slf4j-api-1.7.2.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -66,5 +66,4 @@ Export-Package: .,
|
|||
com.ibm.wala.viz.viewer
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Eclipse-BuddyPolicy: registered
|
||||
Bundle-ClassPath: lib/slf4j-api-1.7.2.jar,
|
||||
.
|
||||
Bundle-ClassPath: .
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
bin.includes = lib/primordial.jar.model,\
|
||||
plugin.properties,\
|
||||
bin.includes = plugin.properties,\
|
||||
dat/natives.xml,\
|
||||
META-INF/,\
|
||||
.,\
|
||||
lib/slf4j-api-1.7.2.jar
|
||||
lib/
|
||||
jars.compile.order = .
|
||||
output.. = bin/
|
||||
source.. = dat/,\
|
||||
|
|
Binary file not shown.
|
@ -42,8 +42,6 @@ import com.ibm.wala.util.graph.GraphIntegrity;
|
|||
import com.ibm.wala.util.graph.GraphIntegrity.UnsoundGraphException;
|
||||
import com.ibm.wala.util.graph.impl.NodeWithNumber;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
* A {@link ControlFlowGraph} computed from a set of {@link SSAInstruction} instructions.
|
||||
*
|
||||
|
@ -51,8 +49,8 @@ import org.slf4j.LoggerFactory;
|
|||
* unsuited for flow-sensitive analysis. Someday this should be nuked.
|
||||
*/
|
||||
public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBlock> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(InducedCFG.class);
|
||||
private static final boolean DEBUG = logger.isDebugEnabled() || false;
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
/**
|
||||
* A partial map from Instruction -> BasicBlock
|
||||
|
@ -198,7 +196,7 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
|
|||
}
|
||||
|
||||
if (DEBUG) {
|
||||
logger.debug(("Add basic block " + b.getNumber() + " (starting from " + b.getFirstInstructionIndex() +
|
||||
System.err.println(("Add basic block " + b.getNumber() + " (starting from " + b.getFirstInstructionIndex() +
|
||||
") with instruction " + instructions[i] + " at aIndex " + i));
|
||||
}
|
||||
}
|
||||
|
@ -247,11 +245,11 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
|
|||
@Override
|
||||
public void visitGoto(SSAGotoInstruction instruction) {
|
||||
/** BEGIN Custom change */
|
||||
logger.debug("Breaking Basic block after instruction " + instruction + " index " + index);
|
||||
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";
|
||||
logger.debug("Breaking Basic block before instruction " + instructions[jumpTarget] + " index " + jumpTarget + " -1");
|
||||
System.err.println("Breaking Basic block before instruction " + instructions[jumpTarget] + " index " + jumpTarget + " -1");
|
||||
breakBasicBlock(jumpTarget - 1); // Breaks __before__ the target
|
||||
/** END Custom change */
|
||||
}
|
||||
|
@ -466,8 +464,7 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
|
|||
private void computeOutgoingEdges() {
|
||||
|
||||
if (DEBUG) {
|
||||
//System.err.println(("Block " + this + ": computeOutgoingEdges()"));
|
||||
logger.trace("Block " + this + ": computeOutgoingEdges()");
|
||||
System.err.println("Block " + this + ": computeOutgoingEdges()");
|
||||
}
|
||||
|
||||
SSAInstruction last = getInstructions()[getLastInstructionIndex()];
|
||||
|
@ -475,37 +472,38 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
|
|||
|
||||
/** BEGIN Custom change: Add GoTo Instruction */
|
||||
if (last instanceof SSAGotoInstruction) {
|
||||
int tgt = ((SSAGotoInstruction)last).getTarget();
|
||||
int tgt = ((SSAGotoInstruction)last).getTarget();
|
||||
|
||||
if (tgt != -1) {
|
||||
int tgtNd = getIndexFromIIndex(tgt); // index in instructions-array
|
||||
BasicBlock target = null;
|
||||
if (tgt != -1) {
|
||||
int tgtNd = getIndexFromIIndex(tgt); // index in instructions-array
|
||||
BasicBlock target = null;
|
||||
|
||||
for (Iterator it = InducedCFG.this.iterator(); it.hasNext();) {
|
||||
final BasicBlock candid = (BasicBlock) it.next();
|
||||
if (candid.getFirstInstructionIndex() == tgtNd) {
|
||||
target = candid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (Iterator it = InducedCFG.this.iterator(); it.hasNext();) {
|
||||
final BasicBlock candid = (BasicBlock) it.next();
|
||||
if (candid.getFirstInstructionIndex() == tgtNd) {
|
||||
target = candid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
logger.error("Error retreiving the Node with IIndex " + tgt + " (in array at " + tgtNd + ")");
|
||||
logger.error("The associated Instruction " + instructions[tgtNd] + " does not start a basic block");
|
||||
assert(false); // It will fail anyway
|
||||
}
|
||||
if (target == null) {
|
||||
System.err.println("Error retreiving the Node with IIndex " + tgt + " (in array at " + tgtNd + ")");
|
||||
System.err.println("The associated Instruction " + instructions[tgtNd] + " does not start a basic block");
|
||||
assert(false); // It will fail anyway
|
||||
}
|
||||
|
||||
logger.info("GOTO: Add additional CF " + last.iindex + " to " + tgt + " is node " + target);
|
||||
addNormalEdgeTo(target);
|
||||
}
|
||||
}
|
||||
if (DEBUG) {
|
||||
System.err.println("GOTO: Add additional CF " + last.iindex + " to " + tgt + " is node " + target);
|
||||
}
|
||||
addNormalEdgeTo(target);
|
||||
}
|
||||
}
|
||||
/** END Custom change: Add GoTo Instruction */
|
||||
|
||||
int normalSuccNodeNumber = getGraphNodeId() + 1;
|
||||
if (last.isFallThrough()) {
|
||||
if (DEBUG) {
|
||||
//System.err.println(("Add fallthru to " + getNode(getGraphNodeId() + 1)));
|
||||
logger.trace(("Add fallthru to " + getNode(getGraphNodeId() + 1)));
|
||||
System.err.println(("Add fallthru to " + getNode(getGraphNodeId() + 1)));
|
||||
}
|
||||
addNormalEdgeTo(getNode(normalSuccNodeNumber));
|
||||
}
|
||||
|
@ -675,29 +673,31 @@ public class InducedCFG extends AbstractCFG<SSAInstruction, InducedCFG.BasicBloc
|
|||
*/
|
||||
public int getIndexFromIIndex(int iindex) {
|
||||
if (iindex <= 0) {
|
||||
throw new IllegalArgumentException("The iindex may not be negative (is " + iindex + ". Method: " + getMethod() + ", Contenxt: " + this.context);
|
||||
throw new IllegalArgumentException("The iindex may not be negative (is " + iindex + ". Method: " + getMethod() + ", Contenxt: " + this.context);
|
||||
}
|
||||
|
||||
final SSAInstruction[] instructions = getInstructions();
|
||||
if (instructions == null) {
|
||||
throw new IllegalStateException("This CFG contains no Instructions? " + getMethod() + ", Contenxt: " + this.context);
|
||||
throw new IllegalStateException("This CFG contains no Instructions? " + getMethod() + ", Contenxt: " + this.context);
|
||||
}
|
||||
for (int i=0; i < instructions.length; ++i) {
|
||||
if (instructions[i] == null) {
|
||||
// There are holes in the instructions array ?!
|
||||
// Perhaps from Phi-functions?
|
||||
logger.trace("The " + i +"th instrction is null! Mathod: " + getMethod());
|
||||
if (i > 0) {
|
||||
logger.trace(" Instuction before is: " + instructions[i - 1]);
|
||||
}
|
||||
if (i < instructions.length - 1) {
|
||||
logger.trace(" Instuction after is: " + instructions[i + 1]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (instructions[i].iindex == iindex) {
|
||||
return i;
|
||||
if (instructions[i] == null) {
|
||||
// There are holes in the instructions array ?!
|
||||
// Perhaps from Phi-functions?
|
||||
if (DEBUG) {
|
||||
System.err.println("The " + i +"th instrction is null! Mathod: " + getMethod());
|
||||
if (i > 0) {
|
||||
System.err.println(" Instuction before is: " + instructions[i - 1]);
|
||||
}
|
||||
if (i < instructions.length - 1) {
|
||||
System.err.println(" Instuction after is: " + instructions[i + 1]);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (instructions[i].iindex == iindex) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException("The searched iindex (" + iindex + ") does not exist! In " +
|
||||
|
|
|
@ -52,9 +52,6 @@ import com.ibm.wala.types.TypeReference;
|
|||
import java.util.Map;
|
||||
import com.ibm.wala.util.strings.Atom;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* A SummarizedMethod (for synthetic functions) with variable names.
|
||||
*
|
||||
|
@ -66,8 +63,9 @@ import org.slf4j.LoggerFactory;
|
|||
* @since 2013-11-25
|
||||
*/
|
||||
public class SummarizedMethodWithNames extends SummarizedMethod {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SummarizedMethodWithNames.class);
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private final MethodSummary summary;
|
||||
private final Map<Integer, Atom> localNames;
|
||||
|
||||
|
@ -78,7 +76,7 @@ public class SummarizedMethodWithNames extends SummarizedMethod {
|
|||
this.summary = summary;
|
||||
this.localNames = localNames;
|
||||
|
||||
logger.debug("From old MSUM");
|
||||
if (DEBUG) { System.err.println("From old MSUM"); }
|
||||
}
|
||||
|
||||
public SummarizedMethodWithNames(MethodReference ref, VolatileMethodSummary summary, IClass declaringClass)
|
||||
|
@ -86,15 +84,9 @@ public class SummarizedMethodWithNames extends SummarizedMethod {
|
|||
super(ref, summary.getMethodSummary(), declaringClass);
|
||||
this.summary = summary.getMethodSummary();
|
||||
this.localNames = ((VolatileMethodSummary)summary).getLocalNames();
|
||||
if (this.localNames.isEmpty()) {
|
||||
logger.warn("Local names are empty for " + ref);
|
||||
if (DEBUG && this.localNames.isEmpty()) {
|
||||
System.err.println("Local names are empty for " + ref);
|
||||
}
|
||||
|
||||
/*{ // DEBUG
|
||||
for (final Integer key : this.localNames.keySet()) {
|
||||
logger.debug("Local " + key + " is " + this.localNames.get(key));
|
||||
}
|
||||
} // */
|
||||
}
|
||||
|
||||
public static class SyntheticIRWithNames extends SyntheticIR {
|
||||
|
@ -112,7 +104,7 @@ public class SummarizedMethodWithNames extends SummarizedMethod {
|
|||
*/
|
||||
@Override
|
||||
public String[] getLocalNames(int index, int vn) {
|
||||
logger.debug("IR.getLocalNames({}, {})", index, vn);
|
||||
if (DEBUG) { System.err.printf("IR.getLocalNames({}, {})", index, vn); }
|
||||
if (this.localNames.containsKey(vn)) {
|
||||
return new String[] { this.localNames.get(vn).toString() };
|
||||
} else {
|
||||
|
@ -142,10 +134,10 @@ public class SummarizedMethodWithNames extends SummarizedMethod {
|
|||
public String getLocalVariableName(int bcIndex, int localNumber) {
|
||||
if (this.localNames.containsKey(localNumber)) {
|
||||
String name = this.localNames.get(localNumber).toString();
|
||||
logger.debug("getLocalVariableName(bc={}, no={}) = {}", bcIndex, localNumber, name);
|
||||
if (DEBUG) { System.err.printf("getLocalVariableName(bc={}, no={}) = {}", bcIndex, localNumber, name); }
|
||||
return name;
|
||||
} else {
|
||||
logger.debug("No name for {}", localNumber);
|
||||
if (DEBUG) { System.err.printf("No name for {}", localNumber); }
|
||||
return super.getLocalVariableName(bcIndex, localNumber);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,9 +45,6 @@ import java.util.Map;
|
|||
import java.util.HashMap;
|
||||
import com.ibm.wala.util.strings.Atom;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Instructions can be added in a non-ascending manner.
|
||||
*
|
||||
|
@ -74,8 +71,8 @@ import org.slf4j.LoggerFactory;
|
|||
* @since 2013-09-08
|
||||
*/
|
||||
public class VolatileMethodSummary {
|
||||
private static final Logger logger = LoggerFactory.getLogger(VolatileMethodSummary.class);
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
private boolean allowReservedPC = false;
|
||||
private MethodSummary summary;
|
||||
private List<SSAInstruction> instructions = new ArrayList<SSAInstruction>();
|
||||
|
@ -260,7 +257,7 @@ public class VolatileMethodSummary {
|
|||
|
||||
boolean didOverwrite = isUsed(statement.iindex);
|
||||
while (this.instructions.size() - 1 < statement.iindex) this.instructions.add(null);
|
||||
logger.debug("Setting {} to {}", statement.iindex, statement);
|
||||
if (DEBUG) { System.err.printf("Setting {} to {}", statement.iindex, statement); }
|
||||
this.instructions.set(statement.iindex, statement);
|
||||
return didOverwrite;
|
||||
}
|
||||
|
@ -286,10 +283,10 @@ public class VolatileMethodSummary {
|
|||
final SSAInstruction inst = this.instructions.get(i);
|
||||
|
||||
if ((inst == null) || (inst == RESERVED)) {
|
||||
logger.warn("No instruction at iindex {}", i);
|
||||
if (DEBUG) { System.err.printf("No instruction at iindex {}", i); }
|
||||
} else {
|
||||
logger.debug("Adding @{}: ", inst);
|
||||
this.summary.addStatement(inst);
|
||||
if (DEBUG) { System.err.printf("Adding @{}: ", inst); }
|
||||
this.summary.addStatement(inst);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,34 +31,23 @@
|
|||
*/
|
||||
package com.ibm.wala.util.ssa;
|
||||
|
||||
import com.ibm.wala.types.TypeReference;
|
||||
import com.ibm.wala.types.TypeName;
|
||||
import com.ibm.wala.types.MethodReference;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.types.Selector;
|
||||
import com.ibm.wala.util.PrimitiveAssignability;
|
||||
import com.ibm.wala.util.ssa.ClassLookupException;
|
||||
import com.ibm.wala.util.ssa.IInstantiator;
|
||||
import com.ibm.wala.util.ssa.SSAValue;
|
||||
import com.ibm.wala.util.ssa.SSAValue.NamedKey;
|
||||
import com.ibm.wala.util.ssa.SSAValue.VariableKey;
|
||||
import com.ibm.wala.util.ssa.SSAValue.WeaklyNamedKey;
|
||||
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.classLoader.IClassLoader;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.ibm.wala.util.debug.Assertions;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IClassLoader;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||
import com.ibm.wala.types.MethodReference;
|
||||
import com.ibm.wala.types.Selector;
|
||||
import com.ibm.wala.types.TypeName;
|
||||
import com.ibm.wala.types.TypeReference;
|
||||
import com.ibm.wala.util.PrimitiveAssignability;
|
||||
import com.ibm.wala.util.ssa.SSAValue.WeaklyNamedKey;
|
||||
|
||||
/**
|
||||
* Access parameters without confusion on their numbers.
|
||||
|
@ -80,9 +69,10 @@ import org.slf4j.LoggerFactory;
|
|||
* @author Tobias Blaschke <code@tobiasblaschke.de>
|
||||
* @since 2013-10-19
|
||||
*/
|
||||
public class ParameterAccessor { // extends Param-Manager
|
||||
private static final Logger logger = LoggerFactory.getLogger(ParameterAccessor.class);
|
||||
public class ParameterAccessor {
|
||||
|
||||
private final static boolean DEBUG = false;
|
||||
|
||||
/**
|
||||
* The Constructor used to create ParameterAccessor influences the parameter-offset.
|
||||
*
|
||||
|
@ -310,7 +300,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
final boolean hasImplicitThis;
|
||||
Set<IMethod> targets = cha.getPossibleTargets(mRef);
|
||||
if (targets.size() < 1) {
|
||||
logger.warn("Unable to look up the method {} starting extensive search...", mRef);
|
||||
warn("Unable to look up the method {} starting extensive search...", mRef);
|
||||
|
||||
targets = new HashSet<IMethod>();
|
||||
final TypeReference mClass = mRef.getDeclaringClass();
|
||||
|
@ -330,11 +320,11 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
final IClass lookedUp;
|
||||
lookedUp = cha.lookupClass(mClass);
|
||||
if (lookedUp != null) {
|
||||
logger.debug("Found using cha.lookupClass()");
|
||||
debug("Found using cha.lookupClass()");
|
||||
testClasses.add(lookedUp);
|
||||
}
|
||||
|
||||
logger.info("Searching the classes {} for the method", testClasses);
|
||||
info("Searching the classes {} for the method", testClasses);
|
||||
|
||||
for (IClass testClass : testClasses) {
|
||||
final IMethod cand = testClass.getMethod(mSel);
|
||||
|
@ -345,16 +335,16 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
|
||||
if (targets.size() < 1) {
|
||||
logger.warn("Still no candidates for the method - continuing with super-classes (TODO)");
|
||||
warn("Still no candidates for the method - continuing with super-classes (TODO)");
|
||||
|
||||
// TODO
|
||||
|
||||
{ // DEBUG
|
||||
for (IClass testClass : testClasses) {
|
||||
logger.info("Known Methods in " + testClass);
|
||||
info("Known Methods in " + testClass);
|
||||
for (IMethod contained : testClass.getAllMethods()) {
|
||||
System.out.println(contained);
|
||||
logger.info("\t" + contained);
|
||||
info("\t" + contained);
|
||||
}
|
||||
}
|
||||
} // */
|
||||
|
@ -377,11 +367,11 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
|
||||
if (hasImplicitThis) {
|
||||
logger.info("The method {} has an implicit this pointer", mRef);
|
||||
info("The method {} has an implicit this pointer", mRef);
|
||||
this.implicitThis = 1;
|
||||
this.descriptorOffset = -1;
|
||||
} else {
|
||||
logger.info("The method {} has no implicit this pointer", mRef);
|
||||
info("The method {} has no implicit this pointer", mRef);
|
||||
this.implicitThis = -1;
|
||||
this.descriptorOffset = 0;
|
||||
}
|
||||
|
@ -407,11 +397,11 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
this.numberOfParameters = mRef.getNumberOfParameters();
|
||||
|
||||
if (hasImplicitThis) {
|
||||
logger.info("The method {} has an implicit this pointer", mRef);
|
||||
info("The method {} has an implicit this pointer", mRef);
|
||||
this.implicitThis = 1;
|
||||
this.descriptorOffset = -1;
|
||||
} else {
|
||||
logger.info("The method {} has no implicit this pointer", mRef);
|
||||
info("The method {} has no implicit this pointer", mRef);
|
||||
this.implicitThis = -1;
|
||||
this.descriptorOffset = 0;
|
||||
}
|
||||
|
@ -543,7 +533,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
{
|
||||
final int firstInSelector = firstInSelector();
|
||||
for (int i = ((hasImplicitThis())?1:0); i < this.method.getNumberOfParameters(); ++i) {
|
||||
logger.debug("all() adding: Parameter({}, {}, {}, {}, {})", (i + 1), this.method.getParameterType(i),
|
||||
debug("all() adding: Parameter({}, {}, {}, {}, {})", (i + 1), this.method.getParameterType(i),
|
||||
this.base, this.method, this.descriptorOffset);
|
||||
all.add(new Parameter(i + 1, null, this.method.getParameterType(i), ParamerterDisposition.PARAM,
|
||||
this.base, this.method.getReference(), this.descriptorOffset));
|
||||
|
@ -719,18 +709,18 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
switch (this.base) {
|
||||
case IMETHOD:
|
||||
if (this.hasImplicitThis()) { // XXX TODO BUG!
|
||||
logger.debug("This IMethod {} has an implicit this pointer at {}, so firstInSelector is accessible using SSA-Value {}", this.method, this.implicitThis, (this.implicitThis + 1));
|
||||
debug("This IMethod {} has an implicit this pointer at {}, so firstInSelector is accessible using SSA-Value {}", this.method, this.implicitThis, (this.implicitThis + 1));
|
||||
return this.implicitThis + 1;
|
||||
} else {
|
||||
logger.debug("This IMethod {} has no implicit this pointer, so firstInSelector is accessible using SSA-Value 1" , this.method);
|
||||
debug("This IMethod {} has no implicit this pointer, so firstInSelector is accessible using SSA-Value 1" , this.method);
|
||||
return 1;
|
||||
}
|
||||
case METHOD_REFERENCE:
|
||||
if (this.hasImplicitThis()) {
|
||||
logger.debug("This IMethod {} has an implicit this pointer at {}, so firstInSelector is accessible using SSA-Value {}", this.mRef, this.implicitThis, (this.implicitThis + 1));
|
||||
debug("This IMethod {} has an implicit this pointer at {}, so firstInSelector is accessible using SSA-Value {}", this.mRef, this.implicitThis, (this.implicitThis + 1));
|
||||
return this.implicitThis + 1;
|
||||
} else {
|
||||
logger.debug("This mRef {} has no implicit this pointer, so firstInSelector is accessible using SSA-Value 1", this.mRef);
|
||||
debug("This mRef {} has no implicit this pointer, so firstInSelector is accessible using SSA-Value 1", this.mRef);
|
||||
return 1;
|
||||
}
|
||||
default:
|
||||
|
@ -857,7 +847,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
if (searchType == null) {
|
||||
throw new IllegalStateException("Could not find " + tName + " in any loader!");
|
||||
} else {
|
||||
logger.debug("Retrieved {} as {}", tName, searchType);
|
||||
debug("Retrieved {} as {}", tName, searchType);
|
||||
}
|
||||
|
||||
for (final Parameter cand : all) {
|
||||
|
@ -871,7 +861,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
for (final IClassLoader loader: cha.getLoaders()) {
|
||||
final IClass c = loader.lookupClass(cand.getType().getName());
|
||||
if (c != null) {
|
||||
logger.info("Using alternative for from: {}", cand);
|
||||
info("Using alternative for from: {}", cand);
|
||||
if (cha.isSubclassOf(c, searchType)) {
|
||||
allExctends.add(cand);
|
||||
}
|
||||
|
@ -879,7 +869,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
|
||||
// TODO: That's true for base-type too
|
||||
logger.warn("Unable to look up IClass of {}", cand);
|
||||
warn("Unable to look up IClass of {}", cand);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -912,7 +902,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
if (searchType == null) {
|
||||
throw new IllegalStateException("Could not find the IClass of " + tRef);
|
||||
} else {
|
||||
logger.debug("Reteived {} as {}", tRef, searchType);
|
||||
debug("Reteived {} as {}", tRef, searchType);
|
||||
}
|
||||
|
||||
for (final Parameter cand : all) {
|
||||
|
@ -924,7 +914,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
} else {
|
||||
// TODO: That's true for base-type too
|
||||
logger.warn("Unable to look up IClass of {}", cand);
|
||||
warn("Unable to look up IClass of {}", cand);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -971,7 +961,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
if (searchType == null) {
|
||||
throw new IllegalStateException("Could not find " + tName + " in any loader!");
|
||||
} else {
|
||||
logger.debug("Reteived {} as {}", tName, searchType);
|
||||
debug("Reteived {} as {}", tName, searchType);
|
||||
}
|
||||
|
||||
for (final Parameter cand : all) {
|
||||
|
@ -985,7 +975,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
for (final IClassLoader loader: cha.getLoaders()) {
|
||||
final IClass c = loader.lookupClass(cand.getType().getName());
|
||||
if (c != null) {
|
||||
logger.info("Using alternative for from: {}", cand);
|
||||
info("Using alternative for from: {}", cand);
|
||||
if (cha.isSubclassOf(c, searchType)) {
|
||||
return cand;
|
||||
}
|
||||
|
@ -993,7 +983,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
|
||||
// TODO: That's true for primitive-type too
|
||||
logger.warn("Unable to look up IClass of {}", cand);
|
||||
warn("Unable to look up IClass of {}", cand);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1016,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
if (searchType == null) {
|
||||
throw new IllegalStateException("Could not find the IClass of " + tRef);
|
||||
} else {
|
||||
logger.debug("Reteived {} as {}", tRef, searchType);
|
||||
debug("Reteived {} as {}", tRef, searchType);
|
||||
}
|
||||
|
||||
for (final Parameter cand : all) {
|
||||
|
@ -1038,7 +1028,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
} else {
|
||||
// TODO: That's true for base-type too
|
||||
logger.warn("Unable to look up IClass of {}", cand);
|
||||
warn("Unable to look up IClass of {}", cand);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1070,7 +1060,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
|
||||
if ((args.get(1) instanceof Parameter) && (((Parameter)args.get(1)).getDisposition() == ParamerterDisposition.THIS)) {
|
||||
logger.warn("The first argument is an implicit this: {} this may be ok however.", args.get(1));
|
||||
warn("The first argument is an implicit this: {} this may be ok however.", args.get(1));
|
||||
}
|
||||
|
||||
// ****
|
||||
|
@ -1115,7 +1105,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
|
||||
if ((args.get(1) instanceof Parameter) && (((Parameter)args.get(1)).getDisposition() == ParamerterDisposition.THIS)) {
|
||||
logger.warn("The first argument is an implicit this: {} this may be ok however.", args.get(1));
|
||||
warn("The first argument is an implicit this: {} this may be ok however.", args.get(1));
|
||||
}
|
||||
|
||||
// ****
|
||||
|
@ -1167,7 +1157,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
int[] params = new int[args.size() + 1];
|
||||
if ((params.length > 1) && (args.get(1) instanceof Parameter) && (((Parameter)args.get(1)).getDisposition() ==
|
||||
ParamerterDisposition.THIS)) {
|
||||
logger.warn("The first argument is an implicit this: {} this may be ok however.", args.get(1));
|
||||
warn("The first argument is an implicit this: {} this may be ok however.", args.get(1));
|
||||
}
|
||||
|
||||
// ****
|
||||
|
@ -1218,7 +1208,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
int[] params = new int[args.size() + 1];
|
||||
if ((params.length > 1) && (args.get(1) instanceof Parameter) && (((Parameter)args.get(1)).getDisposition() ==
|
||||
ParamerterDisposition.THIS)) {
|
||||
logger.warn("The first argument is an implicit this: {} this may be ok however.", args.get(1));
|
||||
warn("The first argument is an implicit this: {} this may be ok however.", args.get(1));
|
||||
}
|
||||
|
||||
// ****
|
||||
|
@ -1289,21 +1279,21 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
|
||||
// ****
|
||||
// Implementation starts here
|
||||
logger.debug("Collecting parameters for callee {}", ((callee.mRef!=null)?callee.mRef:callee.method));
|
||||
logger.debug("\tThe calling function is {}", ((this.mRef!=null)?this.mRef:this.method));
|
||||
debug("Collecting parameters for callee {}", ((callee.mRef!=null)?callee.mRef:callee.method));
|
||||
debug("\tThe calling function is {}", ((this.mRef!=null)?this.mRef:this.method));
|
||||
forEachParameter:
|
||||
for (final Parameter param : calleeParams) {
|
||||
logger.debug("\tSearching candidate for {}", param);
|
||||
debug("\tSearching candidate for {}", param);
|
||||
final TypeReference paramType = param.getType();
|
||||
|
||||
{ // Exact match in overrides
|
||||
for (final SSAValue cand : overrides) {
|
||||
if (cand.getType().getName().equals(paramType.getName())) { // XXX: What about the loader?
|
||||
assigned.add(cand);
|
||||
logger.debug("\t\tAsigning: {} from the overrides (eq)", cand);
|
||||
debug("\t\tAsigning: {} from the overrides (eq)", cand);
|
||||
continue forEachParameter;
|
||||
} else {
|
||||
logger.debug("\t\tSkipping: {} of the overrides (eq)", cand);
|
||||
debug("\t\tSkipping: {} of the overrides (eq)", cand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1312,10 +1302,10 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
for (final Parameter cand : thisParams) {
|
||||
if (cand.getType().getName().equals(paramType.getName())) {
|
||||
assigned.add(cand);
|
||||
logger.debug("\t\tAsigning: {} from callers params (eq)", cand);
|
||||
debug("\t\tAsigning: {} from callers params (eq)", cand);
|
||||
continue forEachParameter;
|
||||
} else {
|
||||
logger.debug("\t\tSkipping: {} of the callers params (eq)", cand);
|
||||
debug("\t\tSkipping: {} of the callers params (eq)", cand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1324,13 +1314,13 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
for (final SSAValue cand : defaults) {
|
||||
if (cand.getType().getName().equals(paramType.getName())) {
|
||||
assigned.add(cand);
|
||||
logger.debug("\t\tAsigning: {} from the defaults (eq)", cand);
|
||||
debug("\t\tAsigning: {} from the defaults (eq)", cand);
|
||||
continue forEachParameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("\tThe parameter is still not found - try again using an assignability check...");
|
||||
debug("\tThe parameter is still not found - try again using an assignability check...");
|
||||
|
||||
// If we got here we need cha
|
||||
if (cha != null) {
|
||||
|
@ -1339,7 +1329,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
for (final SSAValue cand : overrides) {
|
||||
if (isAssignable(cand, param, cha)) {
|
||||
assigned.add(cand);
|
||||
logger.debug("\t\tAsigning: {} from the overrides (ass)", cand);
|
||||
debug("\t\tAsigning: {} from the overrides (ass)", cand);
|
||||
continue forEachParameter;
|
||||
}
|
||||
}
|
||||
|
@ -1352,7 +1342,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
try {
|
||||
if (isAssignable(cand, param, cha)) {
|
||||
assigned.add(cand);
|
||||
logger.debug("\t\tAsigning: {} from the callrs params (ass)", cand);
|
||||
debug("\t\tAsigning: {} from the callrs params (ass)", cand);
|
||||
continue forEachParameter;
|
||||
}
|
||||
} catch (ClassLookupException e) {
|
||||
|
@ -1364,14 +1354,14 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
for (final SSAValue cand : defaults) {
|
||||
if (isAssignable(cand, param, cha)) {
|
||||
assigned.add(cand);
|
||||
logger.debug("\t\tAsigning: {} from the defaults (ass)", cand);
|
||||
debug("\t\tAsigning: {} from the defaults (ass)", cand);
|
||||
continue forEachParameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (instantiator != null) {
|
||||
logger.info("Creating new instance of: {} in call to {}", param, callee);
|
||||
info("Creating new instance of: {} in call to {}", param, callee);
|
||||
/*{ // DEBUG
|
||||
System.out.println("Creating new instance of: " + param);
|
||||
System.out.println("in connectThrough");
|
||||
|
@ -1382,7 +1372,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
} // */
|
||||
final int inst = instantiator.createInstance(param.getType(), instantiatorArgs);
|
||||
if (inst < 0) {
|
||||
logger.warn("No type was assignable and the instantiator returned an invalidone! Using null for {}", param);
|
||||
warn("No type was assignable and the instantiator returned an invalidone! Using null for {}", param);
|
||||
assigned.add(null);
|
||||
continue forEachParameter;
|
||||
} else {
|
||||
|
@ -1401,14 +1391,14 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
continue forEachParameter;
|
||||
}
|
||||
} else {
|
||||
logger.warn("No IInstantiator given and no known parameter assignable - using null");
|
||||
warn("No IInstantiator given and no known parameter assignable - using null");
|
||||
assigned.add(null);
|
||||
continue forEachParameter;
|
||||
}
|
||||
} else {
|
||||
// TODO: CreateInstance Call-Back
|
||||
|
||||
logger.warn("No type was equal. We can't ask isAssignable since we have no cha!");
|
||||
warn("No type was equal. We can't ask isAssignable since we have no cha!");
|
||||
assigned.add(null);
|
||||
continue forEachParameter;
|
||||
} // of (cha != null)
|
||||
|
@ -1461,11 +1451,11 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
IClass toClass = cha.lookupClass(to);
|
||||
|
||||
if (fromClass == null) {
|
||||
logger.debug("Unable to look up the type of from=" + from + " in the ClassHierarchy - tying other loaders...");
|
||||
debug("Unable to look up the type of from=" + from + " in the ClassHierarchy - tying other loaders...");
|
||||
for (final IClassLoader loader: cha.getLoaders()) {
|
||||
final IClass cand = loader.lookupClass(from.getName());
|
||||
if (cand != null) {
|
||||
logger.debug("Using alternative for from: {}", cand);
|
||||
debug("Using alternative for from: {}", cand);
|
||||
fromClass = cand;
|
||||
break;
|
||||
}
|
||||
|
@ -1479,18 +1469,18 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
|
||||
if (toClass == null) {
|
||||
logger.debug("Unable to look up the type of to=" + to + " in the ClassHierarchy - tying other loaders...");
|
||||
debug("Unable to look up the type of to=" + to + " in the ClassHierarchy - tying other loaders...");
|
||||
for (final IClassLoader loader: cha.getLoaders()) {
|
||||
final IClass cand = loader.lookupClass(to.getName());
|
||||
if (cand != null) {
|
||||
logger.debug("Using alternative for to: {}", cand);
|
||||
debug("Using alternative for to: {}", cand);
|
||||
toClass = cand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (toClass == null) {
|
||||
logger.error("Unable to look up the type of to={} in the ClassHierarchy", to);
|
||||
error("Unable to look up the type of to={} in the ClassHierarchy", to);
|
||||
return false;
|
||||
//throw new ClassLookupException("Unable to look up the type of to=" + to +
|
||||
// " in the ClassHierarchy");
|
||||
|
@ -1500,7 +1490,7 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
// cha.isAssignableFrom (IClass c1, IClass c2)
|
||||
// Does an expression c1 x := c2 y typecheck?
|
||||
|
||||
logger.trace("isAssignableFrom({}, {}) = {}", toClass, fromClass, cha.isAssignableFrom(toClass, fromClass));
|
||||
trace("isAssignableFrom({}, {}) = {}", toClass, fromClass, cha.isAssignableFrom(toClass, fromClass));
|
||||
return cha.isAssignableFrom(toClass, fromClass);
|
||||
}
|
||||
|
||||
|
@ -1523,11 +1513,11 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
IClass superClass = cha.lookupClass(superC);
|
||||
|
||||
if (subClass == null) {
|
||||
logger.debug("Unable to look up the type of from=" + sub + " in the ClassHierarchy - tying other loaders...");
|
||||
debug("Unable to look up the type of from=" + sub + " in the ClassHierarchy - tying other loaders...");
|
||||
for (final IClassLoader loader: cha.getLoaders()) {
|
||||
final IClass cand = loader.lookupClass(sub.getName());
|
||||
if (cand != null) {
|
||||
logger.debug("Using alternative for from: {}", cand);
|
||||
debug("Using alternative for from: {}", cand);
|
||||
subClass = cand;
|
||||
break;
|
||||
}
|
||||
|
@ -1540,18 +1530,18 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
}
|
||||
|
||||
if (superClass == null) {
|
||||
logger.debug("Unable to look up the type of to=" + superC + " in the ClassHierarchy - tying other loaders...");
|
||||
debug("Unable to look up the type of to=" + superC + " in the ClassHierarchy - tying other loaders...");
|
||||
for (final IClassLoader loader: cha.getLoaders()) {
|
||||
final IClass cand = loader.lookupClass(superC.getName());
|
||||
if (cand != null) {
|
||||
logger.debug("Using alternative for to: {}", cand);
|
||||
debug("Using alternative for to: {}", cand);
|
||||
superClass = cand;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (superClass == null) {
|
||||
logger.error("Unable to look up the type of to={} in the ClassHierarchy", superC);
|
||||
error("Unable to look up the type of to={} in the ClassHierarchy", superC);
|
||||
throw new ClassLookupException("Unable to look up the type of to=" + superC +
|
||||
" in the ClassHierarchy");
|
||||
}
|
||||
|
@ -1676,4 +1666,24 @@ public class ParameterAccessor { // extends Param-Manager
|
|||
public String toString() {
|
||||
return "<ParamAccessor forMethod=" + this.forMethod() + " />";
|
||||
}
|
||||
|
||||
private static void debug(String s, Object ... args) {
|
||||
if (DEBUG) { System.err.printf(s, args); }
|
||||
}
|
||||
|
||||
private static void info(String s, Object ... args) {
|
||||
if (DEBUG) { System.err.printf(s, args); }
|
||||
}
|
||||
|
||||
private static void warn(String s, Object ... args) {
|
||||
if (DEBUG) { System.err.printf(s, args); }
|
||||
}
|
||||
|
||||
private static void trace(String s, Object ... args) {
|
||||
if (DEBUG) { System.err.printf(s, args); }
|
||||
}
|
||||
|
||||
private static void error(String s, Object ... args) {
|
||||
if (DEBUG) { System.err.printf(s, args); }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,9 +36,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ibm.wala.ssa.SSAInstruction;
|
||||
import com.ibm.wala.types.MethodReference;
|
||||
import com.ibm.wala.types.TypeReference;
|
||||
|
@ -53,8 +50,8 @@ import com.ibm.wala.util.strings.Atom;
|
|||
* @since 2013-09-19
|
||||
*/
|
||||
public class SSAValueManager {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SSAValueManager.class);
|
||||
|
||||
private final static boolean DEBUG = false;
|
||||
private final boolean AUTOMAKE_NAMES = true;
|
||||
|
||||
private enum ValueStatus {
|
||||
|
@ -149,7 +146,7 @@ public class SSAValueManager {
|
|||
nextLocal = param.value.getNumber() + 1;
|
||||
}
|
||||
|
||||
logger.debug("reSetting SSA {} to allocated", value);
|
||||
debug("reSetting SSA {} to allocated", value);
|
||||
param.status = ValueStatus.ALLOCATED;
|
||||
param.setInScope = currentScope;
|
||||
param.setBy = setBy;
|
||||
|
@ -167,7 +164,7 @@ public class SSAValueManager {
|
|||
} // */
|
||||
throw new IllegalStateException("The parameter " + value + " using Key " + value.key + " has already been allocated");
|
||||
} else {
|
||||
logger.info("New variable in management: {}", value);
|
||||
info("New variable in management: {}", value);
|
||||
final Managed<SSAValue> param = new Managed(value, value.key);
|
||||
param.status = ValueStatus.ALLOCATED;
|
||||
param.setInScope = currentScope;
|
||||
|
@ -222,21 +219,21 @@ public class SSAValueManager {
|
|||
param.setInScope = currentScope;
|
||||
param.setBy = setBy;
|
||||
|
||||
logger.info("Setting SSA {} to phi! now {}", value, param.status);
|
||||
info("Setting SSA {} to phi! now {}", value, param.status);
|
||||
didPhi = true;
|
||||
} else if (param.setInScope == currentScope) {
|
||||
if (param.status == ValueStatus.INVALIDATED) {
|
||||
logger.info("Closing SSA Value {} in scope {}", param.value, param.setInScope);
|
||||
info("Closing SSA Value {} in scope {}", param.value, param.setInScope);
|
||||
param.status = ValueStatus.CLOSED;
|
||||
} else if (param.status == ValueStatus.FREE_INVALIDATED) { // TODO: FREE CLOSED
|
||||
logger.info("Closing free SSA Value {} in scope {}", param.value, param.setInScope);
|
||||
info("Closing free SSA Value {} in scope {}", param.value, param.setInScope);
|
||||
param.status = ValueStatus.FREE_CLOSED;
|
||||
}
|
||||
} else if (param.setInScope < currentScope) {
|
||||
//param.status = ValueStatus.INVALIDATED;
|
||||
} else {
|
||||
// TODO: NO! I JUST WANTED TO ADD THEM! *grrr*
|
||||
//logger.error("MISSING PHI for "
|
||||
//error("MISSING PHI for "
|
||||
//throw new IllegalStateException("You forgot Phis in subordinate blocks");
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +279,7 @@ public class SSAValueManager {
|
|||
seenTypes.put(key, aParam);
|
||||
}
|
||||
|
||||
logger.debug("Returning as Free SSA: {}", param);
|
||||
debug("Returning as Free SSA: {}", param);
|
||||
return var;
|
||||
}
|
||||
|
||||
|
@ -327,7 +324,7 @@ public class SSAValueManager {
|
|||
seenTypes.put(key, aParam);
|
||||
}
|
||||
|
||||
logger.debug("Returning as Unallocated SSA: {}", param);
|
||||
debug("Returning as Unallocated SSA: {}", param);
|
||||
return var;
|
||||
}
|
||||
|
||||
|
@ -369,10 +366,10 @@ public class SSAValueManager {
|
|||
(param.status == ValueStatus.ALLOCATED)) {
|
||||
//assert (param.value.getType().equals(type)) : "Unequal types";
|
||||
if (param.setInScope > currentScope) {
|
||||
logger.debug("SSA Value {} is out of scope {}", param, currentScope);
|
||||
debug("SSA Value {} is out of scope {}", param, currentScope);
|
||||
continue;
|
||||
} else if (param.setInScope == currentScope) {
|
||||
logger.debug("Returning SSA Value {} is {}", param.value, param.status);
|
||||
debug("Returning SSA Value {} is {}", param.value, param.status);
|
||||
return param.value;
|
||||
} else {
|
||||
if ((candidate == null) || (param.setInScope > candidate.setInScope)) {
|
||||
|
@ -380,7 +377,7 @@ public class SSAValueManager {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
logger.debug("SSA Value {} is {}", param, param.status);
|
||||
debug("SSA Value {} is {}", param, param.status);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -388,7 +385,7 @@ public class SSAValueManager {
|
|||
}
|
||||
|
||||
if (candidate != null ) {
|
||||
logger.debug("Returning inherited (from {}) SSA Value {}", candidate.setInScope, candidate);
|
||||
debug("Returning inherited (from {}) SSA Value {}", candidate.setInScope, candidate);
|
||||
return candidate.value;
|
||||
} else {
|
||||
throw new IllegalStateException("No suitable candidate has been found for Key " + key);
|
||||
|
@ -581,7 +578,7 @@ public class SSAValueManager {
|
|||
} else {
|
||||
param.status = ValueStatus.INVALIDATED;
|
||||
}
|
||||
logger.info("Invalidated SSA {} for key {}", param, key);
|
||||
info("Invalidated SSA {} for key {}", param, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -715,6 +712,13 @@ public class SSAValueManager {
|
|||
|
||||
return names;
|
||||
}
|
||||
|
||||
private static void debug(String s, Object ... args) {
|
||||
if (DEBUG) { System.err.printf(s, args); }
|
||||
}
|
||||
|
||||
private static void info(String s, Object ... args) {
|
||||
if (DEBUG) { System.err.printf(s, args); }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,9 +35,6 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.JavaLanguage.JavaInstructionFactory;
|
||||
import com.ibm.wala.classLoader.NewSiteReference;
|
||||
|
@ -70,8 +67,8 @@ import com.ibm.wala.types.TypeReference;
|
|||
* @since 2013-10-20
|
||||
*/
|
||||
public class TypeSafeInstructionFactory {
|
||||
private static final Logger logger = LoggerFactory.getLogger(TypeSafeInstructionFactory.class);
|
||||
|
||||
private final static boolean DEBUG = false;
|
||||
protected final JavaInstructionFactory insts;
|
||||
protected final IClassHierarchy cha;
|
||||
|
||||
|
@ -100,7 +97,7 @@ public class TypeSafeInstructionFactory {
|
|||
*/
|
||||
public SSAInvokeInstruction InvokeInstruction(final int iindex, final SSAValue result, List<? extends SSAValue> params,
|
||||
final SSAValue exception, final CallSiteReference site) {
|
||||
logger.info("Now: InvokeInstruction to {} using {}", site, params);
|
||||
info("Now: InvokeInstruction to {} using {}", site, params);
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("The iIndex may not be negative");
|
||||
}
|
||||
|
@ -212,7 +209,7 @@ public class TypeSafeInstructionFactory {
|
|||
*/
|
||||
public SSAInvokeInstruction InvokeInstruction(final int iindex, List<? extends SSAValue> params,
|
||||
final SSAValue exception, final CallSiteReference site) {
|
||||
logger.info("Now: InvokeInstruction to {} using {}", site, params);
|
||||
info("Now: InvokeInstruction to {} using {}", site, params);
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("The iIndex may not be negative");
|
||||
}
|
||||
|
@ -308,7 +305,7 @@ public class TypeSafeInstructionFactory {
|
|||
* @throws IllegalArgumentException if result has no validIn set
|
||||
*/
|
||||
public SSAReturnInstruction ReturnInstruction(final int iindex, final SSAValue result) {
|
||||
logger.info("Now: ReturnInstruction using {}", result);
|
||||
info("Now: ReturnInstruction using {}", result);
|
||||
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("iIndex may not be negative");
|
||||
|
@ -336,7 +333,7 @@ public class TypeSafeInstructionFactory {
|
|||
*/
|
||||
public SSAGetInstruction GetInstruction(final int iindex, final SSAValue targetValue, final SSAValue containingInstance,
|
||||
FieldReference field) {
|
||||
logger.info("Now: Get {} from {} into {}", field, containingInstance, targetValue);
|
||||
info("Now: Get {} from {} into {}", field, containingInstance, targetValue);
|
||||
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("iIndex may not be negative");
|
||||
|
@ -384,7 +381,7 @@ public class TypeSafeInstructionFactory {
|
|||
* @param field The description of the field
|
||||
*/
|
||||
public SSAGetInstruction GetInstruction(final int iindex, final SSAValue targetValue, FieldReference field) {
|
||||
logger.info("Now: Get {} into {}", field, targetValue);
|
||||
info("Now: Get {} into {}", field, targetValue);
|
||||
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("iIndex may not be negative");
|
||||
|
@ -419,7 +416,7 @@ public class TypeSafeInstructionFactory {
|
|||
*/
|
||||
public SSAPutInstruction PutInstruction(final int iindex, final SSAValue targetInstance, final SSAValue newValue,
|
||||
FieldReference field) {
|
||||
logger.info("Now: Put {} to {}", newValue, field);
|
||||
info("Now: Put {} to {}", newValue, field);
|
||||
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("iIndex may not be negative");
|
||||
|
@ -465,7 +462,7 @@ public class TypeSafeInstructionFactory {
|
|||
* @param field The description of the target
|
||||
*/
|
||||
public SSAPutInstruction PutInstruction(final int iindex, final SSAValue newValue, FieldReference field) {
|
||||
logger.info("Now: Put {} to {}", newValue, field);
|
||||
info("Now: Put {} to {}", newValue, field);
|
||||
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("iIndex may not be negative");
|
||||
|
@ -487,7 +484,7 @@ public class TypeSafeInstructionFactory {
|
|||
|
||||
|
||||
public SSANewInstruction NewInstruction(int iindex, SSAValue result, NewSiteReference site) {
|
||||
logger.info("Now: New {}", result);
|
||||
info("Now: New {}", result);
|
||||
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("iIndex may not be negative");
|
||||
|
@ -508,7 +505,7 @@ public class TypeSafeInstructionFactory {
|
|||
|
||||
public SSANewInstruction NewInstruction(int iindex, SSAValue result, NewSiteReference site,
|
||||
Collection<? extends SSAValue> params) {
|
||||
logger.info("Now: New {}", result);
|
||||
info("Now: New {}", result);
|
||||
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("iIndex may not be negative");
|
||||
|
@ -556,7 +553,7 @@ public class TypeSafeInstructionFactory {
|
|||
* @param params at least one SSAValue to read from
|
||||
*/
|
||||
public SSAPhiInstruction PhiInstruction(int iindex, SSAValue result, Collection<? extends SSAValue> params) {
|
||||
logger.info("Now: Phi into {} from {}", result, params);
|
||||
info("Now: Phi into {} from {}", result, params);
|
||||
|
||||
if (iindex < 0) {
|
||||
throw new IllegalArgumentException("iIndex may not be negative");
|
||||
|
@ -714,4 +711,9 @@ public class TypeSafeInstructionFactory {
|
|||
|
||||
return insts.ArrayStoreInstruction(iindex, array.getNumber(), index, value.getNumber(), innerType);
|
||||
}
|
||||
|
||||
private static void info(String s, Object ... args) {
|
||||
if (DEBUG) { System.err.printf(s, args); }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue