call/cc must save pic->ip

This commit is contained in:
Yuichi Nishiwaki 2014-02-20 20:59:35 +09:00
parent 078b72ff17
commit 80a794310d
2 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,8 @@ struct pic_cont {
pic_callinfo *ci_ptr;
size_t ci_offset, ci_len;
struct pic_code *ip;
struct pic_proc **rescue;
size_t ridx, rlen;

View File

@ -117,6 +117,8 @@ save_cont(pic_state *pic, struct pic_cont **c)
cont->ci_ptr = (pic_callinfo *)pic_alloc(pic, sizeof(pic_callinfo) * cont->ci_len);
memcpy(cont->ci_ptr, pic->cibase, sizeof(pic_callinfo) * cont->ci_len);
cont->ip = pic->ip;
cont->ridx = pic->ridx;
cont->rlen = pic->rlen;
cont->rescue = (struct pic_proc **)pic_alloc(pic, sizeof(struct pic_proc *) * cont->rlen);
@ -164,6 +166,8 @@ restore_cont(pic_state *pic, struct pic_cont *cont)
pic->ci = pic->cibase + cont->ci_offset;
pic->ciend = pic->cibase + cont->ci_len;
pic->ip = cont->ip;
pic->rescue = (struct pic_proc **)pic_realloc(pic, pic->rescue, sizeof(struct pic_proc *) * cont->rlen);
memcpy(pic->rescue, cont->rescue, sizeof(struct pic_object *) * cont->rlen);
pic->ridx = cont->ridx;