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:
Yukihiro "Matz" Matsumoto
2022-02-22 17:21:51 +09:00
parent 75e86dcfcd
commit c37f648552
+6 -1
View File
@@ -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;
}