Commit Graph

2 Commits

Author SHA1 Message Date
Bob Nystrom
5930aacb24 feat: replace boxed Obj bool/null with direct VAL_TRUE/FALSE_VAL/NULL_VAL macros 2013-11-16 19:35:59 +00:00
Bob Nystrom
944591339f feat: implement mark-sweep garbage collector with object linked list and pinned roots
Replace manual malloc/free for Obj allocations with GC-managed heap. Add Obj->next linked list, markObj traversal for all object types, and sweep phase in VM. Introduce MAX_PINNED stack for temporary GC roots during compilation. Refactor all object constructors (newBool, newFunction, newClass, newNum, newString) to accept VM pointer and register allocations. Move function constant registration earlier in compiler to ensure GC reachability. Add DEBUG_GC_STRESS and TRACE_MEMORY macros in new common.h header.
2013-11-12 16:32:35 +00:00