s/pic_winder/pic_checkpoint/g

This commit is contained in:
Yuichi Nishiwaki 2015-06-08 21:04:04 +09:00
parent 0c3adf3d65
commit 5def1df320
6 changed files with 48 additions and 48 deletions

View File

@ -5,7 +5,7 @@ struct pic_fullcont {
pic_jmpbuf *prev_jmp;
struct pic_winder *wind;
pic_checkpoint *cp;
char *stk_pos, *stk_ptr;
ptrdiff_t stk_len;
@ -45,19 +45,19 @@ static void
cont_mark(pic_state *pic, void *data, void (*mark)(pic_state *, pic_value))
{
struct pic_fullcont *cont = data;
struct pic_winder *wind;
pic_checkpoint *cp;
pic_value *stack;
pic_callinfo *ci;
struct pic_proc **xp;
size_t i;
/* winder */
for (wind = cont->wind; wind != NULL; wind = wind->prev) {
if (wind->in) {
mark(pic, pic_obj_value(wind->in));
/* checkpoint */
for (cp = cont->cp; cp != NULL; cp = cp->prev) {
if (cp->in) {
mark(pic, pic_obj_value(cp->in));
}
if (wind->out) {
mark(pic, pic_obj_value(wind->out));
if (cp->out) {
mark(pic, pic_obj_value(cp->out));
}
}
@ -119,7 +119,7 @@ save_cont(pic_state *pic, struct pic_fullcont **c)
cont->prev_jmp = pic->jmp;
cont->wind = pic->wind;
cont->cp = pic->cp;
cont->stk_len = native_stack_length(pic, &pos);
cont->stk_pos = pos;
@ -176,7 +176,7 @@ restore_cont(pic_state *pic, struct pic_fullcont *cont)
pic->jmp = cont->prev_jmp;
pic->wind = cont->wind;
pic->cp = cont->cp;
pic->stbase = pic_realloc(pic, pic->stbase, sizeof(pic_value) * cont->st_len);
memcpy(pic->stbase, cont->st_ptr, sizeof(pic_value) * cont->st_len);
@ -220,7 +220,7 @@ cont_call(pic_state *pic)
cont->results = pic_list_by_array(pic, argc, argv);
/* execute guard handlers */
pic_wind(pic, pic->wind, cont->wind);
pic_wind(pic, pic->cp, cont->cp);
restore_cont(pic, cont);
}

View File

@ -5,7 +5,7 @@
#include "picrin.h"
void
pic_wind(pic_state *pic, struct pic_winder *here, struct pic_winder *there)
pic_wind(pic_state *pic, pic_checkpoint *here, pic_checkpoint *there)
{
if (here == there)
return;
@ -23,23 +23,23 @@ pic_wind(pic_state *pic, struct pic_winder *here, struct pic_winder *there)
pic_value
pic_dynamic_wind(pic_state *pic, struct pic_proc *in, struct pic_proc *thunk, struct pic_proc *out)
{
struct pic_winder *here;
pic_checkpoint *here;
pic_value val;
if (in != NULL) {
pic_apply0(pic, in); /* enter */
}
here = pic->wind;
pic->wind = pic_malloc(pic, sizeof(struct pic_winder));
pic->wind->prev = here;
pic->wind->depth = here->depth + 1;
pic->wind->in = in;
pic->wind->out = out;
here = pic->cp;
pic->cp = pic_malloc(pic, sizeof(pic_checkpoint));
pic->cp->prev = here;
pic->cp->depth = here->depth + 1;
pic->cp->in = in;
pic->cp->out = out;
val = pic_apply0(pic, thunk);
pic->wind = here;
pic->cp = here;
if (out != NULL) {
pic_apply0(pic, out); /* exit */
@ -55,7 +55,7 @@ pic_save_point(pic_state *pic, struct pic_cont *cont)
pic->jmp = &cont->jmp;
/* save runtime context */
cont->wind = pic->wind;
cont->cp = pic->cp;
cont->sp_offset = pic->sp - pic->stbase;
cont->ci_offset = pic->ci - pic->cibase;
cont->xp_offset = pic->xp - pic->xpbase;
@ -79,10 +79,10 @@ pic_load_point(pic_state *pic, struct pic_cont *cont)
pic_errorf(pic, "calling dead escape continuation");
}
pic_wind(pic, pic->wind, cont->wind);
pic_wind(pic, pic->cp, cont->cp);
/* load runtime context */
pic->wind = cont->wind;
pic->cp = cont->cp;
pic->sp = pic->stbase + cont->sp_offset;
pic->ci = pic->cibase + cont->ci_offset;
pic->xp = pic->xpbase + cont->xp_offset;

View File

@ -324,16 +324,16 @@ gc_unmark(union header *p)
}
static void
gc_mark_winder(pic_state *pic, struct pic_winder *wind)
gc_mark_checkpoint(pic_state *pic, pic_checkpoint *cp)
{
if (wind->prev) {
gc_mark_object(pic, (struct pic_object *)wind->prev);
if (cp->prev) {
gc_mark_object(pic, (struct pic_object *)cp->prev);
}
if (wind->in) {
gc_mark_object(pic, (struct pic_object *)wind->in);
if (cp->in) {
gc_mark_object(pic, (struct pic_object *)cp->in);
}
if (wind->out) {
gc_mark_object(pic, (struct pic_object *)wind->out);
if (cp->out) {
gc_mark_object(pic, (struct pic_object *)cp->out);
}
}
@ -538,9 +538,9 @@ gc_mark_phase(pic_state *pic)
xh_entry *it;
struct pic_object *obj;
/* winder */
if (pic->wind) {
gc_mark_winder(pic, pic->wind);
/* checkpoint */
if (pic->cp) {
gc_mark_checkpoint(pic, pic->cp);
}
/* stack */

View File

@ -53,12 +53,12 @@ typedef struct pic_jmpbuf {
struct pic_jmpbuf *prev;
} pic_jmpbuf;
struct pic_winder {
typedef struct pic_checkpoint {
struct pic_proc *in;
struct pic_proc *out;
int depth;
struct pic_winder *prev;
};
struct pic_checkpoint *prev;
} pic_checkpoint;
typedef struct {
int argc, retc;
@ -79,7 +79,7 @@ typedef struct {
pic_allocf allocf;
pic_jmpbuf *jmp;
struct pic_winder *wind;
pic_checkpoint *cp;
pic_value *sp;
pic_value *stbase, *stend;

View File

@ -12,7 +12,7 @@ extern "C" {
struct pic_cont {
pic_jmpbuf jmp;
struct pic_winder *wind;
pic_checkpoint *cp;
ptrdiff_t sp_offset;
ptrdiff_t ci_offset;
@ -29,7 +29,7 @@ void pic_load_point(pic_state *, struct pic_cont *);
struct pic_proc *pic_make_cont(pic_state *, struct pic_cont *);
void pic_wind(pic_state *, struct pic_winder *, struct pic_winder *);
void pic_wind(pic_state *, pic_checkpoint *, pic_checkpoint *);
pic_value pic_dynamic_wind(pic_state *, struct pic_proc *, struct pic_proc *, struct pic_proc *);
pic_value pic_values0(pic_state *);

View File

@ -160,7 +160,7 @@ pic_open(int argc, char *argv[], char **envp, pic_allocf allocf)
pic->jmp = NULL;
/* root block */
pic->wind = NULL;
pic->cp = NULL;
/* command line */
pic->argc = argc;
@ -329,10 +329,10 @@ pic_open(int argc, char *argv[], char **envp, pic_allocf allocf)
pic->macros = pic_make_dict(pic);
/* root block */
pic->wind = pic_malloc(pic, sizeof(struct pic_winder));
pic->wind->prev = NULL;
pic->wind->depth = 0;
pic->wind->in = pic->wind->out = NULL;
pic->cp = pic_malloc(pic, sizeof(pic_checkpoint));
pic->cp->prev = NULL;
pic->cp->depth = 0;
pic->cp->in = pic->cp->out = NULL;
/* reader */
pic->reader = pic_reader_open(pic);
@ -378,11 +378,11 @@ pic_close(pic_state *pic)
pic_allocf allocf = pic->allocf;
/* invoke exit handlers */
while (pic->wind) {
if (pic->wind->out) {
pic_apply0(pic, pic->wind->out);
while (pic->cp) {
if (pic->cp->out) {
pic_apply0(pic, pic->cp->out);
}
pic->wind = pic->wind->prev;
pic->cp = pic->cp->prev;
}
/* free symbol names */