On Sat, Nov 02, 2013 at 09:22:31PM +0100, Igor Bukanov wrote: > On 2 November 2013 12:24, Niko Matsakis <n...@alum.mit.edu> wrote: > > The Java VM (where G1 was developed) supports weak refs. Any idea what is > > different there or how they managed it? > > Java does not have WeakMap. Weak references, despite their > expose-GC-to-the-world semantics, are much easier to implement. > WeakMap is really complexity and correctness evil.
Perhaps I am confused? - Aren't we talking about weak refs? I thought a weakmap in JS was a done deal? I believe Java's weak refs, and in particular weak references when combined with [reference queues][1], are pretty similar to what the strawman proposed. - Why do you say Java doesn't have a weakmap? What is the [WeakHashMap][2] class if not a WeakMap? Presumably we are using the term differently? (I imagine there are many variations of weakmaps which vary in subtle but significant ways) In any case, Brendan's e-mail suggesting tenuring weakly referenced objects offered one possible workaround for maintaining top nursery performance in the face of weak refs. (I have no idea, of course, if this is what the JVM does.) Niko [1]: http://docs.oracle.com/javase/7/docs/api/java/lang/ref/ReferenceQueue.html [2]: http://docs.oracle.com/javase/6/docs/api/java/util/WeakHashMap.html _______________________________________________ dev-tech-js-engine-internals mailing list dev-tech-js-engine-internals@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals