rhzm.org · home index about code

Notes on the next iteration of Growl

Growl is due for a rewrite, mostly because the code has become unwieldy. Some things I'd like to change are:

Better naming and organization

For some reason I made every type name be as short as possible. This leaves me with types like O for a Growl object, Ud for userdata (and Ut for the userdata descriptor), and so on. This is hell. Clearly I must have gotten out of the flow state I was in when writing this because now I read the code and I am more confused than anything.

There are also too many structs that only provide separation for the sake of it. The prime example is how the GC context is separate from the VM context, even though they are never meant to be decoupled from one another.

A pseudo-generational garbage collector

The new Growl iteration has a pseudo-generational garbage collector. The nursery is a simple copying garbage collector inspired by Cheney's algorithm, but the tenured space is a bump allocator that doesn't have garbage collection, so it is used for long-lived allocations that can be thought of as having a static allocation, such as program code or the dictionary.

Growl as an image-based language

I want for Growl to be an image-based language. This goes in par with the previous point, but also entails avoiding using the standard library's malloc and free as much as possible within the interpreter to allow for the state to be easily serialized. Of course pointers still need to be fixed up, but this is easier if they all exist in confined spaces that are managed by the interpeter.

There's a scratch arena available for the interpreter and other code to use that is freed on each collection. Since concurrency is not in the scope for the language, this is fine.

See also: