summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-09-10 10:25:07 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-09-10 10:25:07 +0900
commit3050630b69f7ec8aeaa5a1918275fa56e15b80f7 (patch)
tree30f815de75b5feecc536364743ad92aa1cccea7b
parent28b5c30b964c9e6121a2ee04454905c81a3e2646 (diff)
downloadmruby-3050630b69f7ec8aeaa5a1918275fa56e15b80f7.tar.gz
mruby-3050630b69f7ec8aeaa5a1918275fa56e15b80f7.zip
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.
-rw-r--r--src/codedump.c1
-rw-r--r--src/vm.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/codedump.c b/src/codedump.c
index b0a7676f0..b7dc421e2 100644
--- a/src/codedump.c
+++ b/src/codedump.c
@@ -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);
}
diff --git a/src/vm.c b/src/vm.c
index 8ed22d7f6..932637275 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -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);