unwind picrin VM registers when pic_pop_try is called

This commit is contained in:
Yuichi Nishiwaki 2014-04-06 14:02:50 +09:00
parent 5893dd5b5c
commit f5a4047e28
2 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,9 @@ extern "C" {
struct pic_jmpbuf {
jmp_buf here;
pic_callinfo *ci;
pic_value *sp;
pic_code *ip;
jmp_buf *prev_jmp;
struct pic_jmpbuf *prev;
};

View File

@ -41,6 +41,10 @@ pic_push_try(pic_state *pic)
try_jmp = pic_alloc(pic, sizeof(struct pic_jmpbuf));
try_jmp->ci = pic->ci;
try_jmp->sp = pic->sp;
try_jmp->ip = pic->ip;
try_jmp->prev_jmp = pic->jmp;
pic->jmp = &try_jmp->here;
@ -55,6 +59,10 @@ pic_pop_try(pic_state *pic)
assert(pic->jmp == &pic->try_jmps->here);
pic->ci = pic->try_jmps->ci;
pic->sp = pic->try_jmps->sp;
pic->ip = pic->try_jmps->ip;
pic->jmp = pic->try_jmps->prev_jmp;
prev = pic->try_jmps->prev;