On 11/26/2012 08:26 AM, Graydon Hoare wrote:
On 24/11/2012 8:07 PM, Omer Zach wrote:

Seemed like it would be worth shooting you guys an email before we dive
in—is this a terrible idea or is there anything we should know before we
get started?
It's not a terrible idea, but it is one I think requires a bit more
care; there are already several pieces of this written (the --gc code in
the compiler, the core::gc collector, the rt allocator) and lying
around, and (at least personally) I'd prefer if you or anyone wanting to
hack on the GC spent energy integrating and improving those pieces, not
adding another one. Especially not one in C: our long term plan is to
move as much of the runtime as possible from C to rust; most tasks can
be done mostly in (unsafe) rust and we find the integration much easier
when keeping logic there.


I welcome anybody working on the GC, but after literally years of false starts I think we have a path forward to making a GC for Rust and I would prefer that somebody implement that instead of starting from scratch. The details in this proposal describe only a strategy for calling a Rust function from a C function, which I don't see as part of the GC problem, mostly because the GC should be written in Rust.

For reference here are the basic steps I think are required to implement a simple GC:

* Make sure all the allocations (boxes) contain the correct type descriptors. Currently they all contain *some* type descriptor, but they are not all correct. The last person to tackle the GC bounced off of this step. * Add owned allocations that contain managed types to a linked list in the task, similarly to the linked list of managed boxes. The managed types in these allocations are candidates for garbage collection and the GC needs a way to access them. * Write a GC function in Rust, in core, that finds live values with a precise scan of the heap lists and a conservative scan of the stack (also a linked list).
* Replace refcounting with GC

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to