luagc: incremental GC fixes (weak tables, isAlive, grayagain, lua_close)

- Weak tables mark strong dimension (condmarkobject pattern)
- isAlive matches WoW binary (raw marked != 0)
- Write barriers use grayagain (barrier-back, prevents livelock)
- removekey sets dead keys to LUA_TNONE
- lua_close hook resets GC state before teardown
- lua_setgcthreshold hook prevents threshold stomping
- Stack nilling in traverseThread
- Sweep order: rootudata -> strings -> rootgc
- Birth mark scoped to string sweep only
This commit is contained in:
MarcelineVQ
2026-04-09 17:25:13 -07:00
parent 1ea1d6655b
commit 54d1b69f0e
2 changed files with 98 additions and 4 deletions
+5
View File
@@ -45,6 +45,11 @@ pub const lua_string_hash_resize: usize = 0x6F9C50;
/// WoW calls this on screen transitions with threshold=256 (=262144 bytes).
pub const lua_setgcthreshold: usize = 0x6F4400;
/// lua_close (luaCloseState): __fastcall(ECX=L).
/// Calls luaF_close, luaC_sweep(L,1), frees g and L.
/// Must hook to reset incremental GC state before teardown.
pub const lua_close: usize = 0x6F6EF0;
/// Mark functions (for reference; zluagen reimplements these to support
/// incremental chunking).
pub const markroot: usize = 0x6F7AB0;