benilla-re systems structs docs

setarrayvector

function · lua · boundary

Address
0x6fa560 · 100 bytes, up to 0x6fa5c3
Meaning
Resizes the array part of a table and fills new slots with nil
Confidence
verified, proof one
Finding
lua/object#table-creation-and-growth

Finding: Table creation and growth in lua: objects and tables

luaH_new makes a table: a 32-byte record with the default metatable, no array and no node vector, then sized by setarrayvector and setnodevector. setnodevector raises table overflow above 2^24 nodes, uses the shared dummy node for a log size of 0, and otherwise allocates 40 bytes a node, all nil. rehash counts the live keys (numuse, which fills a count per power of two) and picks the sizes with computesizes: the largest array part at least half full. resize moves the entries into the new vectors and luaH_free frees a table.

functionnamedecided by
0x6fa4f0luaH_newallocates 0x20 bytes (0x6fa50a), luaC_link type 5 (0x6fa517), flags 0xff (0x6fa52c), setarrayvector (0x6fa53c), setnodevector (0x6fa549)
0x6fa560setarrayvectorreallocates size*16 in ltable.c (0x6fa584), new slots set to tag 0
0x6fa5d0setnodevectorlimit 24 (0x6fa5e2), table overflow (0x6fa5e9), dummy node [G+0x58] for size 0 (0x6fa601), 40 bytes a node (0x6fa620)
0x6fa690luaH_freethree luaM_irealloc calls in ltable.c (0x6fa6bc, 0x6fa6d9, 0x6fa6f0), the first only for a nonzero node size
0x6fa9c0rehashnumuse (0x6fa9d5), luaO_log2 (0x6fa9dd), resize (0x6fa9ec)
0x6faa00numuseslice loop to 24 (0x6faa67), arrayindex (0x6faab6), luaO_log2 (0x6faac2), computesizes (0x6faae7)
0x6fab00computesizes#choosing-the-array-size
0x6fab90resizesetarrayvector (0x6fac1f), setnodevector (0x6fac2f), luaH_setnum (0x6fac63), luaH_set (0x6facfd), old vector freed (0x6fad5e)

The derivation is in the doc.

Callers 2

Callees 1

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