Add a new instruction OP_LOADI32.

That loads 32 bit integer bypassing pool access.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-11-04 14:01:04 +09:00
parent f8156ae175
commit d13df1536d
5 changed files with 37 additions and 10 deletions
+5 -1
View File
@@ -115,7 +115,7 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
ptrdiff_t i;
uint32_t a;
uint16_t b;
uint8_t c;
uint16_t c;
ai = mrb_gc_arena_save(mrb);
@@ -169,6 +169,10 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
printf("OP_LOADI16\tR%d\t%d\t", a, (int)(int16_t)b);
print_lv_a(mrb, irep, a);
break;
CASE(OP_LOADI32, BSS);
printf("OP_LOADI32\tR%d\t%d\t", a, (int)(b<<16)+c);
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);
+6 -1
View File
@@ -1030,7 +1030,7 @@ mrb_vm_exec(mrb_state *mrb, const struct RProc *proc, const mrb_code *pc)
struct mrb_jmpbuf c_jmp;
uint32_t a;
uint16_t b;
uint8_t c;
uint16_t c;
mrb_sym mid;
const struct mrb_irep_catch_handler *ch;
@@ -1138,6 +1138,11 @@ RETRY_TRY_BLOCK:
NEXT;
}
CASE(OP_LOADI32, BSS) {
SET_INT_VALUE(mrb, regs[a], (mrb_int)(b<<16)+c);
NEXT;
}
CASE(OP_LOADSYM, BB) {
SET_SYM_VALUE(regs[a], syms[b]);
NEXT;