Parent
Scope
Implement the nine shared pinned VM imports:
JSC__VM__blockBytesAllocated
JSC__VM__collectAsync
JSC__VM__externalMemorySize
JSC__VM__heapSize
JSC__VM__performOpportunisticallyScheduledTasks
JSC__VM__releaseWeakRefs
JSC__VM__reportExtraMemory
JSC__VM__runGC
JSC__VM__shrinkFootprint
Pinned source behavior
The Bun 4982b91e bodies are the executable contract: blockBytesAllocated includes extra memory, externalMemorySize stays distinct, synchronous and deferred collection preserve their different scheduling semantics, runGC returns the size after the last full collection, and opportunistic work treats until as a duration from monotonic now.
Acceptance criteria
- VM identity and every counter are shared by sibling realms and isolated across foreign context groups.
zig-gc exposes the minimal race-safe live/committed/last-full-collection accounting needed by zig-js; changes land in the dependency repository as their own small commits before the zig-js integration update.
- Reported external/extra memory uses checked or saturating accounting, is observable in the pinned counters, and cannot wrap on repeated reports.
- Synchronous
runGC performs a full quiescent collection and returns the post-collection size; the non-sync and collectAsync paths request/defer work without pretending an immediate synchronous sweep occurred.
releaseWeakRefs, shrinkFootprint, and opportunistic scheduling execute real runtime checkpoints; they are not no-op compatibility symbols.
- Focused coverage includes arena and precise-GC modes, reachable/unreachable allocation, weak processing, extra/external accounting, sibling/foreign VMs, monotonic scheduling bounds, null inputs, repeated collection, and post-collection return values.
- Home/Bun inventories, README/API evidence, and all parent trackers are regenerated from checked-in results; benchmark scores remain unchanged unless the runtime hot path is materially altered.
Parent
Scope
Implement the nine shared pinned VM imports:
JSC__VM__blockBytesAllocatedJSC__VM__collectAsyncJSC__VM__externalMemorySizeJSC__VM__heapSizeJSC__VM__performOpportunisticallyScheduledTasksJSC__VM__releaseWeakRefsJSC__VM__reportExtraMemoryJSC__VM__runGCJSC__VM__shrinkFootprintPinned source behavior
The Bun
4982b91ebodies are the executable contract:blockBytesAllocatedincludes extra memory,externalMemorySizestays distinct, synchronous and deferred collection preserve their different scheduling semantics,runGCreturns the size after the last full collection, and opportunistic work treatsuntilas a duration from monotonic now.Acceptance criteria
zig-gcexposes the minimal race-safe live/committed/last-full-collection accounting needed by zig-js; changes land in the dependency repository as their own small commits before the zig-js integration update.runGCperforms a full quiescent collection and returns the post-collection size; the non-sync andcollectAsyncpaths request/defer work without pretending an immediate synchronous sweep occurred.releaseWeakRefs,shrinkFootprint, and opportunistic scheduling execute real runtime checkpoints; they are not no-op compatibility symbols.