benilla-re systems structs docs

luaF_freeproto

function · lua · boundary

Address
0x6fa050 · 186 bytes, up to 0x6fa109
Meaning
Frees the seven blocks of a function prototype
Confidence
verified, proof one
Finding
lua/object#closures-and-prototypes

Finding: Closures and prototypes in lua: objects and tables

A C closure is (n+1)*16 bytes with the function at +0xc, its upvalue count at +7 and a flag at +6; a Lua closure is n*4+0x24 bytes with its prototype at +0xc and the environment copied to +0x10. luaF_findupval keeps the open upvalues of a state in a list sorted by stack level, luaF_close copies the open ones above a level into themselves, luaF_newproto makes a zeroed prototype, luaF_freeproto and luaF_freeclosure free them, and luaF_getlocalname finds the nth local variable name alive at an instruction.

functionnamedecided by
0x6f9e70luaF_newCclosureallocates (n+1)*16 (0x6f9e89), luaC_link (0x6f9e96)
0x6f9eb0luaF_newLclosureallocates n*4+0x24 (0x6f9ecd), environment copied to +0x10, luaC_link (0x6f9eda)
0x6f9f10luaF_findupvallist head [L+0x50], jb/je on the level (0x6f9f25, 0x6f9f27), allocates 0x20 bytes (0x6f9f3e), tag 10 (0x6f9f43)
0x6f9f60luaF_closelevel test (0x6f9f79), value copied into the upvalue at +0x10 (0x6f9f87), pointer set (0x6f9fb6), luaC_link with type 10 (0x6f9fc0)
0x6f9fe0luaF_newprotoallocates 0x48 bytes (0x6f9ff3), luaC_link (0x6fa000)
0x6fa050luaF_freeprotoseven luaM_irealloc calls (0x6fa069..0x6fa102) of code, nested protos, constants, line info, locals, upvalue names and the record
0x6fa110luaF_freeclosureC flag at +6 selects (n+1)*16 (0x6fa129) or n*4+0x24 (0x6fa140)
0x6fa150luaF_getlocalname12-byte records [name, startpc, endpc] (0x6fa175), start and end tests (0x6fa168, 0x6fa16d), name at +0x10 (0x6fa18d)

The derivation is in the doc.

Callers 1

Callees 1

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