memory safety and weak references

Oliver Hunt oliver at apple.com
Mon Apr 1 15:18:20 PDT 2013


On Apr 1, 2013, at 3:12 PM, "Hudson, Rick" <rick.hudson at intel.com> wrote:

> If the compiler can prove x does not escape the block and it is not used again then it is dead and the compiler is free to reuse the stack slot holding the last reference.
> 
> So I am arguing that x = null; is not required to kill x.
> 

That semantic would mean that the interpreter would need to do escape analysis, and then the moment a variable became dead it would be required to clear it, even if it did not need that slot for anything else.

The world is filled with papers on ways to reduce the conservatism of a GC, but you have to balance the cost of work required for that increased conservatism against the win you might get from reduced liveness.

But all of this is kind of moot, as weak refs are by definition going to have some degree of non-determinism w.r.t liveness, and the initial discussion was of weak refs to primitives which have their own, completely separate problems (as was already covered)

--Oliver

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130401/2ab7059f/attachment.html>


More information about the es-discuss mailing list