vm.c, codedump.c: add IREP_TT_NFLAG assertions.

The pool specified by `OP_STRING` (and `OP_SYMBOL`) should represent a
string, so that `IREP_TT_NFLAG` should be zero.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-09-10 10:25:07 +09:00
parent 28b5c30b96
commit 3050630b69
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -461,6 +461,7 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
print_lv_a(mrb, irep, a);
break;
CASE(OP_STRING, BB):
mrb_assert((irep->pool[b].tt&IREP_TT_NFLAG)==0);
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);
}
+1
View File
@@ -2652,6 +2652,7 @@ RETRY_TRY_BLOCK:
CASE(OP_STRING, BB) {
size_t len;
mrb_assert((pool[b].tt&IREP_TT_NFLAG)==0);
len = pool[b].tt >> 2;
if (pool[b].tt & IREP_TT_SFLAG) {
regs[a] = mrb_str_new_static(mrb, pool[b].u.str, len);