* Note: All computation is done upon closing the object. Steps 1-3 only input data
*/
public class RuntimeConflictResolver {
- public static final boolean javaDebug = true;
+ public static final boolean generalDebug = true;
+//Prints out effects and data structure used to steer RCR traversals
+ public static final boolean printEffectsAndEffectsTable = false;
+//Prints steps taken to build internal representation of pruned reach graph
+ public static final boolean traceDataStructureBuild = false;
public static final boolean cSideDebug = false;
private PrintWriter cFile;
public void setGlobalEffects(Hashtable<Taint, Set<Effect>> effects) {
globalEffects = effects;
- if(javaDebug) {
+ if(printEffectsAndEffectsTable) {
System.out.println("============EFFECTS LIST AS PASSED IN============");
for(Taint t: globalEffects.keySet()) {
System.out.println("For Taint " + t);
VariableNode varNode = rg.getVariableNodeNoMutation(invar);
Taint taint = getProperTaintForFlatSESEEnterNode(rblock, varNode, globalEffects);
if (taint == null) {
- printDebug(javaDebug, "Null FOR " +varNode.getTempDescriptor().getSafeSymbol() + rblock.toPrettyString());
+ printDebug(generalDebug, "Null FOR " +varNode.getTempDescriptor().getSafeSymbol() + rblock.toPrettyString());
continue;
}
Taint taint = getProperTaintForEnterNode(enterNode, varNode, globalEffects);
if (taint == null) {
- printDebug(javaDebug, "Null FOR " +varNode.getTempDescriptor().getSafeSymbol() + enterNode.toString());
+ printDebug(generalDebug, "Null FOR " +varNode.getTempDescriptor().getSafeSymbol() + enterNode.toString());
return;
}
private void runAllTraversals() {
for(TraversalInfo t: toTraverse) {
- printDebug(javaDebug, "Running Traversal a traversal on " + t.f);
+ printDebug(generalDebug, "Running Traversal a traversal on " + t.f);
if(t.f instanceof FlatSESEEnterNode) {
traverseSESEBlock((FlatSESEEnterNode)t.f, t.rg);
//Generate C cases
for (ConcreteRuntimeObjNode node : created.values()) {
- printDebug(javaDebug, "Considering " + node.allocSite + " for traversal");
+ printDebug(generalDebug, "Considering " + node.allocSite + " for traversal");
if (!cases.containsKey(node.allocSite) && qualifiesForCaseStatement(node)) {
- printDebug(javaDebug, "+\t" + node.allocSite + " qualified for case statement");
+ printDebug(generalDebug, "+\t" + node.allocSite + " qualified for case statement");
addChecker(taint, node, cases, null, "ptr", 0);
}
}
weakMap.put(tup, new Integer(id));
}
}
+
+ //output weakly connected groups for verification
+ if(generalDebug) {
+ System.out.println("==============Weakly Connected HeapRoots==============");
+
+ for(int i=0; i < num2WeaklyConnectedHRGroup.size(); i++){
+ System.out.println("Heap Group #" + i);
+ WeaklyConectedHRGroup hg = num2WeaklyConnectedHRGroup.get(i);
+ for(Taint t: hg.connectedHRs) {
+ System.out.println("\t" + t);
+ }
+ }
+
+ System.out.println("=======================END LIST=======================");
+ }
}
private void printoutTable(EffectsTable table) {
}
public void addObjChild(String field, ConcreteRuntimeObjNode child, CombinedObjEffects ce) {
- printDebug(javaDebug,this.allocSite.getUniqueAllocSiteID() + " added child at " + child.getAllocationSite());
+ printDebug(traceDataStructureBuild,this.allocSite.getUniqueAllocSiteID() + " added child at " + child.getAllocationSite());
hasDirectObjConflict |= ce.hasConflict();
ObjRef ref = new ObjRef(field, child, ce);
if(array.contains(ref)) {
ObjRef other = array.get(array.indexOf(ref));
other.mergeWith(ref);
- printDebug(javaDebug," Merged with old");
- printDebug(javaDebug," Old="+ other.child.original + "\n new="+ref.child.original);
+ printDebug(traceDataStructureBuild," Merged with old");
+ printDebug(traceDataStructureBuild," Old="+ other.child.original + "\n new="+ref.child.original);
}
else {
array.add(ref);
- printDebug(javaDebug," Just added new;\n Field: " + field);
- printDebug(javaDebug," AllocSite: " + child.getAllocationSite());
- printDebug(javaDebug," Child: "+child.original);
+ printDebug(traceDataStructureBuild," Just added new;\n Field: " + field);
+ printDebug(traceDataStructureBuild," AllocSite: " + child.getAllocationSite());
+ printDebug(traceDataStructureBuild," Child: "+child.original);
}
}
else {
bucket = new BucketOfEffects();
table.put(e.getAffectedAllocSite(), bucket);
}
- printDebug(javaDebug, "Added Taint" + t + " Effect " + e + "Conflict Status = " + (localConflicts!=null?localConflicts.contains(e):false)+" localConflicts = "+localConflicts);
+ printDebug(printEffectsAndEffectsTable, "Added Taint" + t + " Effect " + e + "Conflict Status = " + (localConflicts!=null?localConflicts.contains(e):false)+" localConflicts = "+localConflicts);
bucket.add(t, e, localConflicts!=null?localConflicts.contains(e):false);
}
}
// Run Analysis will walk the data structure and figure out the weakly
// connected heap roots.
public void runAnalysis() {
- if(javaDebug) {
+ if(printEffectsAndEffectsTable) {
printoutTable(this);
}