From c22f566c06860313bebf8c005b719d6907ba8ffe Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Fri, 15 Nov 2013 10:54:56 +0900 Subject: [PATCH] arena stash can be statically allocated --- include/picrin/cont.h | 2 +- src/cont.c | 1 - src/gc.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/picrin/cont.h b/include/picrin/cont.h index 9fe4390f..f1b9cb80 100644 --- a/include/picrin/cont.h +++ b/include/picrin/cont.h @@ -16,7 +16,7 @@ struct pic_cont { pic_callinfo *ci, *ci_ptr; size_t ci_len; - struct pic_object **arena; + struct pic_object *arena[PIC_ARENA_SIZE]; int arena_idx; pic_value result; diff --git a/src/cont.c b/src/cont.c index f897620e..0f9229ef 100644 --- a/src/cont.c +++ b/src/cont.c @@ -47,7 +47,6 @@ save_cont(pic_state *pic) 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; memcpy(cont->arena, pic->arena, sizeof(struct pic_object *) * PIC_ARENA_SIZE); diff --git a/src/gc.c b/src/gc.c index 6a507f32..152cf061 100644 --- a/src/gc.c +++ b/src/gc.c @@ -336,7 +336,6 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj) pic_free(pic, cont->stk_ptr); pic_free(pic, cont->st_ptr); pic_free(pic, cont->ci_ptr); - pic_free(pic, cont->arena); break; } case PIC_TT_NIL: