change ways of taking care of CI

This commit is contained in:
Yuichi Nishiwaki 2013-10-16 09:28:58 +09:00
parent 04896bcd93
commit a90e124697
1 changed files with 5 additions and 2 deletions

View File

@ -317,8 +317,8 @@ pic_codegen(pic_state *pic, pic_value obj, struct pic_env *env)
#define PUSH(v) (*pic->sp++ = (v)) #define PUSH(v) (*pic->sp++ = (v))
#define POP() (*--pic->sp) #define POP() (*--pic->sp)
#define PUSHCI() (++pic->ci) #define PUSHCI() (pic->ci++)
#define POPCI() (pic->ci--) #define POPCI() (--pic->ci)
pic_value pic_value
pic_run(pic_state *pic, struct pic_proc *proc, pic_value args) pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
@ -327,6 +327,8 @@ pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
int ai = pic_gc_arena_preserve(pic); int ai = pic_gc_arena_preserve(pic);
pc = proc->u.irep->code; pc = proc->u.irep->code;
PUSHCI();
pic->ci->proc = proc; pic->ci->proc = proc;
pic->ci->argc = 0; pic->ci->argc = 0;
@ -409,6 +411,7 @@ pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
} VM_LOOP_END; } VM_LOOP_END;
STOP: STOP:
POPCI();
return POP(); return POP();
} }