tvix-eval: integrate mmtk for memory management

#259
Opened by tazjin at 2023-03-10T20·33+00

https://docs.rs/mmtk/latest/mmtk/


Integrating mmtk will let us define garbage collection strategies, improve allocation procedures, and get rid of a lot of Box and Rc.

To do this, we need to do some ground work:

  1. The allocator instance will be tied to the VM, meaning that its objects can not outlive the VM. This means we can't return Value instances allocated by mmtk, and we should probably modify the VM interface to only return "flat" data (in practice, I think the data returned by us at the moment will not evaluate in a new VM anyways if it contains unevaluated thunks).

    For this we probably want to add a separate Value type in the public interface, with a much simpler definition than the "real" one. There's some design decisions to be made here ...

  2. Everywhere that allocates values needs to be able to access the allocator. Mmtk provides multiple different types with different properties that can be used for this, but the basic problem remains the same: We need to thread something through to everywhere that allocates values. This is especially annoying in builtins.

  1. tazjin changed the subject of this issue from "tvix-eval: investigate making use of mmtk" to "tvix-eval: integrate mmtk for memory management" at 2023-11-03T07·29+00
  2. tazjin updated the body of this issue at 2023-11-03T07·29+00