Removed push/pop instructions for rescue/ensure

`OP_PUSHERR`, `OP_POPERR`, `OP_EPUSH` and `OP_EPOP` are removed.
This commit is contained in:
dearblue
2020-05-24 00:42:09 +09:00
committed by Yukihiro "Matz" Matsumoto
parent f467b02d45
commit 0d7b4deccf
4 changed files with 0 additions and 106 deletions
-12
View File
@@ -493,12 +493,6 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
printf("OP_ERR\tL(%d)\n", a);
}
break;
CASE(OP_EPUSH, B);
printf("OP_EPUSH\t\t:I(%d:%p)\n", a, irep->reps[a]);
break;
CASE(OP_ONERR, S);
printf("OP_ONERR\t%03d\n", a);
break;
CASE(OP_EXCEPT, B);
printf("OP_EXCEPT\tR%d\t\t", a);
print_lv_a(mrb, irep, a);
@@ -511,12 +505,6 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
printf("OP_RAISEIF\tR%d\t\t", a);
print_lv_a(mrb, irep, a);
break;
CASE(OP_POPERR, B);
printf("OP_POPERR\t%d\t\t\n", a);
break;
CASE(OP_EPOP, B);
printf("OP_EPOP\t%d\n", a);
break;
CASE(OP_DEBUG, BBB);
printf("OP_DEBUG\t%d\t%d\t%d\n", a, b, c);
-86
View File
@@ -1231,29 +1231,6 @@ RETRY_TRY_BLOCK:
NEXT;
}
CASE(OP_ONERR, S) {
/* check rescue stack */
if (mrb->c->ci->ridx == UINT16_MAX-1) {
mrb_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, "too many nested rescues");
mrb_exc_set(mrb, exc);
goto L_RAISE;
}
/* expand rescue stack */
if (mrb->c->rsize <= mrb->c->ci->ridx) {
if (mrb->c->rsize == 0) mrb->c->rsize = RESCUE_STACK_INIT_SIZE;
else {
mrb->c->rsize *= 2;
if (mrb->c->rsize <= mrb->c->ci->ridx) {
mrb->c->rsize = UINT16_MAX;
}
}
mrb->c->rescue = (uint16_t*)mrb_realloc(mrb, mrb->c->rescue, sizeof(uint16_t)*mrb->c->rsize);
}
/* push rescue stack */
mrb->c->rescue[mrb->c->ci->ridx++] = a;
NEXT;
}
CASE(OP_EXCEPT, B) {
mrb_value exc;
@@ -1300,11 +1277,6 @@ RETRY_TRY_BLOCK:
NEXT;
}
CASE(OP_POPERR, B) {
mrb->c->ci->ridx -= a;
NEXT;
}
CASE(OP_RAISEIF, B) {
mrb_value exc = regs[a];
if (mrb_break_p(exc)) {
@@ -1318,64 +1290,6 @@ RETRY_TRY_BLOCK:
NEXT;
}
CASE(OP_EPUSH, B) {
struct RProc *p;
p = mrb_closure_new(mrb, irep->reps[a]);
/* check ensure stack */
if (mrb->c->eidx == UINT16_MAX-1) {
mrb_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, "too many nested ensures");
mrb_exc_set(mrb, exc);
goto L_RAISE;
}
/* expand ensure stack */
if (mrb->c->esize <= mrb->c->eidx+1) {
if (mrb->c->esize == 0) mrb->c->esize = ENSURE_STACK_INIT_SIZE;
else {
mrb->c->esize *= 2;
if (mrb->c->esize <= mrb->c->eidx) {
mrb->c->esize = UINT16_MAX;
}
}
mrb->c->ensure = (struct RProc**)mrb_realloc(mrb, mrb->c->ensure, sizeof(struct RProc*)*mrb->c->esize);
}
/* push ensure stack */
mrb->c->ensure[mrb->c->eidx++] = p;
mrb->c->ensure[mrb->c->eidx] = NULL;
mrb_gc_arena_restore(mrb, ai);
NEXT;
}
CASE(OP_EPOP, B) {
mrb_callinfo *ci = mrb->c->ci;
unsigned int n, epos = ci->epos;
mrb_value self = regs[0];
struct RClass *target_class = ci->target_class;
if (mrb->c->eidx <= epos) {
NEXT;
}
if (a > (int)mrb->c->eidx - epos)
a = mrb->c->eidx - epos;
for (n=0; n<a; n++) {
int nregs = irep->nregs;
proc = mrb->c->ensure[epos+n];
mrb->c->ensure[epos+n] = NULL;
if (proc == NULL) continue;
irep = proc->body.irep;
ci = cipush(mrb, pc, nregs, nregs, target_class, proc, ci->mid, 0);
mrb_stack_extend(mrb, irep->nregs);
regs[0] = self;
pc = irep->iseq;
}
pool = irep->pool;
syms = irep->syms;
mrb->c->eidx = epos;
JUMP;
}
CASE(OP_SENDV, BB) {
c = CALL_MAXARGS;
goto L_SEND;