From: bdemsky Date: Sat, 26 Mar 2011 20:28:51 +0000 (+0000) Subject: hacks to improve speed...including turning off debugging X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=15d51903befdd78eef5962357740ea5a6b0edb7c;p=IRC.git hacks to improve speed...including turning off debugging --- diff --git a/Robust/src/Analysis/OoOJava/VarSrcTokTable.java b/Robust/src/Analysis/OoOJava/VarSrcTokTable.java index 1ad5ec59..c51517ff 100644 --- a/Robust/src/Analysis/OoOJava/VarSrcTokTable.java +++ b/Robust/src/Analysis/OoOJava/VarSrcTokTable.java @@ -4,6 +4,7 @@ import IR.*; import IR.Flat.*; import java.util.*; import java.io.*; +import Analysis.Pointer.MySet; // This class formerly had lazy consistency properties, but // it is being changed so that the full set and the extra @@ -20,7 +21,7 @@ import java.io.*; public class VarSrcTokTable { // a set of every token in the table - private HashSet trueSet; + private MySet trueSet; // these hashtables provide an efficient retreival from the true set private Hashtable< TempDescriptor, Set > var2vst; @@ -39,7 +40,7 @@ public class VarSrcTokTable { public VarSrcTokTable() { - trueSet = new HashSet(); + trueSet = new MySet(); sese2vst = new Hashtable< FlatSESEEnterNode, Set >(); var2vst = new Hashtable< TempDescriptor, Set >(); @@ -69,35 +70,25 @@ public class VarSrcTokTable { // if something with the same hashcode is in the true set, they might // have different reference variable sets because that set is not considered // in a token's equality, so make sure we smooth that out right here - Iterator vstItr = trueSet.iterator(); - while( vstItr.hasNext() ) { - VariableSourceToken vstAlready = vstItr.next(); - - if( vstAlready.equals( vst ) ) { - - // take out the one that is in (we dont' want collisions in - // any of the other hash map sets either) - removePrivate( vstAlready ); - - // combine reference variable sets - vst.getRefVars().addAll( vstAlready.getRefVars() ); - // now jump back as we are adding in a brand new token - break; - } + VariableSourceToken vstAlready = trueSet.get(vst); + if (vstAlready!=null) { + removePrivate( vstAlready ); + HashSet toAddSet=new HashSet(); + toAddSet.addAll(vstAlready.getRefVars()); + toAddSet.addAll(vst.getRefVars()); + vst.setRefVars(toAddSet); } } trueSet.add( vst ); - Set s; - - s = sese2vst.get( vst.getSESE() ); + Set s = sese2vst.get( vst.getSESE() ); if( s == null ) { s = new HashSet(); + sese2vst.put( vst.getSESE(), s ); } s.add( vst ); - sese2vst.put( vst.getSESE(), s ); Iterator refVarItr = vst.getRefVars().iterator(); while( refVarItr.hasNext() ) { @@ -105,17 +96,17 @@ public class VarSrcTokTable { s = var2vst.get( refVar ); if( s == null ) { s = new HashSet(); + var2vst.put( refVar, s ); } s.add( vst ); - var2vst.put( refVar, s ); SVKey key = new SVKey( vst.getSESE(), refVar ); s = sv2vst.get( key ); if( s == null ) { s = new HashSet(); + sv2vst.put( key, s ); } s.add( vst ); - sv2vst.put( key, s ); } } @@ -300,9 +291,13 @@ public class VarSrcTokTable { sv2vst.remove( new SVKey( vst.getSESE(), refVar ) ); - refVars.remove( refVar ); + HashSet newset=new HashSet(); + newset.addAll(vst.getRefVars()); + newset.remove(refVar); + vst.setRefVars(newset); } + var2vst.remove( refVar ); } @@ -683,7 +678,10 @@ public class VarSrcTokTable { // use as an aid for debugging, where true-set is checked // against the alternate mappings: assert that nothing is // missing or extra in the alternates + public void assertConsistency() { + } + /* public void assertConsistency() { Iterator itr; Set s; @@ -789,7 +787,7 @@ public class VarSrcTokTable { assert vst.getRefVars().equals( s1 ); } - } + }*/ public boolean equals( Object o ) { diff --git a/Robust/src/Analysis/OoOJava/VariableSourceToken.java b/Robust/src/Analysis/OoOJava/VariableSourceToken.java index 1d845074..1530b0a2 100644 --- a/Robust/src/Analysis/OoOJava/VariableSourceToken.java +++ b/Robust/src/Analysis/OoOJava/VariableSourceToken.java @@ -23,6 +23,10 @@ public class VariableSourceToken { this.addrVar = addrVar; } + public void setRefVars(Set refVars) { + this.refVars=refVars; + } + public Set getRefVars() { return refVars; } @@ -40,14 +44,7 @@ public class VariableSourceToken { } public VariableSourceToken copy() { - Set refVarsCopy = new HashSet(); - - Iterator rvItr = refVars.iterator(); - while( rvItr.hasNext() ) { - refVarsCopy.add( rvItr.next() ); - } - - return new VariableSourceToken( refVarsCopy, + return new VariableSourceToken( refVars, sese, new Integer( seseAge ), addrVar );