clear ci->err after const set; revert 5b51b1; ref #1583

parent 5b51b119
...@@ -81,7 +81,7 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun ...@@ -81,7 +81,7 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun
mrb_irep *irep = ci->proc->body.irep; mrb_irep *irep = ci->proc->body.irep;
mrb_code *pc; mrb_code *pc;
if (mrb->c->cibase[i].err && irep && mrb->c->cibase[i].err - irep->iseq < irep->ilen) { if (mrb->c->cibase[i].err) {
pc = mrb->c->cibase[i].err; pc = mrb->c->cibase[i].err;
} }
else if (i+1 <= ciidx) { else if (i+1 <= ciidx) {
......
...@@ -513,7 +513,8 @@ argnum_error(mrb_state *mrb, int num) ...@@ -513,7 +513,8 @@ argnum_error(mrb_state *mrb, int num)
mrb->exc = mrb_obj_ptr(exc); mrb->exc = mrb_obj_ptr(exc);
} }
#define ERR_PC_HOOK(mrb, pc) mrb->c->ci->err = pc; #define ERR_PC_SET(mrb, pc) mrb->c->ci->err = pc;
#define ERR_PC_CLR(mrb) mrb->c->ci->err = 0;
#ifdef ENABLE_DEBUG #ifdef ENABLE_DEBUG
#define CODE_FETCH_HOOK(mrb, irep, pc, regs) if ((mrb)->code_fetch_hook) (mrb)->code_fetch_hook((mrb), (irep), (pc), (regs)); #define CODE_FETCH_HOOK(mrb, irep, pc, regs) if ((mrb)->code_fetch_hook) (mrb)->code_fetch_hook((mrb), (irep), (pc), (regs));
#else #else
...@@ -693,8 +694,9 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int ...@@ -693,8 +694,9 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int
CASE(OP_GETCV) { CASE(OP_GETCV) {
/* A B R(A) := ivget(Sym(B)) */ /* A B R(A) := ivget(Sym(B)) */
ERR_PC_HOOK(mrb, pc); ERR_PC_SET(mrb, pc);
regs[GETARG_A(i)] = mrb_vm_cv_get(mrb, syms[GETARG_Bx(i)]); regs[GETARG_A(i)] = mrb_vm_cv_get(mrb, syms[GETARG_Bx(i)]);
ERR_PC_CLR(mrb);
NEXT; NEXT;
} }
...@@ -708,8 +710,9 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int ...@@ -708,8 +710,9 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int
/* A B R(A) := constget(Sym(B)) */ /* A B R(A) := constget(Sym(B)) */
mrb_value val; mrb_value val;
ERR_PC_HOOK(mrb, pc); ERR_PC_SET(mrb, pc);
val = mrb_vm_const_get(mrb, syms[GETARG_Bx(i)]); val = mrb_vm_const_get(mrb, syms[GETARG_Bx(i)]);
ERR_PC_CLR(mrb);
regs = mrb->c->stack; regs = mrb->c->stack;
regs[GETARG_A(i)] = val; regs[GETARG_A(i)] = val;
NEXT; NEXT;
...@@ -726,8 +729,9 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int ...@@ -726,8 +729,9 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int
mrb_value val; mrb_value val;
int a = GETARG_A(i); int a = GETARG_A(i);
ERR_PC_HOOK(mrb, pc); ERR_PC_SET(mrb, pc);
val = mrb_const_get(mrb, regs[a], syms[GETARG_Bx(i)]); val = mrb_const_get(mrb, regs[a], syms[GETARG_Bx(i)]);
ERR_PC_CLR(mrb);
regs = mrb->c->stack; regs = mrb->c->stack;
regs[a] = val; regs[a] = val;
NEXT; NEXT;
...@@ -2125,6 +2129,7 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int ...@@ -2125,6 +2129,7 @@ mrb_context_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int
ecall(mrb, n); ecall(mrb, n);
} }
} }
mrb->c->ci->err = 0;
mrb->jmp = prev_jmp; mrb->jmp = prev_jmp;
if (mrb->exc) { if (mrb->exc) {
return mrb_obj_value(mrb->exc); return mrb_obj_value(mrb->exc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment