rename fields in struct pic_cont
This commit is contained in:
parent
28979c0e62
commit
8b484b69d7
|
@ -8,11 +8,11 @@ struct pic_cont {
|
|||
size_t stk_len;
|
||||
pic_value *stk_pos, *stk_ptr;
|
||||
|
||||
pic_value *sp;
|
||||
pic_value *stbase, *stend;
|
||||
pic_value *sp, *st_ptr;
|
||||
size_t st_len;
|
||||
|
||||
pic_callinfo *ci;
|
||||
pic_callinfo *cibase, *ciend;
|
||||
pic_callinfo *ci, *ci_ptr;
|
||||
size_t ci_len;
|
||||
|
||||
struct pic_object **arena;
|
||||
int arena_idx;
|
||||
|
|
16
src/cont.c
16
src/cont.c
|
@ -35,15 +35,15 @@ save_cont(pic_state *pic)
|
|||
cont->stk_ptr = pic_alloc(pic, sizeof(pic_value) * cont->stk_len);
|
||||
memcpy(cont->stk_ptr, cont->stk_pos, sizeof(pic_value) * cont->stk_len);
|
||||
|
||||
cont->stbase = (pic_value *)pic_alloc(pic, sizeof(pic_value) * (pic->stend - pic->stbase));
|
||||
cont->stend = cont->stbase + (pic->stend - pic->stbase);
|
||||
cont->sp = pic->sp;
|
||||
memcpy(cont->stbase, pic->stbase, sizeof(pic_value) * (pic->stend - pic->stbase));
|
||||
cont->st_len = pic->stend - pic->stbase;
|
||||
cont->st_ptr = (pic_value *)pic_alloc(pic, sizeof(pic_value) * cont->st_len);
|
||||
memcpy(cont->st_ptr, pic->stbase, sizeof(pic_value) * cont->st_len);
|
||||
|
||||
cont->cibase = (pic_callinfo *)pic_alloc(pic, sizeof(pic_callinfo) * (pic->ciend - pic->cibase));
|
||||
cont->ciend = cont->cibase + (pic->ciend - pic->cibase);
|
||||
cont->ci = pic->ci;
|
||||
memcpy(cont->cibase, pic->cibase, sizeof(pic_callinfo) * (pic->ciend - pic->cibase));
|
||||
cont->ci_len = pic->ciend - pic->cibase;
|
||||
cont->ci_ptr = (pic_callinfo *)pic_alloc(pic, sizeof(pic_callinfo) * cont->ci_len);
|
||||
memcpy(cont->ci_ptr, pic->cibase, sizeof(pic_callinfo) * cont->ci_len);
|
||||
|
||||
cont->arena = (struct pic_object **)pic_alloc(pic, sizeof(struct pic_object *) * PIC_ARENA_SIZE);
|
||||
cont->arena_idx = pic->arena_idx;
|
||||
|
@ -77,10 +77,10 @@ restore_cont(pic_state *pic, struct pic_cont *cont)
|
|||
}
|
||||
|
||||
pic->sp = cont->sp;
|
||||
memcpy(pic->stbase, cont->stbase, sizeof(pic_value) * (cont->stend - cont->stbase));
|
||||
memcpy(pic->stbase, cont->st_ptr, sizeof(pic_value) * cont->st_len);
|
||||
|
||||
pic->ci = cont->ci;
|
||||
memcpy(pic->cibase, cont->cibase, sizeof(pic_callinfo) * (cont->ciend - cont->cibase));
|
||||
memcpy(pic->cibase, cont->ci_ptr, sizeof(pic_callinfo) * cont->ci_len);
|
||||
|
||||
memcpy(pic->arena, cont->arena, sizeof(struct pic_object *) * PIC_ARENA_SIZE);
|
||||
pic->arena_idx = cont->arena_idx;
|
||||
|
|
8
src/gc.c
8
src/gc.c
|
@ -199,12 +199,12 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
|
|||
int i;
|
||||
|
||||
/* stack */
|
||||
for (stack = cont->stbase; stack != cont->sp; ++stack) {
|
||||
for (stack = cont->st_ptr; stack != cont->sp; ++stack) {
|
||||
gc_mark(pic, *stack);
|
||||
}
|
||||
|
||||
/* callinfo */
|
||||
for (ci = cont->ci; ci != cont->cibase; --ci) {
|
||||
for (ci = cont->ci; ci != cont->ci_ptr; --ci) {
|
||||
if (ci->env) {
|
||||
gc_mark_object(pic, (struct pic_object *)ci->env);
|
||||
}
|
||||
|
@ -334,8 +334,8 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj)
|
|||
case PIC_TT_CONT: {
|
||||
struct pic_cont *cont = (struct pic_cont *)obj;
|
||||
pic_free(pic, cont->stk_ptr);
|
||||
pic_free(pic, cont->stbase);
|
||||
pic_free(pic, cont->cibase);
|
||||
pic_free(pic, cont->st_ptr);
|
||||
pic_free(pic, cont->ci_ptr);
|
||||
pic_free(pic, cont->arena);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue