mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
codegen.c: use OP_ARRAY instead of OP_ARRAY2 if possible.
`OP_ARRAY` inline elements, i.e: with `OP_ARRAY Rn Rm len`, `Rn` and `Rm` should always be the same register.
This commit is contained in:
@@ -2739,7 +2739,12 @@ codegen(codegen_scope *s, node *tree, int val)
|
||||
else {
|
||||
rn = len - post - n;
|
||||
}
|
||||
genop_3(s, OP_ARRAY2, cursp(), rhs+n, rn);
|
||||
if (cursp() == rhs+n) {
|
||||
genop_2(s, OP_ARRAY, cursp(), rn);
|
||||
}
|
||||
else {
|
||||
genop_3(s, OP_ARRAY2, cursp(), rhs+n, rn);
|
||||
}
|
||||
gen_assignment(s, t->car, NULL, cursp(), NOVAL);
|
||||
n += rn;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user