Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

While we are all talking about self crafted Clojure runtimes. Here is mine.

Me and a friend wrote a small VM to run Clojure. We designed a costum bytecode based on LuaJit [1] for it and a compiler in Clojure to compile Clojure to that Bytecode.

We had to versions of the VM originally in pre-1.0 Rust but that was always breaking. Then we wrote it in C [3].

For those interested in the GC, we use the OpenSource 'Memory Pool System' [2] originally designed for Dylan.

Its very nice incremental GC system. It fairly simply use, you basically just implement a couple functions related to parsing your objects and the MPS gives you a neat incremental GC for free. Lots of other neat features that are easy to use out of box.

Originally I wanted to write a simple JIT for it but I never actually did it.

[1] https://github.com/clojit/clojit-doc/blob/master/Bytecode%20...

[2] https://www.ravenbrook.com/project/mps/

[3] https://github.com/clojit/clojit-cvm



Nice! I hope you will consider moving back to Rust when things have stabilised. Cross-platform compilation is much easier in Rust than in C. I think it's one of the big factors driving developers to it along with memory safety.


I would but I not really working on this anymore. There are some issues with MPS and Rust that we never fully figured out. MPS relies on scanning stack points and scaning the registers, some of those default function might not totally work with Rust.

We never figured out what the right approch was.

But there are defently very nice things you can do with Rust. The Servo team has to solve some of the same issues with and they have some interesting blogposts about memory managment.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: