memory safety and weak references

Hudson, Rick rick.hudson at intel.com
Mon Apr 1 15:38:57 PDT 2013


Didn't mean to imply that one is required to use an optimization. I just wanted to make it clear that one could.


-        Rick

From: Oliver Hunt [mailto:oliver at apple.com]
Sent: Monday, April 01, 2013 6:18 PM
To: Hudson, Rick
Cc: Brendan Eich; Marius Gundersen; es-discuss discussion
Subject: Re: memory safety and weak references


On Apr 1, 2013, at 3:12 PM, "Hudson, Rick" <rick.hudson at intel.com<mailto: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/69057403/attachment-0001.html>


More information about the es-discuss mailing list