reduce OP_ARRAY in argument splat

parent 0e03a7f2
......@@ -780,6 +780,11 @@ gen_values(codegen_scope *s, node *t, int val)
is_splat = (intptr_t)t->car->car == NODE_SPLAT; /* splat mode */
if (n >= 127 || is_splat) {
if (val) {
if (is_splat && n == 0 && (intptr_t)t->car->cdr->car == NODE_ARRAY) {
codegen(s, t->car->cdr, VAL);
pop();
}
else {
pop_n(n);
genop(s, MKOP_ABC(OP_ARRAY, cursp(), cursp(), n));
push();
......@@ -791,6 +796,7 @@ gen_values(codegen_scope *s, node *t, int val)
else {
genop(s, MKOP_AB(OP_ARYPUSH, cursp(), cursp()+1));
}
}
t = t->cdr;
while (t) {
push();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment