addk
function · lua · boundary
- Address
0x700ad0· 189 bytes, up to0x700b8c- Meaning
- Returns a constant's index, adding the value with its context word when it is new
- Confidence
- verified, proof one
- Finding
- lua/codegen#constants-and-the-context-word
Finding: Constants and the context word in lua: the code generator
addk looks a constant up in the function's constant table, a Lua table from value to index, and
returns the index it holds; a new constant is appended to the prototype's constants, at most 0x3ffff
(constant table overflow), and its index stored in the table. The client stamps constants with
the execution-context word (ui/luastate, The context word): luaK_stringK, luaK_numberK and
nil_constant build the value with the current word s_scriptContext, and addk copies all 16
bytes into the prototype, makes a nonzero word current while s_scriptContextDepth is nonzero
(test ecx,ecx; je, 0x700b54), and
gives the table's index entry the current word. A chunk's constants carry the word current when they
were first added.
| function | name | decided by |
|---|---|---|
0x700ad0 | addk | luaH_get (0x700adc), number gives __ftol (0x700ae1..0x700ae9), luaM_growaux (0x700b18), 16-byte copy (0x700b30..0x700b43), word made current (0x700b46..0x700b58), luaH_set with the word (0x700b64..0x700b7b) |
0x700aa0 | luaK_stringK | tag 4 (0x700ab5), word (0x700aa6, 0x700abc), addk (0x700abf) |
0x700b90 | luaK_numberK | tag 3 (0x700bae), word (0x700b99, 0x700ba4), addk (0x700bb8) |
0x701070 | nil_constant | nil value and the constant table as its key, each with the word (0x701076..0x701099), addk (0x70109c) |
The derivation is in the doc.
Callers 3
- luaK_stringK lua
- luaK_numberK lua
- nil_constant lua
Callees 4
- __ftol crt
- luaH_get lua
- luaH_set lua
- luaM_growaux lua
Calls and jumps by a bare address, from tables/calls.tsv.