summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-09-18 12:29:58 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-09-19 09:07:20 +0900
commit8bfa99975c8fc9ed171549b0710cab7a395116c5 (patch)
treecf503ae6e95eb5730bb3a898f047f11ebef1a1ee /src
parent7c99df8416aa866725c11e5ced7f2c5a818a8c74 (diff)
downloadmruby-8bfa99975c8fc9ed171549b0710cab7a395116c5.tar.gz
mruby-8bfa99975c8fc9ed171549b0710cab7a395116c5.zip
codegen.c: unify `OP_ARYPUSH` and `OP_ARYPUSH_N`.
- `OP_ARYPUSH` now takes operand for the number of pushing elements - the code generator consume the stack no more than `64` for `mruby/c`
Diffstat (limited to 'src')
-rw-r--r--src/codedump.c8
-rw-r--r--src/vm.c7
2 files changed, 3 insertions, 12 deletions
diff --git a/src/codedump.c b/src/codedump.c
index 3128d7467..ab5804e20 100644
--- a/src/codedump.c
+++ b/src/codedump.c
@@ -431,12 +431,8 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
printf("OP_ARYCAT\tR%d\tR%d\t", a, a+1);
print_lv_a(mrb, irep, a);
break;
- CASE(OP_ARYPUSH, B):
- printf("OP_ARYPUSH\tR%d\t", a);
- print_lv_a(mrb, irep, a);
- break;
- CASE(OP_ARYPUSH_N, BB):
- printf("OP_ARYPUSH_N\tR%d\t%d\t", a, b);
+ CASE(OP_ARYPUSH, BB):
+ printf("OP_ARYPUSH\tR%d\t%d\t", a, b);
print_lv_a(mrb, irep, a);
break;
CASE(OP_ARYDUP, B):
diff --git a/src/vm.c b/src/vm.c
index 5690684cb..b50354061 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -2546,12 +2546,7 @@ RETRY_TRY_BLOCK:
NEXT;
}
- CASE(OP_ARYPUSH, B) {
- mrb_ary_push(mrb, regs[a], regs[a+1]);
- NEXT;
- }
-
- CASE(OP_ARYPUSH_N, BB) {
+ CASE(OP_ARYPUSH, BB) {
for (mrb_int i=0; i<b; i++) {
mrb_ary_push(mrb, regs[a], regs[a+i+1]);
}