From: stephey Date: Fri, 3 Sep 2010 01:54:09 +0000 (+0000) Subject: Added some extra logic for rehashing all effects by allocsite and (incomplete) logic... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3b9524e2a001c10b62c0323595d69414f0a6c1e8;p=IRC.git Added some extra logic for rehashing all effects by allocsite and (incomplete) logic to assing heap region #'s for weakly connected groups. --- diff --git a/Robust/src/IR/Flat/RuntimeConflictResolver.java b/Robust/src/IR/Flat/RuntimeConflictResolver.java index 2cee5694..87182353 100644 --- a/Robust/src/IR/Flat/RuntimeConflictResolver.java +++ b/Robust/src/IR/Flat/RuntimeConflictResolver.java @@ -25,7 +25,7 @@ import IR.TypeDescriptor; * 3) Call void close() */ public class RuntimeConflictResolver { - private static final boolean javaDebug = false; + public static final boolean javaDebug = true; public static final boolean cSideDebug = true; private PrintWriter cFile; @@ -761,4 +761,73 @@ public class RuntimeConflictResolver { " NumOfConParents=" + getNumOfReachableParents() + " ObjectChildren=" + objectRefs.size(); } } + + //TODO integrate this code into the generateEffectsLookupTable method and + //others that may use this table. + private class EffectsTable { + private Hashtable table; + // hashtable provides fast access to heaproot # lookups + private Hashtable WeaklyConnetedHeapRootNums; + private boolean analysisComplete; + + public EffectsTable(Hashtable> effects, + Hashtable> conflicts) { + table = new Hashtable(); + analysisComplete = false; + + // rehash all effects (as a 5-tuple) by their affected allocation site + for (Taint t : effects.keySet()) { + Set localConflicts = conflicts.get(t); + + for (Effect e : effects.get(t)) { + BucketOfEffects bucket; + if ((bucket = table.get(e.getAffectedAllocSite())) == null) { + bucket = new BucketOfEffects(); + table.put(e.getAffectedAllocSite(), bucket); + } + bucket.add(t, e, localConflicts.contains(e)); + } + } + } + + // Run Analysis will walk the data structure and figure out the weakly + // connected heap roots #'s + public void runAnaylsis() { + if (analysisComplete) { + if (RuntimeConflictResolver.javaDebug) { + System.out.println("Err: runAnaylsis was called twice in EffectsTable"); + } + return; + } + + // TODO finish this. + } + } + + private class BucketOfEffects { + // This table is used for lookup while creating the traversal. + Hashtable effects; + + public BucketOfEffects() { + effects = new Hashtable(); + } + + public void add(Taint t, Effect e, boolean conflict) { + EffectsGroup effectsForGivenTaint; + + if ((effectsForGivenTaint = effects.get(t)) == null) { + effectsForGivenTaint = new EffectsGroup(); + effects.put(t, effectsForGivenTaint); + } + + if (e.getField().getType().isPrimitive()) { + if (conflict) { + effectsForGivenTaint.addPrimative(e); + } + } else { + effectsForGivenTaint.addObjEffect(e, conflict); + } + + } + } }