[Soot-list] DeadAssignmentEliminator and assignments x=null

Andrey_Poliektov at amat.com Andrey_Poliektov at amat.com
Tue Sep 11 17:12:32 EDT 2007


Hi Eric,

As far I remember java spec, the result of your "test" is undetermined.

for w.get() to return null, GC MUST determine that the object is weakly 
referenced, and this is not guaranteed to happen at any specific time.

It does not matter how your optimization affects the test the result of 
which was undetermined to begin with.

Thank you,
Andrey








"Eric Bodden" <eric.bodden at mail.mcgill.ca> 
Sent by: soot-list-bounces at sable.mcgill.ca
09/11/2007 01:54 PM

To
"Patrick Lam" <plam at sable.mcgill.ca>
cc
Soot list <soot-list at sable.mcgill.ca>
Subject
Re: [Soot-list] DeadAssignmentEliminator and assignments x=null






 


> 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

Eric

-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
_______________________________________________
Soot-list mailing list
Soot-list at sable.mcgill.ca
http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20070911/e9fe080e/attachment.htm


More information about the Soot-list mailing list