diff options
Diffstat (limited to 'lopcodes.h')
-rw-r--r-- | lopcodes.h | 26 |
1 files changed, 11 insertions, 15 deletions
@@ -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) */ | |||
156 | OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ | 156 | OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ |
157 | 157 | ||
158 | OP_JMP,/* sBc PC += sBc */ | 158 | OP_JMP,/* sBc PC += sBc */ |
159 | OP_CJMP,/* sBc if test then PC += sBc (see (1)) */ | ||
160 | 159 | ||
161 | OP_TESTEQ,/* A C test := (R(A) == R/K(C)) */ | 160 | OP_TESTEQ,/* A C if not (R(A) == R/K(C)) then pc++ */ |
162 | OP_TESTNE,/* A C test := (R(A) ~= R/K(C)) */ | 161 | OP_TESTNE,/* A C if not (R(A) ~= R/K(C)) then pc++ */ |
163 | OP_TESTLT,/* A C test := (R(A) < R/K(C)) */ | 162 | OP_TESTLT,/* A C if not (R(A) < R/K(C)) then pc++ */ |
164 | OP_TESTLE,/* A C test := (R(A) <= R/K(C)) */ | 163 | OP_TESTLE,/* A C if not (R(A) <= R/K(C)) then pc++ */ |
165 | OP_TESTGT,/* A C test := (R(A) > R/K(C)) */ | 164 | OP_TESTGT,/* A C if not (R(A) > R/K(C)) then pc++ */ |
166 | OP_TESTGE,/* A C test := (R(A) >= R/K(C)) */ | 165 | OP_TESTGE,/* A C if not (R(A) >= R/K(C)) then pc++ */ |
167 | 166 | ||
168 | OP_TESTT,/* A B test := R(B); if (test) R(A) := R(B) */ | 167 | OP_TESTT,/* A B if (R(B)) then R(A) := R(B) else pc++ */ |
169 | OP_TESTF,/* A B test := not R(B); if (test) R(A) := R(B) */ | 168 | OP_TESTF,/* A B if not (R(B)) then R(A) := R(B) else pc++ */ |
170 | 169 | ||
171 | OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1))*/ | 170 | OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1))*/ |
172 | OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see (3)) */ | 171 | OP_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 | ||