[Soot-list] removing singletons

Phil Pratt-Szeliga pcpratts at syr.edu
Fri Jul 13 07:43:34 EDT 2012


Hello,

There was talk about removing the singletons in soot. One idea that
would maybe help this would be to use more string comparisons rather
than object comparisons.

Some code that I am looking at right now for a patch I am writing
looks like this:

List<Local> uniqueLocals = new ArrayList<Local>();
Iterator<DefinitionStmt> it = allDefs.iterator();
while(it.hasNext()){
  DefinitionStmt s = it.next();
  Value left = s.getLeftOp();
  if(left instanceof Local){
     if(uniqueLocals.contains(left)){
       uniqueLocals.remove(left);
     }
  }|
}

It would be converted to:

List<String> uniqueLocals = new ArrayList<String>();
Iterator<DefinitionStmt> it = allDefs.iterator();
while(it.hasNext()){
  DefinitionStmt s = it.next();
  Value left = s.getLeftOp();
  if(left instanceof Local){
     if(uniqueLocals.contains(left.toString())){
       uniqueLocals.remove(left.toString());
       //or maybe use the local name here
     }
  }|
}


Just a thought.

Phil Pratt-Szeliga
Syracuse University


More information about the Soot-list mailing list