From d759a73525f2bff367433454e4d2851f7c193693 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 1 Feb 2021 16:07:48 +0900 Subject: Allow more than 256 child `irep`; fix #5310 We have introduced following new instructions. * `OP_LAMBDA16` * `OP_BLOCK16` * `OP_METHOD16` * `OP_EXEC16` Each instruction uses 16 bits operand for `reps` index. Since new instructions are added, `mruby/c` VM should be updated. Due to new instructions, dump format compatibility is lost, we have increased `RITE_BINARY_MAJOR_VER`. In addition, we have decreased the size of `refcnt` in `mrb_irep` from `uint32_t` to `uint16_t`, which is reasonably big enough. --- 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 3a7b34354..f382bb7eb 100644 --- a/src/codedump.c +++ b/src/codedump.c @@ -371,6 +371,15 @@ codedump(mrb_state *mrb, const mrb_irep *irep) CASE(OP_METHOD, BB); printf("OP_METHOD\tR%d\tI(%d:%p)\n", a, b, (void*)irep->reps[b]); break; + CASE(OP_LAMBDA16, BS); + printf("OP_LAMBDA\tR%d\tI(%d:%p)\n", a, b, (void*)irep->reps[b]); + break; + CASE(OP_BLOCK16, BS); + printf("OP_BLOCK\tR%d\tI(%d:%p)\n", a, b, (void*)irep->reps[b]); + break; + CASE(OP_METHOD16, BS); + printf("OP_METHOD\tR%d\tI(%d:%p)\n", a, b, (void*)irep->reps[b]); + break; CASE(OP_RANGE_INC, B); printf("OP_RANGE_INC\tR%d\n", a); break; -- cgit v1.2.3