feat: replace fixed-size global array with growable ValueBuffer to support more than 256 globals

Replace the static `Value globals[MAX_GLOBALS]` array in WrenVM with a dynamic `ValueBuffer` that grows on demand, removing the 256-global limit. Introduce `wrenDefineGlobal()` helper that adds a named global to the symbol table and stores its value in the buffer, returning -2 when the 65536 limit is reached. Update all global access sites (compiler emit, runtime interpreter, GC marking, debug disassembly, core class definition) to use the buffer's data pointer and short (16-bit) opcode arguments instead of byte-sized ones. Add a regression test `many_globals.wren` that defines 8200 globals to verify the new capacity.
This commit is contained in:
Bob Nystrom
2014-04-06 23:16:15 +00:00
parent f291f2ca6e
commit e7d2684d30
9 changed files with 8273 additions and 50 deletions
File diff suppressed because it is too large Load Diff