benilla-re systems structs docs

luaD_growstack

function · lua · boundary

Address
0x6f5f60 · 24 bytes, up to 0x6f5f77
Meaning
Grows the stack to twice its size, or by the needed size plus five when that is more
Confidence
verified, proof two
Name from
the community database (idb)
Finding
lua/runtime#stack-and-call-records

Finding: Stack and call records in lua: calls, states and the collector

The stack and the call-record vector grow by reallocation. luaD_growstack doubles the stack or adds the needed size plus five, luaD_reallocstack makes the new stack and correctstack rebases the top, the open upvalues and every call record. luaD_reallocCI resizes the records, luaD_growCI doubles them and raises stack overflow when the new size passes 4096, restore_stack_limit resets the limits after an error. luaD_call counts C nesting, runs luaD_precall and the machine, then luaD_poscall, which moves the results down and pads with nil. tryfuncTM makes a non-function callable through __call and adjust_varargs builds the arg table.

functionnamedecided by
0x6f5e20luaD_reallocstackluaM_irealloc in ldo.c (0x6f5e45), stack_last six slots before the end (0x6f5e4d), tail jmp to correctstack (0x6f5e62)
0x6f5e70correctstacktop (0x6f5e81), open upvalue list [L+0x50] (0x6f5e84), call records 0x18 apart (0x6f5ed8), base (0x6f5ee5)
0x6f5ef0luaD_reallocCIluaM_irealloc in ldo.c for 24 bytes a record (0x6f5f1a), division by 24 (0x6f5f2b)
0x6f5f60luaD_growstackcompare (0x6f5f63), double (0x6f5f67), size plus n plus 5 (0x6f5f6f), both ending in luaD_reallocstack
0x6f61c0luaD_growCIsize test 4096 (0x6f61c7), luaD_throw tail (0x6f61d3), luaD_reallocCI (0x6f61df), stack overflow (0x6f61f2)
0x6f6200adjust_varargsluaH_new (0x6f6266), luaH_setnum (0x6f6294), the key n (0x6f62f2), luaH_set (0x6f6302)
0x6f6370tryfuncTMluaT_gettmbyobj (0x6f6382), tag 6 test (0x6f6393), call (0x6f639b), luaG_typeerror (0x6f63a4)
0x6f6470luaD_poscallreturn hook test (0x6f6479), callrethooks (0x6f648b), record popped (0x6f649c), result copy (0x6f64b2), nil fill (0x6f6517)
0x6f6540callrethooksluaD_callhook event 1 (0x6f6550), event 4 per tail call (0x6f6574)
0x6f65a0luaD_calllimit 200 (0x6f65ae), C stack overflow (0x6f65bf), luaD_throw 5 (0x6f65cf), luaD_precall (0x6f65df), luaV_execute (0x6f65ea), luaD_poscall (0x6f65f5)
0x6f6760restore_stack_limitstack_last from the size (0x6f6773), 4096 test (0x6f6769), tail jmp to luaD_reallocCI (0x6f67a0)

The derivation is in the doc.

Callers 15

Callees 1

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