On Sun, Nov 3, 2013 at 10:07 PM, Niko Matsakis <n...@alum.mit.edu> wrote:
> 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.) > In addition to Java having a WeakMap, note also that one can be implemented based on weak refs. I wrote up an implementation based on the weak refs proposal here: https://gist.github.com/tschneidereit/7294906 (With some bug fixes curtesy of Mark Miller.) till _______________________________________________ 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