[Soot-list] removing singletons
Patrick Lam
p.lam at ece.uwaterloo.ca
Fri Jul 13 11:26:54 EDT 2012
We want to remove singletons. I don't see how string compares is going
to accomplish that; in Phil's example, we are referring to Local
objects, which are actually independent of any singletons at all.
There's also a subtle issue in Phil's example as well. It turns out that
string equality is not the same as object equality for Local objects;
it's actually OK in Soot to have two different Local objects (say
"Object o1") with the same name. They are actually not equal to Soot.
pat
On 07/13/2012 11:22 AM, Marc-Andre Laverdiere-Papineau wrote:
> I agree 100% on all the points.
>
> The idea is if we want Soot to be more of an extendable library, we need
> to make a step in this direction.
>
> It will definitely break _everything_ in soot. There might be some
> option to have some singletons still in place to lower the impact, so
> that the soot internal code either uses the user-supplied configuration
> object or uses the singleton.
>
> We would have to duplicate all the method calls to be having the
> existing interface as well as offering configuration objects.
>
> Of course, the singletons would be deprecated and eventually tossed out.
>
> On 07/13/2012 08:01 AM, Eric Bodden wrote:
>> Hi Phil.
>>
>> Thanks for the effort, but I don't quite see how that would help. The
>> problem is that when you remove a singleton then you need to inject it
>> into the code as a dependency, which means updating many signatures.
>> That's all doable but it is a very nontrivial change. I don't see how
>> Strings would help here.
>>
>> Eric
>>
>> On 13 July 2012 13:43, Phil Pratt-Szeliga<pcpratts at syr.edu> wrote:
>>> 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
>>> _______________________________________________
>>> Soot-list mailing list
>>> Soot-list at sable.mcgill.ca
>>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>>
>>
>
>
More information about the Soot-list
mailing list