typedef struct pic_block pic_block

This commit is contained in:
Yuichi Nishiwaki 2014-03-07 22:09:12 +09:00
parent 751d0f87f8
commit 920674a6ef
6 changed files with 11 additions and 11 deletions

View File

@ -68,18 +68,18 @@ typedef struct {
struct pic_env *env; struct pic_env *env;
} pic_callinfo; } pic_callinfo;
struct pic_block { typedef struct pic_block {
struct pic_block *prev; struct pic_block *prev;
int depth; int depth;
struct pic_proc *in, *out; struct pic_proc *in, *out;
unsigned refcnt; unsigned refcnt;
}; } pic_block;
typedef struct { typedef struct {
int argc; int argc;
char **argv, **envp; char **argv, **envp;
struct pic_block *blk; pic_block *blk;
pic_value *sp; pic_value *sp;
pic_value *stbase, *stend; pic_value *stbase, *stend;

View File

@ -13,7 +13,7 @@ struct pic_cont {
PIC_OBJECT_HEADER PIC_OBJECT_HEADER
jmp_buf jmp; jmp_buf jmp;
struct pic_block *blk; pic_block *blk;
pic_value *stk_pos, *stk_ptr; pic_value *stk_pos, *stk_ptr;
size_t stk_len; size_t stk_len;
@ -40,7 +40,7 @@ struct pic_cont {
} while (0) } while (0)
#define PIC_BLK_DECREF(pic,blk) do { \ #define PIC_BLK_DECREF(pic,blk) do { \
struct pic_block *_a = (blk), *_b; \ pic_block *_a = (blk), *_b; \
while (_a) { \ while (_a) { \
if (! --_a->refcnt) { \ if (! --_a->refcnt) { \
_b = _a->prev; \ _b = _a->prev; \

View File

@ -182,7 +182,7 @@ restore_cont(pic_state *pic, struct pic_cont *cont)
} }
static void static void
walk_to_block(pic_state *pic, struct pic_block *here, struct pic_block *there) walk_to_block(pic_state *pic, pic_block *here, pic_block *there)
{ {
if (here == there) if (here == there)
return; return;
@ -282,10 +282,10 @@ pic_cont_dynamic_wind(pic_state *pic)
/* enter */ /* enter */
pic_apply_argv(pic, in, 0); pic_apply_argv(pic, in, 0);
{ {
struct pic_block *here; pic_block *here;
here = pic->blk; here = pic->blk;
pic->blk = (struct pic_block *)pic_alloc(pic, sizeof(struct pic_block)); pic->blk = (pic_block *)pic_alloc(pic, sizeof(pic_block));
pic->blk->prev = here; pic->blk->prev = here;
pic->blk->depth = here->depth + 1; pic->blk->depth = here->depth + 1;
pic->blk->in = in; pic->blk->in = in;

View File

@ -318,7 +318,7 @@ static void gc_mark(pic_state *, pic_value);
static void gc_mark_object(pic_state *pic, struct pic_object *obj); static void gc_mark_object(pic_state *pic, struct pic_object *obj);
static void static void
gc_mark_block(pic_state *pic, struct pic_block *blk) gc_mark_block(pic_state *pic, pic_block *blk)
{ {
while (blk) { while (blk) {
if (blk->in) if (blk->in)

View File

@ -28,7 +28,7 @@ pic_open(int argc, char *argv[], char **envp)
pic->envp = envp; pic->envp = envp;
/* root block */ /* root block */
pic->blk = (struct pic_block *)malloc(sizeof(struct pic_block)); pic->blk = (pic_block *)malloc(sizeof(pic_block));
pic->blk->prev = NULL; pic->blk->prev = NULL;
pic->blk->depth = 0; pic->blk->depth = 0;
pic->blk->in = pic->blk->out = NULL; pic->blk->in = pic->blk->out = NULL;

View File

@ -31,7 +31,7 @@ pic_system_exit(pic_state *pic)
{ {
pic_value v; pic_value v;
int argc, status = EXIT_SUCCESS; int argc, status = EXIT_SUCCESS;
struct pic_block *blk; pic_block *blk;
argc = pic_get_args(pic, "|o", &v); argc = pic_get_args(pic, "|o", &v);
if (argc == 1) { if (argc == 1) {