[Soot-list] DeadAssignmentEliminator and assignments x=null

Patrick Lam plam at sable.mcgill.ca
Tue Sep 11 17:00:44 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric Bodden wrote:
>> I don't think it's wrong to mark x=null as essential, but I don't think
>> it's bad to leave it as it is either. I'll leave it up to you.
> 
> Point is that the current behavior forbids test cases like this:
> 
> Object o = new Object();
> WeakReference w = new WeakReference(o);
> o = null; //eliminated
> System.gc();
> assert w.get()==null; //will fail

Are you sure? I think that the reference is to the new object (the
initial value of o), not to the local variable o. Otherwise that would
be very weird indeed in terms of semantics; Java doesn't have
call-by-reference.

pat

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG5wH8NTVxnNGEyOgRArKOAJ4vrFNuNcLqFnceBO/yDO5iRpL3iwCdH+mr
6509oJWzx/mHfxRrEVog4bc=
=vkEy
-----END PGP SIGNATURE-----


More information about the Soot-list mailing list