store stack base and end

This commit is contained in:
Yuichi Nishiwaki 2013-10-12 00:20:53 +09:00
parent 643d8be66d
commit 1a45eab148
2 changed files with 7 additions and 1 deletions

View File

@ -13,6 +13,8 @@ struct pic_env {
typedef struct {
pic_value *sp;
pic_value *stbase, *stend;
struct pic_env *global_env;
} pic_state;

View File

@ -20,7 +20,11 @@ pic_open()
pic_state *pic;
pic = (pic_state *)malloc(sizeof(pic_state));
pic->sp = (pic_value *)malloc(sizeof(pic_value) * 1024);
/* prepare VM stack */
pic->stbase = pic->sp = (pic_value *)malloc(sizeof(pic_value) * 1024);
pic->stend = pic->stbase + 1024;
pic->global_env = pic_new_empty_env();
return pic;