luaF_freeclosure
function · lua · boundary
- Address
0x6fa110· 54 bytes, up to0x6fa145- Meaning
- Frees a C or Lua closure by its size
- 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.
| function | name | decided by |
|---|---|---|
0x6f9e70 | luaF_newCclosure | allocates (n+1)*16 (0x6f9e89), luaC_link (0x6f9e96) |
0x6f9eb0 | luaF_newLclosure | allocates n*4+0x24 (0x6f9ecd), environment copied to +0x10, luaC_link (0x6f9eda) |
0x6f9f10 | luaF_findupval | list head [L+0x50], jb/je on the level (0x6f9f25, 0x6f9f27), allocates 0x20 bytes (0x6f9f3e), tag 10 (0x6f9f43) |
0x6f9f60 | luaF_close | level test (0x6f9f79), value copied into the upvalue at +0x10 (0x6f9f87), pointer set (0x6f9fb6), luaC_link with type 10 (0x6f9fc0) |
0x6f9fe0 | luaF_newproto | allocates 0x48 bytes (0x6f9ff3), luaC_link (0x6fa000) |
0x6fa050 | luaF_freeproto | seven luaM_irealloc calls (0x6fa069..0x6fa102) of code, nested protos, constants, line info, locals, upvalue names and the record |
0x6fa110 | luaF_freeclosure | C flag at +6 selects (n+1)*16 (0x6fa129) or n*4+0x24 (0x6fa140) |
0x6fa150 | luaF_getlocalname | 12-byte records [name, startpc, endpc] (0x6fa175), start and end tests (0x6fa168, 0x6fa16d), name at +0x10 (0x6fa18d) |
The derivation is in the doc.
Callers 1
- freeobj lua
Callees 1
- luaM_irealloc lua
Calls and jumps by a bare address, from tables/calls.tsv.