[Soot-list] hash function for the instancekey

Patrick Lam plam at sable.mcgill.ca
Mon Sep 17 10:50:41 EDT 2012


On 09/17/12 10:45, Zhoulai wrote:
> Hello,
>
> if I understand correctly, if two instancekeys, ik1, ik2, satisfy '
> ik1.equals(ik2) ',  then the locals corresponding to ik1 and ik2
> must-alias inside some scope.
>
> My naive question is about the hash value of instance keys: when two
> instancekeys have different *hash* values, can we conclude that the
> corresponding locals must-not alias? The reply should be negative from
> the source code of Eric,  But when I read the " Objective
> representatives" paper, I think  the author was insisting that
> instancekey can almost be used as run-time objects in some extent.

If you look at the code for computeHashCode(), you'll see that if two 
objects must-alias, then they will have the same hash code (line 138 of 
InstanceKey.java in my repository). Different hash codes imply that they 
don't must-alias. Note that this is not the same as saying that the 
variables must-not-alias. That's a stronger statement.

pat




More information about the Soot-list mailing list