Remove unreachable blocks in `OP_RETURN`
authordearblue <[email protected]>
Sun, 31 Dec 2023 05:49:59 +0000 (31 14:49 +0900)
committerdearblue <[email protected]>
Sun, 31 Dec 2023 05:49:59 +0000 (31 14:49 +0900)
When `mrb->c->prev` is non `NULL` and `mrb->c->noexec` is false, switching source fiber should suspend with `Fiber#resume`.
In this case, the condition `mrb->c->ci == mrb->c->cibase` is not satisfied.

src/vm.c

index 759fd97..30bdbf8 100644 (file)
--- a/src/vm.c
+++ b/src/vm.c
@@ -2340,16 +2340,6 @@ RETRY_TRY_BLOCK:
 
       NORMAL_RETURN:
         ci = mrb->c->ci;
-
-        if (ci == mrb->c->cibase) {
-          struct mrb_context *c;
-          c = mrb->c;
-
-          if (c->prev && !c->vmexec && c->prev->ci == c->prev->cibase) {
-            RAISE_LIT(mrb, E_FIBER_ERROR, "double resume");
-          }
-        }
-
         v = regs[a];
         mrb_gc_protect(mrb, v);
         CHECKPOINT_RESTORE(RBREAK_TAG_BREAK) {