refactor out longjmp() to a function

This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-07-25 14:54:17 +09:00
parent 8a298605e6
commit 63e5a3cfb1
4 changed files with 17 additions and 9 deletions
+8 -2
View File
@@ -1,4 +1,4 @@
/*
/*
** vm.c - virtual machine for mruby
**
** See Copyright Notice in mruby.h
@@ -1261,7 +1261,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
mrb->c->stack = mrb->c->stbase + ci[1].stackidx;
if (ci[1].acc < 0 && prev_jmp) {
mrb->jmp = prev_jmp;
longjmp(*(jmp_buf*)mrb->jmp, 1);
mrb_longjmp(mrb);
}
while (eidx > ci->eidx) {
ecall(mrb, --eidx);
@@ -2127,3 +2127,9 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
}
END_DISPATCH;
}
void
mrb_longjmp(mrb_state *mrb)
{
longjmp(*(jmp_buf*)mrb->jmp, 1);
}