irep object is now controlled under GC

This commit is contained in:
Yuichi Nishiwaki 2014-01-18 16:53:39 +09:00
parent 586b228156
commit 11e4f1644b
3 changed files with 5 additions and 1 deletions

View File

@ -59,6 +59,7 @@ struct pic_code {
};
struct pic_irep {
PIC_OBJECT_HEADER
struct pic_code *code;
size_t clen, ccapa;
int argc, localc;

View File

@ -100,7 +100,7 @@ new_irep(pic_state *pic)
{
struct pic_irep *irep;
irep = (struct pic_irep *)pic_alloc(pic, sizeof(struct pic_irep));
irep = (struct pic_irep *)pic_obj_alloc(pic, sizeof(struct pic_irep), PIC_TT_IREP);
irep->code = (struct pic_code *)pic_alloc(pic, sizeof(struct pic_code) * 1024);
irep->clen = 0;
irep->ccapa = 1024;

View File

@ -571,6 +571,9 @@ gc_finalize_object(pic_state *pic, struct pic_object *obj)
break;
}
case PIC_TT_IREP: {
struct pic_irep *irep = (struct pic_irep *)obj;
pic_free(pic, irep->code);
pic_free(pic, irep->cv_tbl);
break;
}
case PIC_TT_NIL: