3 ms·
A C compiler doesn't track roots, but it does not follow that precise GC is impossible in code that compiles to C. You "just" need to make sure that your transl
by tom_mellior 7y ago
A C compiler doesn't track roots, but it does not follow that precise GC is impossible in code that compiles to C. You "just" need to make sure that your translator emits the appropriate code.
Nobody forces you to implement assignments in the guest language as literal C assignments. If a guest language assignment statement compiles to something like "assign(&target, value)", then your assign function can do whatever it takes to track roots.
- register 7y agoAgreed that it can be done but at a considerable cost. Translating every assignment into a function call is within what I didn't consider feasible from a practical point of view. The best research papers I saw on this topic proposed to pass an additional "ghost stack" as a parameters in every function call that is structured in a specific way so that roots are not "optimized away" by the compiler.