add pic_obj_alloc_unsafe; preparation for yy_arena
This commit is contained in:
parent
9662ab30ec
commit
f506eac3dd
|
@ -82,6 +82,7 @@ void *pic_alloc(pic_state *, size_t);
|
||||||
void *pic_realloc(pic_state *, void *, size_t);
|
void *pic_realloc(pic_state *, void *, size_t);
|
||||||
void *pic_calloc(pic_state *, unsigned, size_t);
|
void *pic_calloc(pic_state *, unsigned, size_t);
|
||||||
struct pic_object *pic_obj_alloc(pic_state *, size_t, enum pic_tt);
|
struct pic_object *pic_obj_alloc(pic_state *, size_t, enum pic_tt);
|
||||||
|
struct pic_object *pic_obj_alloc_unsafe(pic_state *, size_t, enum pic_tt);
|
||||||
void pic_free(pic_state *, void *);
|
void pic_free(pic_state *, void *);
|
||||||
|
|
||||||
void pic_gc_protect(pic_state *, pic_value);
|
void pic_gc_protect(pic_state *, pic_value);
|
||||||
|
|
12
src/gc.c
12
src/gc.c
|
@ -466,7 +466,7 @@ pic_gc_run(pic_state *pic)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pic_object *
|
struct pic_object *
|
||||||
pic_obj_alloc(pic_state *pic, size_t size, enum pic_tt tt)
|
pic_obj_alloc_unsafe(pic_state *pic, size_t size, enum pic_tt tt)
|
||||||
{
|
{
|
||||||
struct pic_object *obj;
|
struct pic_object *obj;
|
||||||
|
|
||||||
|
@ -483,6 +483,16 @@ pic_obj_alloc(pic_state *pic, size_t size, enum pic_tt tt)
|
||||||
}
|
}
|
||||||
obj->tt = tt;
|
obj->tt = tt;
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct pic_object *
|
||||||
|
pic_obj_alloc(pic_state *pic, size_t size, enum pic_tt tt)
|
||||||
|
{
|
||||||
|
struct pic_object *obj;
|
||||||
|
|
||||||
|
obj = pic_obj_alloc_unsafe(pic, size, tt);
|
||||||
|
|
||||||
gc_protect(pic, obj);
|
gc_protect(pic, obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue