lua 5.3 字节码指令手册
寄存器
Instruction Notation
R(A)
Register A (specified in instruction field A)
R(B)
Register B (specified in instruction field B)
R(C)
Register C (specified in instruction field C)
PC
Program Counter
Kst(n)
Element n in the constant list
Upvalue[n]
Name of upvalue with index n
Gbl[sym]
Global variable indexed by symbol sym
RK(B)
Register B or a constant index
RK(C)
Register C or a constant index
sBx
Signed displacement (in field sBx) for all kinds of jumps
Instruction Summary
Lua bytecode instructions are 32-bits in size. All instructions have an opcode in the first 6 bits. Instructions can have the following fields:
'A' : 8 bits
'B' : 9 bits
'C' : 9 bits
'Ax' : 26 bits ('A', 'B', and 'C' together)
'Bx' : 18 bits ('B' and 'C' together)
'sBx' : signed Bx
A signed argument is represented in excess K; that is, the number value is the unsigned value minus K. K is exactly the maximum value for that argument (so that -max is represented by 0, and +max is represented by 2*max), which is half the maximum for the corresponding unsigned argument.
操作码
Opcode | Description |
---|---|
MOVE | Copy a value between registers |
LOADK | Load a constant into a register |
LOADKX | Load a constant into a register |
LOADBOOL | Load a boolean into a register |
LOADNIL | Load nil values into a range of registers |
GETUPVAL | Read an upvalue into a register |
GETTABUP | Read a value from table in up-value into a register |
GETTABLE | Read a table element into a register |
SETTABUP | Write a register value into table in up-value |
SETUPVAL | Write a register value into an upvalue |
SETTABLE | Write a register value into a table element |
NEWTABLE | Create a new table |
SELF | Prepare an object method for calling |
ADD | Addition operator |
SUB | Subtraction operator |
MUL | Multiplication operator |
MOD | Modulus (remainder) operator |
POW | Exponentation operator |
DIV | Division operator |
IDIV | Integer division operator |
BAND | Bit-wise AND operator |
BOR | Bit-wise OR operator |
BXOR | Bit-wise Exclusive OR operator |
SHL | Shift bits left |
SHR | Shift bits right |
UNM | Unary minus |
BNOT | Bit-wise NOT operator |
NOT | Logical NOT operator |
LEN | Length operator |
CONCAT | Concatenate a range of registers |
JMP | Unconditional jump |
EQ | Equality test, with conditional jump |
LT | Less than test, with conditional jump |
LE | Less than or equal to test, with conditional jump |
TEST | Boolean test, with conditional jump |
TESTSET | Boolean test, with conditional jump and assignment |
CALL | Call a closure |
TAILCALL | Perform a tail call |
RETURN | Return from function call |
FORLOOP | Iterate a numeric for loop |
FORPREP | Initialization for a numeric for loop |
TFORLOOP | Iterate a generic for loop |
TFORCALL | Initialization for a generic for loop |
SETLIST | Set a range of array elements for a table |
CLOSURE | Create a closure of a function prototype |
VARARG | Assign vararg function arguments to registers |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
2020-12-11 dpkg-deb: 错误: 粘贴 子进程被信号(断开的管道) 终止了 解决方法