Skip to content

Commit

Permalink
should handle exception from Ruby implemented method called from func…
Browse files Browse the repository at this point in the history
…all; close mruby#484
  • Loading branch information
matz committed Oct 4, 2012
1 parent 72bcf7e commit 3a6b651
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
int ai = mrb->arena_idx;
jmp_buf *prev_jmp = (jmp_buf *)mrb->jmp;
jmp_buf c_jmp;
ptrdiff_t ciidx = mrb->ci - mrb->cibase;

#ifdef DIRECT_THREADED
static void *optable[] = {
Expand Down Expand Up @@ -1096,13 +1095,13 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
ci = mrb->ci;
eidx = mrb->ci->eidx;
if (ci == mrb->cibase) goto L_STOP;
if (ciidx == ci - mrb->cibase){
mrb->jmp = prev_jmp;
longjmp(*(jmp_buf*)mrb->jmp, 1);
}
while (ci[0].ridx == ci[-1].ridx) {
cipop(mrb);
ci = mrb->ci;
if (ci[1].acc < 0 && prev_jmp) {
mrb->jmp = prev_jmp;
longjmp(*(jmp_buf*)mrb->jmp, 1);
}
while (eidx > mrb->ci->eidx) {
ecall(mrb, --eidx);
}
Expand Down

0 comments on commit 3a6b651

Please sign in to comment.