Hi Rick, thanks for the clarifications. With the example as written, no later uses of x (even inside a direct eval or closure that captures x and might be called after the gc()!) then I agree with Mark -- should not must.

/be

Hudson, Rick wrote:

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:oli...@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.hud...@intel.com <mailto:rick.hud...@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

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to