Add a new instruction OP_LOADI16.

Which loads 16bit integer to the register. The instruction number should
be reorder on massive instruction refactoring. The instruction is added
for `mruby/c` which had performance issue with `OP_EXT`. With this
instruction, `mruby/c` VM can just raise errors on `OP_EXT` extension
instructions.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-01-17 09:28:21 +09:00
parent 47f5f887e8
commit fa8668c77d
4 changed files with 26 additions and 5 deletions
+4
View File
@@ -130,6 +130,10 @@ codedump(mrb_state *mrb, mrb_irep *irep)
printf("OP_LOADI\tR%d\t-%d\t", a, b);
print_lv_a(mrb, irep, a);
break;
CASE(OP_LOADI16, BS):
printf("OP_LOADI16\tR%d\t%d\t", a, (int)(int16_t)b);
print_lv_a(mrb, irep, a);
break;
CASE(OP_LOADI__1, B):
printf("OP_LOADI__1\tR%d\t\t", a);
print_lv_a(mrb, irep, a);
+5
View File
@@ -1047,6 +1047,11 @@ RETRY_TRY_BLOCK:
NEXT;
}
CASE(OP_LOADI16, BS) {
SET_INT_VALUE(regs[a], (mrb_int)(int16_t)b);
NEXT;
}
CASE(OP_LOADSYM, BB) {
SET_SYM_VALUE(regs[a], syms[b]);
NEXT;