From b7e8406f6cf7f8f83fe9594d06c0861e4068241b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 3 Nov 2020 14:58:44 +0900 Subject: Add new instructions to handle symbols/literals >255; fix #5109 New instructions: * OP_LOADL16 * OP_LOADSYM16 * OP_STRING16 Size of pools, symbols are `int16_t` but offset representation in the bytecode was 8 bits. Size of child `irep` array is `int16_t`, too but this change does not address it. --- src/codedump.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/codedump.c') diff --git a/src/codedump.c b/src/codedump.c index dcc196973..9af609264 100644 --- a/src/codedump.c +++ b/src/codedump.c @@ -135,7 +135,10 @@ codedump(mrb_state *mrb, const mrb_irep *irep) printf("OP_MOVE\tR%d\tR%d\t", a, b); print_lv_ab(mrb, irep, a, b); break; + CASE(OP_LOADL16, BS); + goto op_loadl; CASE(OP_LOADL, BB); + op_loadl: switch (irep->pool[b].tt) { case IREP_TT_FLOAT: printf("OP_LOADL\tR%d\tL(%d)\t; %f", a, b, (double)irep->pool[b].u.f); @@ -182,7 +185,10 @@ codedump(mrb_state *mrb, const mrb_irep *irep) printf("OP_LOADI_%d\tR%d\t\t", ins-(int)OP_LOADI_0, a); print_lv_a(mrb, irep, a); break; + CASE(OP_LOADSYM16, BS); + goto op_loadsym; CASE(OP_LOADSYM, BB); + op_loadsym: printf("OP_LOADSYM\tR%d\t:%s\t", a, mrb_sym_dump(mrb, irep->syms[b])); print_lv_a(mrb, irep, a); break; @@ -438,7 +444,10 @@ codedump(mrb_state *mrb, const mrb_irep *irep) printf("OP_INTERN\tR%d", a); print_lv_a(mrb, irep, a); break; + CASE(OP_STRING16, BS); + goto op_string; CASE(OP_STRING, BB); + op_string: if ((irep->pool[b].tt & IREP_TT_NFLAG) == 0) { printf("OP_STRING\tR%d\tL(%d)\t; %s", a, b, irep->pool[b].u.str); } -- cgit v1.2.3