For anyone curious, I built a project in C called tgc (https://github.com/orangeduck/tgc) which has some similarities. It's essentially a stand alone version of the Cello Garbage Collector (http://libcello.org/learn/garbage-collection) and provides garbage collection for stack and heap objects allocated via the given functions.
Yeah split stacks will be a problem. Essentially `tgc` just scans between the address recorded as the "bottom" and the one recorded as the "top". Both of theses can be manually adjusted if you have some better idea of these locations (such as your own spaghetti stack).
The registers are flushed to the stack before the mark is performed (using `setjmp`) so unless the behaviour of the platform is particularly odd in this case it shouldn't be an issue.
srean|9 years ago
GCC introduced split stack in 4.6 I think. Code that uses this split stack feature would be a problem right ? Anyway to handle those in tgc ?
If I understand it correctly if one rolls ones own spaghetti stack on the heap tgc would still be fine with it. Is that correct ?
orangeduck|9 years ago
Ded7xSEoPKYNsDd|9 years ago
> All it relies on is the assumption that the architecture uses a call stack to implement function frames.
Does this mean it will treat live objects as dead when the only reference is stored in a register?
orangeduck|9 years ago