summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-09-17 07:49:47 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-09-17 07:49:47 +0900
commit7c99df8416aa866725c11e5ced7f2c5a818a8c74 (patch)
tree827ad7d0074e44eb28672ca8b41788a3c1bc28a4 /include
parent6f044de578bd9b1056e59bb499d49a5dc7ebef2b (diff)
downloadmruby-7c99df8416aa866725c11e5ced7f2c5a818a8c74.tar.gz
mruby-7c99df8416aa866725c11e5ced7f2c5a818a8c74.zip
ops.h: add `OP_ARYPUSH_N` instruction.
Add n elements at once. Reduces instructions for huge array initialization. In addition, `gen_value` function in `codegen.c` was refactored and clarified.
Diffstat (limited to 'include')
-rw-r--r--include/mruby/ops.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/mruby/ops.h b/include/mruby/ops.h
index 49b624ecb..8fe9e5df7 100644
--- a/include/mruby/ops.h
+++ b/include/mruby/ops.h
@@ -86,6 +86,7 @@ OPCODE(ARRAY, BB) /* R(a) = ary_new(R(a),R(a+1)..R(a+b)) */
OPCODE(ARRAY2, BBB) /* R(a) = ary_new(R(b),R(b+1)..R(b+c)) */
OPCODE(ARYCAT, B) /* ary_cat(R(a),R(a+1)) */
OPCODE(ARYPUSH, B) /* ary_push(R(a),R(a+1)) */
+OPCODE(ARYPUSH_N, BB) /* ary_push(R(a),R(a+1)..R(a+b)) */
OPCODE(ARYDUP, B) /* R(a) = ary_dup(R(a)) */
OPCODE(AREF, BBB) /* R(a) = R(b)[c] */
OPCODE(ASET, BBB) /* R(a)[c] = R(b) */