Skip to content

Higgs has a Garbage Collector

January 22, 2013

I just completed the implementation of a garbage collector (GC) for the Higgs JavaScript VM. This brings me much closer to the completion of my interpreter. The GC itself is an almost direct port of the code I wrote for Tachyon. It’s a stop-the-world copying semi-space collector. This design has the advantage of being very simple and easy to maintain at only a few hundred lines of heavily commented code.

Since GC bugs are vicious creatures, I decided to try and catch these early on. For this, I ported over the Tachyon GC unit tests, and wrote some new ones. This, of course, isn’t an ironclad guarantee, but it’s already helped me expose and fix several bugs. I consider the GC to be fairly stable at this point. I dreaded doing this work, but putting off the implementation of the GC would likely have meant more integration pains as Higgs is sure to grow in complexity over time with the addition of a Tracing JIT and additional optimizations.

In the next week or so, I will be adding the few features which are missing from the Higgs interpreter, such as support for the arguments object. Once this is done, I’ll move on to the implementation of a profiling system and a tracing JIT for Higgs (which I’m quite excited about).

Leave a Comment

Leave a comment