Update doc/mruby3.1.md

- `OP_GETIDX`, `OP_SETIDX` : Fix operand number
- `OP_SYMBOL` : Add entry
This commit is contained in:
dearblue
2022-02-19 14:39:17 +09:00
parent 5a014997ef
commit 401d316bcf
+7 -2
View File
@@ -72,10 +72,11 @@ Those instructions for method calls with variable number of arguments are no lon
`mruby3.1` introduces following new instructions.
* `OP_GETIDX`: takes 2 operands `a[b]`
* `OP_SETIDX`: takes 3 operands `a[b]=c`
* `OP_GETIDX`: takes 1 operands `R[a][a+1]`
* `OP_SETIDX`: takes 1 operands `R[a][a+1]=R[a+2]`
* `OP_SSEND`: takes 3 operands `a=self.b(c...)`; see `OP_SEND`
* `OP_SSENDB`: takes 3 operands `a=self.b(c...){...}`; see `OP_SEND`
* `OP_SYMBOL`: takes 2 operands `R[a] = intern(Pool[b])`
### `OP_GETIDX` and `OP_SETIDX`
@@ -85,6 +86,10 @@ Execute `obj[int]` and `obj[int] = value` respectively, where `obj` is `string|a
They are similar to `OP_SEND` and `OP_SENDB` respectively. They initialize the `R[a]` by `self` first so that we can skip one `OP_LOADSELF` instruction for each call.
### `OP_SYMBOL`
Extracts the character string placed in the pool as a symbol.
## Changed Instructions
### `OP_SEND` and `OP_SENDB`