[libre-riscv-dev] Rust over C/C++

Jacob Lifshay programmerjake at gmail.com
Tue Jan 7 15:36:10 GMT 2020


On Sun, Jan 5, 2020 at 3:43 PM Hendrik Boom <hendrik at topoi.pooq.com> wrote:
> This paragraph from the last link looks like a warning that all was not well yet:
>
> <snip>
>
> And there's this from the first link:
>
> Its an open problem to find new abstractable APIs which allow moving data only between traced memory locations, which would allow you to safely move Gc pointers around.
>
> I wonder if things have changed since these were written.

I'm not sure, there hasn't been any developments with the rust
compiler since then that I'm aware of.

I've found that I don't need Rust compiler magic for GCs for basically
everything I've written in Rust so far, which does include several
things that benefit from GCs:

I'm implementing the compiler IR for Kazan (the Vulkan driver) using
arenas (https://crates.io/crates/typed-arena), which allows the IR to
just contain references to everything and it will all be cleaned up
properly when the arena is destroyed. That works just fine since Rust
specifically has mechanisms to make sure the destructors (Rust's Drop
trait) can't access stale references. This works just fine since I
don't need to operate on the IR from multiple threads simultaneously.

I'm also implementing a multi-threaded version of hashlife for the
next version of Voxels (my Minecraft-like game) in my spare time,
which is an algorithm based on building a DAG using a
garbage-collected hashtable for memoizing calculations. I'm
implementing my own GC, since the algorithm's speed critically depends
on leaving as much stuff in memory as possible, which is the complete
opposite of most GC algorithms.

Old version of Voxels: https://github.com/programmerjake/voxels-0.7
Compiled binaries:
https://github.com/programmerjake/voxels-0.7/releases/tag/v0.7.6.1-alpha

Jacob



More information about the libre-riscv-dev mailing list