diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-03 06:40:05 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-03 06:40:05 +0900 |
| commit | d9a8981c26829aae0908244c3728f17e06a88ee2 (patch) | |
| tree | 1f3d18efc90edb0002b3139e251909dd6ae58cfa /mrbgems/mruby-compiler/core/codegen.c | |
| parent | a624da6fdb160b9a70a96c1ffe9dec017d7f5cb4 (diff) | |
| download | mruby-d9a8981c26829aae0908244c3728f17e06a88ee2.tar.gz mruby-d9a8981c26829aae0908244c3728f17e06a88ee2.zip | |
vm.c: `OP_DEF` to push a symbol to `a` register.
The code generator no longer need to emit `OP_LOADSYM` after `OP_DEF`.
`doc/opcode.md` is also updated.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 62ed4e77d..5ab2f6180 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -3049,10 +3049,7 @@ codegen(codegen_scope *s, node *tree, int val) push(); pop(); pop(); genop_2(s, OP_DEF, cursp(), sym); - if (val) { - genop_2(s, OP_LOADSYM, cursp(), sym); - push(); - } + if (val) push(); } break; @@ -3069,10 +3066,7 @@ codegen(codegen_scope *s, node *tree, int val) genop_2(s, OP_METHOD, cursp(), idx); pop(); genop_2(s, OP_DEF, cursp(), sym); - if (val) { - genop_2(s, OP_LOADSYM, cursp(), sym); - push(); - } + if (val) push(); } break; |
