diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-10-13 13:45:54 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-10-13 13:45:54 -0300 |
| commit | f3026c36c2373793d807c4deecd1fecaf33a9cef (patch) | |
| tree | 2acf8d47eafe6e3685ef844c3f8c26b11f7c344a | |
| parent | cd0ebd0a802c55d1f16796d2fbb4a6623a6fda57 (diff) | |
| download | lua-f3026c36c2373793d807c4deecd1fecaf33a9cef.tar.gz lua-f3026c36c2373793d807c4deecd1fecaf33a9cef.tar.bz2 lua-f3026c36c2373793d807c4deecd1fecaf33a9cef.zip | |
details in opcode list
| -rw-r--r-- | lopcodes.c | 6 | ||||
| -rw-r--r-- | lopcodes.h | 7 |
2 files changed, 7 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.c,v 1.42 2010/02/26 20:40:29 roberto Exp roberto $ | 2 | ** $Id: lopcodes.c,v 1.43 2010/03/12 19:14:06 roberto Exp roberto $ |
| 3 | ** See Copyright Notice in lua.h | 3 | ** See Copyright Notice in lua.h |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| @@ -48,11 +48,11 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { | |||
| 48 | "FORLOOP", | 48 | "FORLOOP", |
| 49 | "FORPREP", | 49 | "FORPREP", |
| 50 | "TFORCALL", | 50 | "TFORCALL", |
| 51 | "TFORLOOP", | ||
| 51 | "SETLIST", | 52 | "SETLIST", |
| 52 | "CLOSE", | 53 | "CLOSE", |
| 53 | "CLOSURE", | 54 | "CLOSURE", |
| 54 | "VARARG", | 55 | "VARARG", |
| 55 | "TFORLOOP", | ||
| 56 | "EXTRAARG", | 56 | "EXTRAARG", |
| 57 | NULL | 57 | NULL |
| 58 | }; | 58 | }; |
| @@ -96,11 +96,11 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | |||
| 96 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ | 96 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ |
| 97 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ | 97 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ |
| 98 | ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ | 98 | ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ |
| 99 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ | ||
| 99 | ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ | 100 | ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ |
| 100 | ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ | 101 | ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ |
| 101 | ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ | 102 | ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ |
| 102 | ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ | 103 | ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ |
| 103 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ | ||
| 104 | ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ | 104 | ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.h,v 1.134 2010/02/26 20:40:29 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.135 2010/03/12 19:14:06 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 | */ |
| @@ -17,6 +17,7 @@ | |||
| 17 | `A' : 8 bits | 17 | `A' : 8 bits |
| 18 | `B' : 9 bits | 18 | `B' : 9 bits |
| 19 | `C' : 9 bits | 19 | `C' : 9 bits |
| 20 | 'Ax' : 26 bits ('A', 'B', and 'C' together) | ||
| 20 | `Bx' : 18 bits (`B' and `C' together) | 21 | `Bx' : 18 bits (`B' and `C' together) |
| 21 | `sBx' : signed Bx | 22 | `sBx' : signed Bx |
| 22 | 23 | ||
| @@ -212,6 +213,8 @@ OP_FORLOOP,/* A sBx R(A)+=R(A+2); | |||
| 212 | OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ | 213 | OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ |
| 213 | 214 | ||
| 214 | OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */ | 215 | OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */ |
| 216 | OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/ | ||
| 217 | |||
| 215 | OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ | 218 | OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ |
| 216 | 219 | ||
| 217 | OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ | 220 | OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ |
| @@ -219,8 +222,6 @@ OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ | |||
| 219 | 222 | ||
| 220 | OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */ | 223 | OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */ |
| 221 | 224 | ||
| 222 | OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/ | ||
| 223 | |||
| 224 | OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | 225 | OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ |
| 225 | } OpCode; | 226 | } OpCode; |
| 226 | 227 | ||
