From 80a794310d747b8a1b16b6dc3c9f97a892ee45da Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 20 Feb 2014 20:59:35 +0900 Subject: [PATCH] call/cc must save pic->ip --- include/picrin/cont.h | 2 ++ src/cont.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/picrin/cont.h b/include/picrin/cont.h index 06a511cb..bf5dc07e 100644 --- a/include/picrin/cont.h +++ b/include/picrin/cont.h @@ -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; diff --git a/src/cont.c b/src/cont.c index 4f4d158e..9e77a1f0 100644 --- a/src/cont.c +++ b/src/cont.c @@ -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;