misc/liblua/lopcodes.h
changeset 3697 d5b30d6373fc
parent 2812 0a24853de796
child 10017 de822cd3df3a
equal deleted inserted replaced
3695:c11abf387a7d 3697:d5b30d6373fc
   184 
   184 
   185 OP_EQ,/*	A B C	if ((RK(B) == RK(C)) ~= A) then pc++		*/
   185 OP_EQ,/*	A B C	if ((RK(B) == RK(C)) ~= A) then pc++		*/
   186 OP_LT,/*	A B C	if ((RK(B) <  RK(C)) ~= A) then pc++  		*/
   186 OP_LT,/*	A B C	if ((RK(B) <  RK(C)) ~= A) then pc++  		*/
   187 OP_LE,/*	A B C	if ((RK(B) <= RK(C)) ~= A) then pc++  		*/
   187 OP_LE,/*	A B C	if ((RK(B) <= RK(C)) ~= A) then pc++  		*/
   188 
   188 
   189 OP_TEST,/*	A C	if not (R(A) <=> C) then pc++			*/ 
   189 OP_TEST,/*	A C	if not (R(A) <=> C) then pc++			*/
   190 OP_TESTSET,/*	A B C	if (R(B) <=> C) then R(A) := R(B) else pc++	*/ 
   190 OP_TESTSET,/*	A B C	if (R(B) <=> C) then R(A) := R(B) else pc++	*/
   191 
   191 
   192 OP_CALL,/*	A B C	R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
   192 OP_CALL,/*	A B C	R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */
   193 OP_TAILCALL,/*	A B C	return R(A)(R(A+1), ... ,R(A+B-1))		*/
   193 OP_TAILCALL,/*	A B C	return R(A)(R(A+1), ... ,R(A+B-1))		*/
   194 OP_RETURN,/*	A B	return R(A), ... ,R(A+B-2)	(see note)	*/
   194 OP_RETURN,/*	A B	return R(A), ... ,R(A+B-2)	(see note)	*/
   195 
   195 
   196 OP_FORLOOP,/*	A sBx	R(A)+=R(A+2);
   196 OP_FORLOOP,/*	A sBx	R(A)+=R(A+2);
   197 			if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
   197 			if R(A) <?= R(A+1) then { pc+=sBx; R(A+3)=R(A) }*/
   198 OP_FORPREP,/*	A sBx	R(A)-=R(A+2); pc+=sBx				*/
   198 OP_FORPREP,/*	A sBx	R(A)-=R(A+2); pc+=sBx				*/
   199 
   199 
   200 OP_TFORLOOP,/*	A C	R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); 
   200 OP_TFORLOOP,/*	A C	R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
   201                         if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++	*/ 
   201                         if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++	*/
   202 OP_SETLIST,/*	A B C	R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B	*/
   202 OP_SETLIST,/*	A B C	R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B	*/
   203 
   203 
   204 OP_CLOSE,/*	A 	close all variables in the stack up to (>=) R(A)*/
   204 OP_CLOSE,/*	A 	close all variables in the stack up to (>=) R(A)*/
   205 OP_CLOSURE,/*	A Bx	R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n))	*/
   205 OP_CLOSURE,/*	A Bx	R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n))	*/
   206 
   206 
   238 ** bits 0-1: op mode
   238 ** bits 0-1: op mode
   239 ** bits 2-3: C arg mode
   239 ** bits 2-3: C arg mode
   240 ** bits 4-5: B arg mode
   240 ** bits 4-5: B arg mode
   241 ** bit 6: instruction set register A
   241 ** bit 6: instruction set register A
   242 ** bit 7: operator is a test
   242 ** bit 7: operator is a test
   243 */  
   243 */
   244 
   244 
   245 enum OpArgMask {
   245 enum OpArgMask {
   246   OpArgN,  /* argument is not used */
   246   OpArgN,  /* argument is not used */
   247   OpArgU,  /* argument is used */
   247   OpArgU,  /* argument is used */
   248   OpArgR,  /* argument is a register or a jump offset */
   248   OpArgR,  /* argument is a register or a jump offset */