diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-09-18 13:07:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-09-18 13:07:54 -0300 |
commit | e0c0e2ee14f519ad33429533f87519753f07051a (patch) | |
tree | b7ccdd78b3c639210aad5d81e338e3bc8e8f333d /lopcodes.h | |
parent | 022e4427cfc5edde499c782ba716f8cf95b63f91 (diff) | |
download | lua-e0c0e2ee14f519ad33429533f87519753f07051a.tar.gz lua-e0c0e2ee14f519ad33429533f87519753f07051a.tar.bz2 lua-e0c0e2ee14f519ad33429533f87519753f07051a.zip |
comments (documentation about instruction formats)
Diffstat (limited to 'lopcodes.h')
-rw-r--r-- | lopcodes.h | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lopcodes.h,v 1.157 2017/09/13 19:50:08 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.158 2017/09/15 14:19: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 | */ |
@@ -11,21 +11,20 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | /*=========================================================================== | 13 | /*=========================================================================== |
14 | We assume that instructions are unsigned numbers. | 14 | We assume that instructions are unsigned 32-bit integers. |
15 | All instructions have an opcode in the first 6 bits. | 15 | All instructions have an opcode in the first 6 bits. |
16 | Instructions can have the following fields: | 16 | Instructions can have the following formats: |
17 | 'A' : 8 bits | 17 | |
18 | 'B' : 9 bits | 18 | 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 |
19 | 'C' : 9 bits | 19 | 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 |
20 | 'Ax' : 26 bits ('A', 'B', and 'C' together) | 20 | iABC | C(9) | | B(9) | | A(8) | | Op(6) | |
21 | 'Bx' : 18 bits ('B' and 'C' together) | 21 | iABx | Bx(18) | | A(8) | | Op(6) | |
22 | 'sBx' : signed Bx | 22 | iAsBx | sBx (signed)(18) | | A(8) | | Op(6) | |
23 | 23 | iAx | Ax(26) | | Op(6) | | |
24 | A signed argument is represented in excess K; that is, the number | 24 | |
25 | value is the unsigned value minus K. K is exactly the maximum value | 25 | A signed argument is represented in excess K: the represented value is |
26 | for that argument (so that -max is represented by 0, and +max is | 26 | the written unsigned value minus K, where K is half the maximum for the |
27 | represented by 2*max), which is half the maximum for the corresponding | 27 | corresponding unsigned argument. |
28 | unsigned argument. | ||
29 | ===========================================================================*/ | 28 | ===========================================================================*/ |
30 | 29 | ||
31 | 30 | ||