benilla-re systems structs docs

checkstacksizes

function · lua · primitive

Address
0x6f7900 · 103 bytes, up to 0x6f7966
Signature
void __fastcall (lua_State *L, void *max)
Meaning
Halves a thread's call records or stack when under a quarter is in use and they are above 16 and 90
Confidence
verified, proof one
Finding
lua/gc#traversing-a-thread
Test
lua::checkstacksizes_whole

Finding: Traversing a thread in lua: marking

traversestack(st, L1) marks the thread's globals table, finds lim, the stack top or the highest top of a Lua call record (one without the C flag) above it, marks every collectable unmarked slot from the stack's base below the top, sets every slot from the top up to lim to nil with the current context word, and calls checkstacksizes(L1, lim). That halves the call records, luaD_reallocCI(L1, size_ci / 2), when four times those in use is below size_ci and size_ci is above 16; then the stack, luaD_reallocstack(L1, stacksize / 2), when four times the slots below lim is below stacksize and stacksize is above 90. Each happens at most once a collection.

The derivation is in the doc.

Callers 1

Callees 2

Calls and jumps by a bare address, from tables/calls.tsv.