better codedump format

parent 89e74025
......@@ -2734,7 +2734,7 @@ codedump(mrb_state *mrb, mrb_irep *irep)
break;
case OP_LAMBDA:
printf("OP_LAMBDA\tR%d\tI(%+d)\t%d\n", GETARG_A(c), GETARG_b(c), GETARG_c(c));
printf("OP_LAMBDA\tR%d\tI(%+d)\t%d\n", GETARG_A(c), GETARG_b(c)+1, GETARG_c(c));
break;
case OP_RANGE:
printf("OP_RANGE\tR%d\tR%d\t%d\n", GETARG_A(c), GETARG_B(c), GETARG_C(c));
......@@ -2845,7 +2845,7 @@ codedump(mrb_state *mrb, mrb_irep *irep)
mrb_sym2name(mrb, irep->syms[GETARG_B(c)]));
break;
case OP_EXEC:
printf("OP_EXEC\tR%d\tI(%+d)\n", GETARG_A(c), GETARG_Bx(c));
printf("OP_EXEC\tR%d\tI(%+d)\n", GETARG_A(c), GETARG_Bx(c)+1);
break;
case OP_SCLASS:
printf("OP_SCLASS\tR%d\tR%d\n", GETARG_A(c), GETARG_B(c));
......@@ -2854,10 +2854,14 @@ codedump(mrb_state *mrb, mrb_irep *irep)
printf("OP_TCLASS\tR%d\n", GETARG_A(c));
break;
case OP_ERR:
printf("OP_ERR\tL(%d)\n", GETARG_Bx(c));
{
mrb_value v = irep->pool[GETARG_Bx(c)];
mrb_value s = mrb_str_dump(mrb, mrb_str_new(mrb, RSTRING_PTR(v), RSTRING_LEN(v)));
printf("OP_ERR\t%s\n", RSTRING_PTR(s));
}
break;
case OP_EPUSH:
printf("OP_EPUSH\t:I(%+d)\n", GETARG_Bx(c));
printf("OP_EPUSH\t:I(%+d)\n", GETARG_Bx(c)+1);
break;
case OP_ONERR:
printf("OP_ONERR\t%03d\n", i+GETARG_sBx(c));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment