diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-09-23 14:18:06 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-09-23 14:18:06 -0400 |
| commit | 24a1c75dec5746acb75949b8f41d8044fe98040c (patch) | |
| tree | 4e93e2e94852935430834dd60ab8b48891306227 | |
| parent | 2eb7d0c64030c4d473aa5b007c59717e48eeb751 (diff) | |
Clean up errors from opcode renumbering in VM docs
| -rw-r--r-- | docs/implementation/vm.html | 16 | ||||
| -rw-r--r-- | implementation/vm.md | 16 |
2 files changed, 16 insertions, 16 deletions
diff --git a/docs/implementation/vm.html b/docs/implementation/vm.html index 0bc9ef11..676e6548 100644 --- a/docs/implementation/vm.html +++ b/docs/implementation/vm.html @@ -163,7 +163,7 @@ <td align="right">13</td> <td>FN2O</td> <td align="center">X</td> -<td align="right">13</td> +<td align="right">11</td> <td align="left"></td> <td>Dyadic call, checking for <code><span class='Nothing'>·</span></code></td> </tr> @@ -345,7 +345,7 @@ </tr> </tbody> </table> -<p>Stack effects for most instructions are given below. Instructions 16, 17, and 19 are identical to 5, 6, and 10 except that the indicated values in the higher-numbered instructions may be <code><span class='Nothing'>·</span></code>. Instruction 31 is identical to 21 but indicates that the local variable's value will never be used again, which may be useful for optimization. The lower-numbered instructions are not yet emitted by the self-hosted compiler and can be implemented simply by making them identical to the higher-numbered ones; however, it may be possible to make them faster by not checking for Nothing.</p> +<p>Stack effects for most instructions are given below. Instructions <code><span class='Function'>FN1O</span></code>, <code><span class='Function'>FN2O</span></code>, and <code><span class='Function'>TR3O</span></code> are identical to <code><span class='Function'>FN1C</span></code>, <code><span class='Function'>FN2C</span></code>, and <code><span class='Function'>TR3D</span></code> except that the indicated values in the higher-numbered instructions may be <code><span class='Nothing'>·</span></code>. The non-checking instructions can be implemented using the checking ones, but avoiding the check could improve speed. <code><span class='Function'>VARU</span></code> is identical to <code><span class='Function'>VARM</span></code> but indicates that the local variable's value will never be used again, which may be useful for optimization.</p> <table> <thead> <tr> @@ -384,25 +384,25 @@ <td align="right">08</td> <td>RETD</td> <td><code><span class='Value'>x?</span> <span class='Gets'>→</span> <span class='Value'>n</span></code></td> -<td>Clears stack, dropping 0 or 38 value</td> +<td>Clears stack, dropping 0 or 1 value</td> </tr> <tr> <td align="right">0B</td> <td>ARRO</td> <td><code><span class='Value'>x0</span> <span class='Value'>…</span> <span class='Value'>xm</span> <span class='Gets'>→</span> <span class='Bracket'>⟨</span><span class='Value'>x0</span> <span class='Value'>…</span> <span class='Value'>xm</span><span class='Bracket'>⟩</span></code></td> -<td><code><span class='Function'>N</span></code> total variables (<code><span class='Value'>m</span><span class='Function'>=</span><span class='Value'>n</span><span class='Function'>-</span><span class='Number'>38</span></code>)</td> +<td><code><span class='Function'>N</span></code> total variables (<code><span class='Value'>m</span><span class='Function'>=</span><span class='Value'>n</span><span class='Function'>-</span><span class='Number'>1</span></code>)</td> </tr> <tr> <td align="right">10</td> <td>FN1C</td> <td><code><span class='Value'>𝕩</span> <span class='Value'>𝕤</span> <span class='Gets'>→</span> <span class='Paren'>(</span><span class='Function'>𝕊</span> <span class='Value'>𝕩</span><span class='Paren'>)</span></code></td> -<td>18: <code><span class='Value'>𝕩</span></code> may be <code><span class='Nothing'>·</span></code></td> +<td>12: <code><span class='Value'>𝕩</span></code> may be <code><span class='Nothing'>·</span></code></td> </tr> <tr> <td align="right">11</td> <td>FN2C</td> <td><code><span class='Value'>𝕩</span> <span class='Value'>𝕤</span> <span class='Value'>𝕨</span> <span class='Gets'>→</span> <span class='Paren'>(</span><span class='Value'>𝕨</span> <span class='Function'>𝕊</span> <span class='Value'>𝕩</span><span class='Paren'>)</span></code></td> -<td>19: <code><span class='Value'>𝕨</span></code> or <code><span class='Value'>𝕩</span></code> may be <code><span class='Nothing'>·</span></code></td> +<td>13: <code><span class='Value'>𝕨</span></code> or <code><span class='Value'>𝕩</span></code> may be <code><span class='Nothing'>·</span></code></td> </tr> <tr> <td align="right">14</td> @@ -414,7 +414,7 @@ <td align="right">15</td> <td>TR3D</td> <td><code><span class='Value'>h</span> <span class='Value'>g</span> <span class='Value'>f</span> <span class='Gets'>→</span> <span class='Paren'>(</span><span class='Function'>F</span> <span class='Function'>G</span> <span class='Function'>H</span><span class='Paren'>)</span></code></td> -<td>23: <code><span class='Function'>F</span></code> may be <code><span class='Nothing'>·</span></code></td> +<td>17: <code><span class='Function'>F</span></code> may be <code><span class='Nothing'>·</span></code></td> </tr> <tr> <td align="right">1A</td> @@ -462,7 +462,7 @@ <td align="right">30</td> <td>SETN</td> <td><code><span class='Value'>x</span> <span class='Value'>r</span> <span class='Gets'>→</span> <span class='Paren'>(</span><span class='Value'>r</span><span class='Gets'>←</span><span class='Value'>x</span><span class='Paren'>)</span></code></td> -<td><code><span class='Value'>r</span></code> is a reference; 47: no result</td> +<td><code><span class='Value'>r</span></code> is a reference; 2F: no result</td> </tr> <tr> <td align="right">31</td> diff --git a/implementation/vm.md b/implementation/vm.md index d6f975d1..3bdef382 100644 --- a/implementation/vm.md +++ b/implementation/vm.md @@ -68,7 +68,7 @@ The following instructions are defined by dzaima/BQN. The ones emitted by the se | 10 | FN1C | X | | | Monadic function call | 11 | FN2C | X | | | Dyadic function call | 12 | FN1O | X | 10 | | Monadic call, checking for `·` -| 13 | FN2O | X | 13 | | Dyadic call, checking for `·` +| 13 | FN2O | X | 11 | | Dyadic call, checking for `·` | 14 | TR2D | X | | | Create 2-train | 15 | TR3D | X | | | Create 3-train | 16 | CHKV | X | | | Error if top of stack is `·` @@ -92,7 +92,7 @@ The following instructions are defined by dzaima/BQN. The ones emitted by the se | 41 | FLDM | | 40 | `I` | Push mutable field `I` from namespace | 42 | ALIM | NS | | `I` | Mutable target aliases field `I` -Stack effects for most instructions are given below. Instructions 16, 17, and 19 are identical to 5, 6, and 10 except that the indicated values in the higher-numbered instructions may be `·`. Instruction 31 is identical to 21 but indicates that the local variable's value will never be used again, which may be useful for optimization. The lower-numbered instructions are not yet emitted by the self-hosted compiler and can be implemented simply by making them identical to the higher-numbered ones; however, it may be possible to make them faster by not checking for Nothing. +Stack effects for most instructions are given below. Instructions `FN1O`, `FN2O`, and `TR3O` are identical to `FN1C`, `FN2C`, and `TR3D` except that the indicated values in the higher-numbered instructions may be `·`. The non-checking instructions can be implemented using the checking ones, but avoiding the check could improve speed. `VARU` is identical to `VARM` but indicates that the local variable's value will never be used again, which may be useful for optimization. | B | Name | Stack effect | Comments |---:|------|-----------------------|-------- @@ -100,12 +100,12 @@ Stack effects for most instructions are given below. Instructions 16, 17, and 19 | 01 | DFND | `→ (i⊑blocks)` | Also sets block's parent scope | 06 | POPS | `x →` | | 07 | RETN | `x → x` | Returns from current block -| 08 | RETD | `x? → n` | Clears stack, dropping 0 or 38 value -| 0B | ARRO | `x0 … xm → ⟨x0 … xm⟩` | `N` total variables (`m=n-38`) -| 10 | FN1C | `𝕩 𝕤 → (𝕊 𝕩)` | 18: `𝕩` may be `·` -| 11 | FN2C | `𝕩 𝕤 𝕨 → (𝕨 𝕊 𝕩)` | 19: `𝕨` or `𝕩` may be `·` +| 08 | RETD | `x? → n` | Clears stack, dropping 0 or 1 value +| 0B | ARRO | `x0 … xm → ⟨x0 … xm⟩` | `N` total variables (`m=n-1`) +| 10 | FN1C | `𝕩 𝕤 → (𝕊 𝕩)` | 12: `𝕩` may be `·` +| 11 | FN2C | `𝕩 𝕤 𝕨 → (𝕨 𝕊 𝕩)` | 13: `𝕨` or `𝕩` may be `·` | 14 | TR2D | `g f → (F G)` | -| 15 | TR3D | `h g f → (F G H)` | 23: `F` may be `·` +| 15 | TR3D | `h g f → (F G H)` | 17: `F` may be `·` | 1A | MD1C | `𝕣 𝕗 → (𝔽 _𝕣)` | | 1B | MD2C | `𝕘 𝕣 𝕗 → (𝔽 _𝕣_ 𝔾)` | | 1C | MD2L | `𝕣 𝕗 → (𝕗 _𝕣_)` | @@ -113,7 +113,7 @@ Stack effects for most instructions are given below. Instructions 16, 17, and 19 | 20 | VARO | `→ x` | Local variable value | 21 | VARM | `→ r` | Local variable reference | 2B | VFYM | `c → r` | Constant to match reference -| 30 | SETN | `x r → (r←x)` | `r` is a reference; 47: no result +| 30 | SETN | `x r → (r←x)` | `r` is a reference; 2F: no result | 31 | SETU | `x r → (r↩x)` | `r` is a reference | 32 | SETM | `x f r → (r F↩ x)` | `r` is a reference | 40 | FLDO | `n → n.i` | |
