Permalink
Browse files

should handle exception from Ruby implemented method called from func…

…all; close #484
  • Loading branch information...
1 parent 72bcf7e commit 3a6b6518d66ff0acf11a8163404eb4e9c7bbcf1b @matz matz committed Oct 4, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/vm.c
View
@@ -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[] = {
@@ -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);
}

0 comments on commit 3a6b651

Please sign in to comment.