设为首页 加入收藏

TOP

Lua解析脚本过程中的关键数据结构介绍(四)
2015-07-16 12:57:01 来源: 作者: 【 】 浏览:35
Tags:Lua 解析 脚本 过程 关键 数据结构 介绍
syntax.
24 //R(B) is the register holding the reference to the table with the method.
25 OP_SELF,/*? ? A B C? ? R(A+1) := R(B); R(A) := R(B)[RK(C)]? ? ? ? */
26
27 //The optimization rule is simple: If both terms of a subexpression are numbers,
28 //the subexpression will be eva luated at compile time.
29 OP_ADD,/*? ? A B C? ? R(A) := RK(B) + RK(C)? ? ? ? ? ? ? ? */
30 OP_SUB,/*? ? A B C? ? R(A) := RK(B) - RK(C)? ? ? ? ? ? ? ? */
31 OP_MUL,/*? ? A B C? ? R(A) := RK(B) * RK(C)? ? ? ? ? ? ? ? */
32 OP_DIV,/*? ? A B C? ? R(A) := RK(B) / RK(C)? ? ? ? ? ? ? ? */
33 OP_MOD,/*? ? A B C? ? R(A) := RK(B) % RK(C)? ? ? ? ? ? ? ? */
34 OP_POW,/*? ? A B C? ? R(A) := RK(B) ^ RK(C)? ? ? ? ? ? ? ? */
35 OP_UNM,/*? ? A B? ? R(A) := -R(B)? ? ? ? ? ? ? ? ? ? */
36 OP_NOT,/*? ? A B? ? R(A) := not R(B)? ? ? ? ? ? ? ? */
37 //Returns the length of the object in R(B)
38 OP_LEN,/*? ? A B? ? R(A) := length of R(B)? ? ? ? ? ? ? ? */
39
40 //Performs concatenation of two or more strings.
41 //The source registers must be consecutive, and C must always be greater than B.
42 OP_CONCAT,/*? ? A B C? ? R(A) := R(B).. ... ..R(C)? ? ? ? ? ? */
43
44 //if sBx is 0, the VM will proceed to the next instruction
45 OP_JMP,/*? ? sBx? ? pc+=sBx? ? ? ? ? ? ? ? ? ? */
46
47 /*If the boolean result is not A, then skip the next instruction.
48 Conversely, if the boolean result equals A, continue with the next instruction.*/
49 OP_EQ,/*? ? A B C? ? if ((RK(B) == RK(C)) ~= A) then pc++? ? ? ? */
50 OP_LT,/*? ? A B C? ? if ((RK(B) 51 OP_LE,/*? ? A B C? ? if ((RK(B) <= RK(C)) ~= A) then pc++? ? ? ? ? */
52
53 OP_TEST,/*? ? A C? ? if not (R(A) <=> C) then pc++? ? ? ? ? ? */
54 //register R(B) is coerced into a boolean.
55 OP_TESTSET,/*? ? A B C? ? if (R(B) <=> C) then R(A) := R(B) else pc++? ? */
56
57 //If B is 0, parameters range from R(A+1) to the top of the stack.If B is 1, the function has no parameters.
58 //If C is 1, no return results are saved. If C is 0, then multiple return results are saved, depending on the called function
59 //CALL always updates the top of stack value.
60 OP_CALL,/*? ? A B C? ? R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
61 OP_TAILCALL,/*? ? A B C? ? return R(A)(R(A+1), ... ,R(A+B-1))? ? ? ? */
62 //If B is 1, there are no return values. If B is 0, the set of values from R(A) to the top of the stack is returned.
63 OP_RETURN,/*? ? A B? ? return R(A), ... ,R(A+B-2)? ? (see note)? ? */
64
65 //FORPREP initializes a numeric for loop, while FORLOOP performs an iteration of a numeric for loop.
66 OP_FORLOOP,/*? ? A sBx? ? R(A)+=R(A+2);
67? ? ? ? ? ? if R(A) 68 OP_FORPREP,/*? ? A sBx? ? R(A)-=R(A+2); pc+=sBx? ? ? ? ? ? ? ? */
69
70 //Performs an iteration of a generic for loop.
71 OP_TFORLOOP,/*? ? A C? ? R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
72? ? ? ? ? ? ? ? ? ? ? ? if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++? ? */
73 //This instruction is used to initialize array elements in a table.
74 //If B is 0, the table is set with a variable number of array elements, from register R(A+1) up to the top of the stack.
75 //If C is 0, the next instruction is cast as an integer, and used as the C value.
76 OP_SETLIST,/*? ? A B C? ? R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B? ? */
77
78 /*If a local is used as an upvalue, then the local variable need to be placed somewhere,
79 other wise it will go out of scope and disappear when a lexicalblock enclosing the local variable ends.
80 CLOSE performs this operation for all affected local variables for do end blocks or loop blocks.
81 RETURN also does an implicit CLOSE when a function returns.*/
82 OP_CLOSE,/*? ? A? ? close all variables in the stack up to (>=) R(A)*/
83 /*Each upvalue corresponds to either a MOVE or a GETUPVAL pseudo-instruction.
84 Only the B field on either of these pseudo-instructions are significant.*/
85 //MOVE pseudo-instructions corresponds to local variable R(B) in t
首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇C++string中有关大小和容量的函数.. 下一篇Lua中的string类型

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: