luaK_exp2val
function · lua · boundary
- Address
0x700ff0· 18 bytes, up to0x701001- Meaning
- Makes an expression a value, in a register when it has jumps
- Confidence
- verified, proof one
- Finding
- lua/codegen#discharging-expressions
Finding: Discharging expressions in lua: the code generator
luaK_dischargevars turns a variable into a value: a local is already in its register, an upvalue,
global or field gets its load instruction, and a call is cut to one result by luaK_setcallreturns.
discharge2reg puts a value without jumps into a given register: OP_LOADNIL, OP_LOADBOOL,
OP_LOADK, the target register of a relocatable instruction or OP_MOVE. luaK_exp2reg adds the
jump lists, loading false and true through code_label when some jump yields no value. luaK_exp2RK
answers a constant operand when the index fits in 9 bits after the 250 bias.
| function | name | decided by |
|---|---|---|
0x700bd0 | luaK_setcallreturns | call (0x700bd3), C = n + 1 (0x700beb..0x700c00), one result to its register (0x700c08..0x700c18) |
0x700c20 | luaK_dischargevars | switch on kind 5 to 12 (0x700c25..0x700c30), local (0x700c38), OP_GETUPVAL (0x700c42), OP_GETGLOBAL (0x700c56), field frees and OP_GETTABLE (0x700c67..0x700c8c), call (0x700ca3) |
0x700eb0 | discharge2reg | luaK_dischargevars (0x700eba), switch on kind 1 to 11 (0x700ec1..0x700ed4), nil (0x700ee4), booleans (0x700efe..0x700f07), constant (0x700f1d), relocatable (0x700f45..0x700f52), register (0x700f6a..0x700f76) |
0x701350 | discharge2anyreg | in a register (0x701354), luaK_reserveregs (0x701360), discharge2reg (0x70136e) |
0x700e90 | code_label | luaK_getlabel (0x700e93), OP_LOADBOOL (0x700ea6) |
0x700d40 | luaK_exp2reg | discharge2reg (0x700d50), jump kind (0x700d55..0x700d63), need_value (0x700d7f, 0x700d8e), code_label (0x700db6, 0x700dc6), two luaK_patchlistaux (0x700df1, 0x700e0d) |
0x700cf0 | luaK_exp2nextreg | luaK_dischargevars (0x700cf6), freeexp (0x700cff), luaK_reserveregs (0x700d0b), luaK_exp2reg (0x700d19) |
0x700fb0 | luaK_exp2anyreg | register without jumps (0x700fbb..0x700fc9), not a local (0x700fcb, 0x700fd5), else luaK_exp2nextreg (0x700fe4) |
0x700ff0 | luaK_exp2val | jumps (0x700ff3), luaK_exp2anyreg (0x700ff8) or luaK_dischargevars (0x700ffd) |
0x701010 | luaK_exp2RK | luaK_exp2val (0x701016), nil (0x701037..0x701057), constant (0x701025..0x70102d), else luaK_exp2anyreg (0x701064) |
The derivation is in the doc.
Callers 4
- luaY_index lua
- luaK_exp2RK lua
- luaK_prefix lua
- luaK_posfix lua
Callees 2
- luaK_dischargevars lua
- luaK_exp2anyreg lua
Calls and jumps by a bare address, from tables/calls.tsv.