diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-09-26 18:08:41 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-09-26 18:08:41 -0300 |
| commit | 8c37d3b9d6e9960fb2a81e2218c28206d4e5298c (patch) | |
| tree | e87b9eb6f7f6dea4752718384936e140ef538805 | |
| parent | 0af581f0bf5a7d0d67803a1a25959a53d5bb6cda (diff) | |
| download | lua-8c37d3b9d6e9960fb2a81e2218c28206d4e5298c.tar.gz lua-8c37d3b9d6e9960fb2a81e2218c28206d4e5298c.tar.bz2 lua-8c37d3b9d6e9960fb2a81e2218c28206d4e5298c.zip | |
documentation of opcode meanings (thanks to lhf)
| -rw-r--r-- | opcode.h | 129 |
1 files changed, 76 insertions, 53 deletions
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** TeCGraf - PUC-Rio | 2 | ** TeCGraf - PUC-Rio |
| 3 | ** $Id: opcode.h,v 3.21 1996/05/28 21:07:32 roberto Exp roberto $ | 3 | ** $Id: opcode.h,v 3.22 1996/09/24 21:46:44 roberto Exp roberto $ |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #ifndef opcode_h | 6 | #ifndef opcode_h |
| @@ -15,60 +15,83 @@ | |||
| 15 | #define FIELDS_PER_FLUSH 40 | 15 | #define FIELDS_PER_FLUSH 40 |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | typedef enum | 18 | typedef enum { |
| 19 | { | 19 | /* name parm before after side effect |
| 20 | PUSHNIL, | 20 | -----------------------------------------------------------------------------*/ |
| 21 | PUSH0, PUSH1, PUSH2, | 21 | |
| 22 | PUSHBYTE, | 22 | PUSHNIL,/* - nil */ |
| 23 | PUSHWORD, | 23 | PUSH0,/* - 0.0 */ |
| 24 | PUSHFLOAT, | 24 | PUSH1,/* - 1.0 */ |
| 25 | PUSHSTRING, | 25 | PUSH2,/* - 2.0 */ |
| 26 | PUSHFUNCTION, | 26 | PUSHBYTE,/* b - (float)b */ |
| 27 | PUSHLOCAL0, PUSHLOCAL1, PUSHLOCAL2, PUSHLOCAL3, PUSHLOCAL4, | 27 | PUSHWORD,/* w - (float)w */ |
| 28 | PUSHLOCAL5, PUSHLOCAL6, PUSHLOCAL7, PUSHLOCAL8, PUSHLOCAL9, | 28 | PUSHFLOAT,/* f - f */ |
| 29 | PUSHLOCAL, | 29 | PUSHSTRING,/* w - STR[w] */ |
| 30 | PUSHGLOBAL, | 30 | PUSHFUNCTION,/* p - FUN(p) */ |
| 31 | PUSHINDEXED, | 31 | PUSHLOCAL0,/* - LOC[0] */ |
| 32 | PUSHSELF, | 32 | PUSHLOCAL1,/* - LOC[1] */ |
| 33 | STORELOCAL0, STORELOCAL1, STORELOCAL2, STORELOCAL3, STORELOCAL4, | 33 | PUSHLOCAL2,/* - LOC[2] */ |
| 34 | STORELOCAL5, STORELOCAL6, STORELOCAL7, STORELOCAL8, STORELOCAL9, | 34 | PUSHLOCAL3,/* - LOC[3] */ |
| 35 | STORELOCAL, | 35 | PUSHLOCAL4,/* - LOC[4] */ |
| 36 | STOREGLOBAL, | 36 | PUSHLOCAL5,/* - LOC[5] */ |
| 37 | STOREINDEXED0, | 37 | PUSHLOCAL6,/* - LOC[6] */ |
| 38 | STOREINDEXED, | 38 | PUSHLOCAL7,/* - LOC[7] */ |
| 39 | STORELIST0, | 39 | PUSHLOCAL8,/* - LOC[8] */ |
| 40 | STORELIST, | 40 | PUSHLOCAL9,/* - LOC[9] */ |
| 41 | STORERECORD, | 41 | PUSHLOCAL,/* w - LOC[w] */ |
| 42 | ADJUST0, | 42 | PUSHGLOBAL,/* w - VAR[w] */ |
| 43 | ADJUST, | 43 | PUSHINDEXED,/* i t t[i] */ |
| 44 | CREATEARRAY, | 44 | PUSHSELF,/* w t t t[STR[w]] */ |
| 45 | EQOP, | 45 | STORELOCAL0,/* x - LOC[0]=x */ |
| 46 | LTOP, | 46 | STORELOCAL1,/* x - LOC[1]=x */ |
| 47 | LEOP, | 47 | STORELOCAL2,/* x - LOC[2]=x */ |
| 48 | GTOP, | 48 | STORELOCAL3,/* x - LOC[3]=x */ |
| 49 | GEOP, | 49 | STORELOCAL4,/* x - LOC[4]=x */ |
| 50 | ADDOP, | 50 | STORELOCAL5,/* x - LOC[5]=x */ |
| 51 | SUBOP, | 51 | STORELOCAL6,/* x - LOC[6]=x */ |
| 52 | MULTOP, | 52 | STORELOCAL7,/* x - LOC[7]=x */ |
| 53 | DIVOP, | 53 | STORELOCAL8,/* x - LOC[8]=x */ |
| 54 | POWOP, | 54 | STORELOCAL9,/* x - LOC[9]=x */ |
| 55 | CONCOP, | 55 | STORELOCAL,/* w x - LOC[w]=x */ |
| 56 | MINUSOP, | 56 | STOREGLOBAL,/* w x - VAR[w]=x */ |
| 57 | NOTOP, | 57 | STOREINDEXED0,/* v i t - t[i]=v */ |
| 58 | ONTJMP, | 58 | STOREINDEXED,/* b v a_b...a_1 i t a_b...a_1 i t t[i]=v */ |
| 59 | ONFJMP, | 59 | STORELIST0,/* w v_w...v_1 t - t[i]=v_i */ |
| 60 | JMP, | 60 | STORELIST,/* w n v_w...v_1 t - t[i+n*FPF]=v_i */ |
| 61 | UPJMP, | 61 | STORERECORD,/* n |
| 62 | IFFJMP, | 62 | w_n...w_1 v_n...v_1 t - t[STR[w_i]]=v_i */ |
| 63 | IFFUPJMP, | 63 | ADJUST0,/* - - TOP=BASE */ |
| 64 | POP, | 64 | ADJUST,/* b - - TOP=BASE+b */ |
| 65 | CALLFUNC, | 65 | CREATEARRAY,/* w - newarray(size = w) */ |
| 66 | RETCODE0, | 66 | EQOP,/* y x (x==y)? 1 : nil */ |
| 67 | RETCODE, | 67 | LTOP,/* y x (x<y)? 1 : nil */ |
| 68 | SETLINE, | 68 | LEOP,/* y x (x<y)? 1 : nil */ |
| 69 | VARARGS | 69 | GTOP,/* y x (x>y)? 1 : nil */ |
| 70 | GEOP,/* y x (x>=y)? 1 : nil */ | ||
| 71 | ADDOP,/* y x x+y */ | ||
| 72 | SUBOP,/* y x x-y */ | ||
| 73 | MULTOP,/* y x x*y */ | ||
| 74 | DIVOP,/* y x x/y */ | ||
| 75 | POWOP,/* y x x^y */ | ||
| 76 | CONCOP,/* y x x..y */ | ||
| 77 | MINUSOP,/* x -x */ | ||
| 78 | NOTOP,/* x (x==nil)? 1 : nil */ | ||
| 79 | ONTJMP,/* w x - (x!=nil)? PC+=w */ | ||
| 80 | ONFJMP,/* w x - (x==nil)? PC+=w */ | ||
| 81 | JMP,/* w - - PC+=w */ | ||
| 82 | UPJMP,/* w - - PC-=w */ | ||
| 83 | IFFJMP,/* w x - (x==nil)? PC+=w */ | ||
| 84 | IFFUPJMP,/* w x - (x==nil)? PC-=w */ | ||
| 85 | POP,/* x - */ | ||
| 86 | CALLFUNC,/* n m v_n...v_1 f r_m...r_1 f(v1,...,v_n) */ | ||
| 87 | RETCODE0, | ||
| 88 | RETCODE,/* b - - */ | ||
| 89 | SETLINE,/* w - - LINE=w */ | ||
| 90 | VARARGS/* b v_n...v_1 {v_1...v_n;n=n} */ | ||
| 91 | |||
| 70 | } OpCode; | 92 | } OpCode; |
| 71 | 93 | ||
| 94 | |||
| 72 | #define MULT_RET 255 | 95 | #define MULT_RET 255 |
| 73 | 96 | ||
| 74 | 97 | ||
