1. 14

  2. 5

    Cool project! The documentation looks quite thorough. I’d be interested to see some longer source examples as well.

    I wonder how the VM handles memory-management? I didn’t see any garbage collection code when I peeked at the source. I’m curious how this language tackles the problem, given Rust’s strictness around memory.

    1. 3

      Looks like it uses reference counting exclusively:


      1. 2

        FWIW I stumbled across this paper in my GC research, but didn’t read the whole thing (I’m using C++, not Rust):

        It seems consistent with my early experience, as I’m finding you need a little bit of casting, but everything else can be type safe. This is how I think of GC:

        • from the program’s point of view (the “mutator”), the heap is a heterogeneous graph (it has types, arrays, etc. and pointers are edges)
        • from the GC’s point of view, the heap is a homogeneous graph (or at least more homogeneous, since you only care about record/array sizes, and positions of pointers)

        Although there are also significant practical differences between GCs for statically-typed languages and dynamically-typed, even though the algorithms are the same.

        It looks like Rune is dynamically typed, so maybe the experience in this paper doesn’t totally apply to it.

        Rust as a Language for High Performance GC Implementation



        We describe our experience implementing an Immix garbage collector in Rust and C. We discuss the benefits of Rust, the obstacles encountered, and how we overcame them. We show that our Immix implementation has almost identical performance on micro benchmarks, compared to its implementation in C, and outperforms the popular BDW collector on the gcbench micro benchmark. We find that Rust’s safety features do not create significant barriers to implementing a high performance collector. Though memory managers are usually considered low-level, our high performance implementation relies on very little unsafe code, with the vast majority of the implementation benefiting from Rust’s safety. We see our experience as a compelling proof-of-concept of Rust as an implementation language for high performance garbage collection.