[Soot-list] removing singletons
Marc-Andre Laverdiere-Papineau
marc-andre.laverdiere-papineau at polymtl.ca
Fri Jul 13 11:22:17 EDT 2012
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
>
>
>
--
Marc-André Laverdière-Papineau
Étudiant au doctorat - PhD Student
More information about the Soot-list
mailing list