How can one write an interpreter for a GC (garbage collected) language in C? I have tried the Boehm GC library, but the supplied Makefiles do not work and the documentation is horrid and out of date. Also I have heard that it fails to collect all garbage, thus leaking memory, which is unacceptable.
I would rather code the whole thing in standard C, and not rely on a 3rd party library. I don't want to write a platform-specific GC, using assembly code to implement.
I currently have a prototype implementation in Java, and the only thing preventing me from porting to C (for a great gain of efficiency) is the GC aspect.
I wish hardware had native support for memory GC at least. Now, I can *maybe* implement a GC since I know the root set of variables in the interpreter, but there are additional data structures like environments that ALSO need to be GC'd. Basically everything (user-visible objects and implementation objects) lives on the heap and need to be GC'd.
I have read that it is impossible to develop a GC library for C in general, but that it IS possible for a subset of C programs, where certain constructs are avoided throughout the code-base (things like pointer aliasing, ect). Does anyone know of such a GC library (that I can link in) and the exact restrictions of this?