vm_tear_off should happen in cont. saving, not in restoring

This commit is contained in:
Yuichi Nishiwaki 2014-09-01 08:56:59 +09:00
parent 5c090a48ef
commit 129c4c1bd9
1 changed files with 3 additions and 3 deletions

6
cont.c
View File

@ -112,9 +112,12 @@ native_stack_length(pic_state *pic, char **pos)
static void static void
save_cont(pic_state *pic, struct pic_cont **c) save_cont(pic_state *pic, struct pic_cont **c)
{ {
void pic_vm_tear_off(pic_state *);
struct pic_cont *cont; struct pic_cont *cont;
char *pos; char *pos;
pic_vm_tear_off(pic); /* tear off */
cont = *c = (struct pic_cont *)pic_obj_alloc(pic, sizeof(struct pic_cont), PIC_TT_CONT); cont = *c = (struct pic_cont *)pic_obj_alloc(pic, sizeof(struct pic_cont), PIC_TT_CONT);
cont->blk = pic->blk; cont->blk = pic->blk;
@ -162,13 +165,10 @@ native_stack_extend(pic_state *pic, struct pic_cont *cont)
noreturn static void noreturn static void
restore_cont(pic_state *pic, struct pic_cont *cont) restore_cont(pic_state *pic, struct pic_cont *cont)
{ {
void pic_vm_tear_off(pic_state *);
char v; char v;
struct pic_cont *tmp = cont; struct pic_cont *tmp = cont;
struct pic_block *blk; struct pic_block *blk;
pic_vm_tear_off(pic); /* tear off */
if (&v < pic->native_stack_start) { if (&v < pic->native_stack_start) {
if (&v > cont->stk_pos) native_stack_extend(pic, cont); if (&v > cont->stk_pos) native_stack_extend(pic, cont);
} }