You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor Garbage Collector to Use VM-Instance State #39
Priority: P0 – High Area: Runtime / Memory Management File:src/runtime/gc.c
Problem
The garbage collector relies heavily on the global VM vm instance.
Functions such as reallocate(), markRoots() and collectGarbage() operate on global VM state, even when a VM pointer is provided.
This creates architectural limitations for multiple VM instances, embedding ProXPL into other applications and potentially supporting independent execution contexts.
Proposed Solution
Move GC state and allocation tracking into the VM instance.
Pass the relevant VM pointer through allocation and collection functions.
Ensure root marking uses the correct VM.
Remove unnecessary global VM dependencies.
Define clear ownership rules for allocated objects.
Tests
Create two VM instances and allocate objects in both.
Trigger collection in one VM and verify the other remains unaffected.
Test closures, globals, stack roots and open upvalues.
Run stress-GC tests.
Run AddressSanitizer and UndefinedBehaviorSanitizer tests.
Activity