Download Game! Currently 60 players and visitors. Last logged in:SuzukiShutatMahjongFloppy

Blitzer's Blog >> 71883

Back to blogs index
Posted: 30 Aug 2026 18:12 [ permalink ]
That is a brilliant technique. Using stack-depth pools to batch refDec
operations until a block fully exits is the absolute perfect way to guarantee
deterministic memory collection without the massive CPU overhead of a tracing
garbage collector. It keeps your memory arenas completely lean.

Because our VM maps local variables entirely to CPU registers, a pointer can
be overwritten or discarded at any point inside a function. If we don't track
what was allocated during that scope, the references leak the moment the VM
executes RETURN and restores the caller's CPU state.

Let's implement your GDLPC architecture. We will add a scopeStack to the
Context (CTX). Whenever CALL_ABS or an ECALL enters a new function, we push a
pool. Whenever a Tagged Pointer is generated (LOAD_CONST, String Addition, or
Array Allocation), we track it in the current pool. When the block hits
RETURN, we safely pop the pool and decrement everything inside itC"while
explicitly protecting the R0 return value so it survives to reach the caller.