[Soot-list] Compare Value instances for equality

Rohan Padhye rohanpadhye at cse.iitb.ac.in
Sun Apr 28 07:14:57 EDT 2013


Hello Matteo,

For atomic soot.Value subtypes such as soot.Local, you can use them 
directly in flow sets as you will always find unique references - Java's 
default behaviour for equals() is to test reference equality. The same 
can be said for SootClass, SootMethod and SootField as well I think.

For more complex soot.Value types which are made up of multiple atomic 
Values (e.g. FieldRef or Expr), the expressions will be different 
objects when they appear in different statements even if they have the 
same operands/operators. These can be tested for structural equivalence 
using the EquivTo interface that Marc-Andre mentioned if you are doing 
something like common sub-expression elimination. Hence these classes 
may not be suitable for use in standard Java sets if you want to group 
expressions with common operands.

Hope this clarifies your doubt.

Regards,
Rohan

On 2013-04-27 18:02, Matteo Ceccarello wrote:
> Hi all,
>
> I just started working with SOOT. I'm trying to perform a data flow
> analysis using `soot.Value` instances as elements of the flow sets. 
> However
> it seems that none of the classes that implement that interface 
> override
> the method `equals`. Am I right?
>
> If so, how can I use `soot.Value` instances in my flow analysis?
>
> Thank you very much
>
> Matteo
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list

-- 
Regards,
Rohan Padhye


More information about the Soot-list mailing list