summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/vm.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/vm.c b/src/vm.c
index f413211e7..3b8119c67 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1319,14 +1319,30 @@ RETRY_TRY_BLOCK:
CASE(OP_EPOP) {
/* A A.times{ensure_pop().call} */
int a = GETARG_A(i);
- mrb_callinfo *ci = mrb->c->ci;
- int n, epos = ci->epos;
+ mrb_callinfo *ci, *nci;
+ mrb_value self = regs[0];
- for (n=0; n<a && mrb->c->eidx > epos; n++) {
- ecall(mrb, --mrb->c->eidx);
- mrb_gc_arena_restore(mrb, ai);
- }
- NEXT;
+ /* temporary limitation */
+ mrb_assert(a==1);
+ proc = mrb->c->ensure[--mrb->c->eidx];
+ ci = mrb->c->ci;
+ nci = cipush(mrb);
+ nci->mid = ci->mid;
+ nci->argc = 0;
+ nci->proc = proc;
+ nci->stackent = mrb->c->stack;
+ nci->nregs = irep->nregs;
+ nci->target_class = proc->target_class;
+ nci->pc = pc + 1;
+ nci->acc = nci->nregs;
+ mrb->c->stack += ci->nregs;
+ stack_extend(mrb, nci->nregs);
+ irep = proc->body.irep;
+ pool = irep->pool;
+ syms = irep->syms;
+ regs[0] = self;
+ pc = irep->iseq;
+ JUMP;
}
CASE(OP_LOADNIL) {