aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
Diffstat (limited to 'lopcodes.h')
-rw-r--r--lopcodes.h26
1 files changed, 11 insertions, 15 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 722e3d6a..6e2103c9 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lopcodes.h,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ 2** $Id: lopcodes.h,v 1.85 2002/01/09 22:02:47 roberto Exp $
3** Opcodes for Lua virtual machine 3** Opcodes for Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -156,17 +156,16 @@ OP_NOT,/* A B R(A) := not R(B) */
156OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ 156OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
157 157
158OP_JMP,/* sBc PC += sBc */ 158OP_JMP,/* sBc PC += sBc */
159OP_CJMP,/* sBc if test then PC += sBc (see (1)) */
160 159
161OP_TESTEQ,/* A C test := (R(A) == R/K(C)) */ 160OP_TESTEQ,/* A C if not (R(A) == R/K(C)) then pc++ */
162OP_TESTNE,/* A C test := (R(A) ~= R/K(C)) */ 161OP_TESTNE,/* A C if not (R(A) ~= R/K(C)) then pc++ */
163OP_TESTLT,/* A C test := (R(A) < R/K(C)) */ 162OP_TESTLT,/* A C if not (R(A) < R/K(C)) then pc++ */
164OP_TESTLE,/* A C test := (R(A) <= R/K(C)) */ 163OP_TESTLE,/* A C if not (R(A) <= R/K(C)) then pc++ */
165OP_TESTGT,/* A C test := (R(A) > R/K(C)) */ 164OP_TESTGT,/* A C if not (R(A) > R/K(C)) then pc++ */
166OP_TESTGE,/* A C test := (R(A) >= R/K(C)) */ 165OP_TESTGE,/* A C if not (R(A) >= R/K(C)) then pc++ */
167 166
168OP_TESTT,/* A B test := R(B); if (test) R(A) := R(B) */ 167OP_TESTT,/* A B if (R(B)) then R(A) := R(B) else pc++ */
169OP_TESTF,/* A B test := not R(B); if (test) R(A) := R(B) */ 168OP_TESTF,/* A B if not (R(B)) then R(A) := R(B) else pc++ */
170 169
171OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1))*/ 170OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1))*/
172OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see (3)) */ 171OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see (3)) */
@@ -194,14 +193,11 @@ pseudo-instructions (interruptions): cannot occur in regular code
194 193
195/*=========================================================================== 194/*===========================================================================
196 Notes: 195 Notes:
197 (1) In the current implementation there is no `test' variable; 196 (1) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
198 instructions OP_TEST* and OP_CJMP must always occur together.
199
200 (2) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1,
201 and can be 0: OP_CALL then sets `top' to last_result+1, so 197 and can be 0: OP_CALL then sets `top' to last_result+1, so
202 next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. 198 next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'.
203 199
204 (3) In OP_RETURN, if (B == 0) then return up to `top' 200 (2) In OP_RETURN, if (B == 0) then return up to `top'
205===========================================================================*/ 201===========================================================================*/
206 202
207 203