summaryrefslogtreecommitdiffhomepage
path: root/src/codedump.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-11-03 14:58:44 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-11-03 14:58:44 +0900
commitb7e8406f6cf7f8f83fe9594d06c0861e4068241b (patch)
treebfed217bbb86a7d04aabe7e8ca88a99323fd6bfa /src/codedump.c
parent0be5b266b668a6219b440c80bfcff692e02d2097 (diff)
downloadmruby-b7e8406f6cf7f8f83fe9594d06c0861e4068241b.tar.gz
mruby-b7e8406f6cf7f8f83fe9594d06c0861e4068241b.zip
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.
Diffstat (limited to 'src/codedump.c')
-rw-r--r--src/codedump.c9
1 files changed, 9 insertions, 0 deletions
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);
}