diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-09 12:27:56 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-03-09 12:27:56 -0300 |
commit | f9d015523ef48266cea37e13717c223c16941b23 (patch) | |
tree | 29beeb7a227fed3290ee304badfc3a362b82df12 | |
parent | 1817dfc3016efc09cfa2c7aee06b22fe1d130652 (diff) | |
download | lua-f9d015523ef48266cea37e13717c223c16941b23.tar.gz lua-f9d015523ef48266cea37e13717c223c16941b23.tar.bz2 lua-f9d015523ef48266cea37e13717c223c16941b23.zip |
better notes about some opcodes (comments only)
-rw-r--r-- | lopcodes.h | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lopcodes.h,v 1.127 2008/04/02 16:16:06 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.128 2008/10/30 15:39:30 roberto Exp roberto $ |
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 | */ |
@@ -215,7 +215,7 @@ OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */ | |||
215 | OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ | 215 | OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ |
216 | 216 | ||
217 | OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ | 217 | OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ |
218 | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ | 218 | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ |
219 | 219 | ||
220 | OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ | 220 | OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ |
221 | 221 | ||
@@ -231,22 +231,27 @@ OP_EXTRAARG/* Ax extra argument for previous opcode */ | |||
231 | 231 | ||
232 | /*=========================================================================== | 232 | /*=========================================================================== |
233 | Notes: | 233 | Notes: |
234 | (*) In OP_CALL, if (B == 0) then B = top. C is the number of returns - 1, | 234 | (*) In OP_CALL, if (B == 0) then B = top. If (C == 0), then `top' is |
235 | and can be 0: OP_CALL then sets `top' to last_result+1, so | 235 | set to last_result+1, so next open instruction (OP_CALL, OP_RETURN, |
236 | next open instruction (OP_CALL, OP_RETURN, OP_SETLIST) may use `top'. | 236 | OP_SETLIST) may use `top'. |
237 | 237 | ||
238 | (*) In OP_VARARG, if (B == 0) then use actual number of varargs and | 238 | (*) In OP_VARARG, if (B == 0) then use actual number of varargs and |
239 | set top (like in OP_CALL with C == 0). | 239 | set top (like in OP_CALL with C == 0). |
240 | 240 | ||
241 | (*) In OP_RETURN, if (B == 0) then return up to `top' | 241 | (*) In OP_RETURN, if (B == 0) then return up to `top'. |
242 | 242 | ||
243 | (*) In OP_SETLIST, if (B == 0) then B = `top'; | 243 | (*) In OP_SETLIST, if (B == 0) then B = `top'; if (C == 0) then next |
244 | if (C == 0) then next `instruction' is EXTRAARG(real C) | 244 | `instruction' is EXTRAARG(real C). |
245 | 245 | ||
246 | (*) For comparisons, A specifies what condition the test should accept | 246 | (*) For comparisons, A specifies what condition the test should accept |
247 | (true or false). | 247 | (true or false). |
248 | |||
249 | (*) All `skips' (pc++) assume that next instruction is a jump. | ||
250 | |||
251 | (*) The OP_CLOSURE instruction is followed by a sequence of | ||
252 | instructions coding the upvalues: OP_MOVE A B if upvalue is local B, | ||
253 | or OP_GETUPVAL A B if upvalue is enclosing upvalue B. | ||
248 | 254 | ||
249 | (*) All `skips' (pc++) assume that next instruction is a jump | ||
250 | ===========================================================================*/ | 255 | ===========================================================================*/ |
251 | 256 | ||
252 | 257 | ||