patchtestreg
function · lua · boundary
- Address
0x7009b0· 36 bytes, up to0x7009d3- Meaning
- Sets the register of a test, its own operand when none is given
- Confidence
- verified, proof one
- Finding
- lua/codegen#jump-lists
Finding: Jump lists in lua: the code generator
A jump list is chained through the jumps' own offsets, -1 ending it. luaK_jump emits OP_JMP
carrying the jumps pending to here; luaK_concat appends a list; luaK_patchtohere adds a list to
the pending jumps, which the next instruction resolves. luaK_patchlistaux points each jump at a
target: a jump under a value test (OP_TEST) goes to the true or false target by the test's C
and gets that target's register, any other to the default target. need_value answers whether a
list holds a jump that is no value test of the given sense.
| function | name | decided by |
|---|---|---|
0x700810 | luaK_jump | pending jumps taken (0x700818, 0x700827), OP_JMP with sBx -1 (0x70082e), luaK_concat (0x70083c) |
0x701320 | luaK_condjump | luaK_codeABC (0x701334), luaK_jump (0x70133b) |
0x700900 | luaK_fixjump | offset dest - (pc + 1) (0x70090c), above 0x1ffff control structure too long (0x70091a..0x700929), store (0x700943) |
0x700850 | luaK_getlabel | last jump target set to the pc (0x700853) |
0x700950 | luaK_getjump | sBx (0x700958..0x700960), -1 ends (0x700965), pc + 1 + offset (0x70096d) |
0x700980 | getjumpcontrol | pc at least 1 (0x700980), test bit of the previous opcode's mode (0x700997, 0x7009a0) |
0x700e30 | need_value | getjumpcontrol (0x700e46), not OP_TEST or C not the sense gives 1 (0x700e52..0x700e61), luaK_getjump (0x700e67) |
0x7009b0 | patchtestreg | register 255 takes B (0x7009b0..0x7009bd), A set (0x7009c5..0x7009d1) |
0x700890 | luaK_patchlistaux | ret 0x14 (0x7008fd), OP_TEST (0x7008bd), C (0x7008c8), true pair (0x7008cf, 0x7008d7), false pair (0x7008dd, 0x7008e5), luaK_fixjump (0x7008ed) |
0x700860 | luaK_patchlist | target at the pc gives luaK_patchtohere (0x700866, 0x70086b), else one target three times (0x700874..0x700881) |
0x7009e0 | luaK_patchtohere | luaK_getlabel (0x7009e0), luaK_concat into the pending jumps (0x7009e6, 0x7009e9) |
0x7009f0 | luaK_concat | empty second list (0x7009f7), empty first takes it (0x700a02, 0x700a09), walk to the end (0x700a14..0x700a2e), luaK_fixjump (0x700a35) |
The derivation is in the doc.
Callers 1
Callees 0
None by a direct call or jump.
Calls and jumps by a bare address, from tables/calls.tsv.