Skip to content

Commit

Permalink
custom destroy in sym & cons PMCs
Browse files Browse the repository at this point in the history
  • Loading branch information
stefano committed Jul 20, 2009
1 parent dfec9b9 commit c5d3fc1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/pmc/arccons.pmc
Expand Up @@ -22,7 +22,7 @@ pmclass ArcCons

VTABLE void init() {
PMC_data(SELF) = mem_allocate_zeroed_typed(Parrot_ArcCons_attributes);
PObj_custom_mark_SET(SELF);
PObj_custom_mark_destroy_SETALL(SELF);
}

VTABLE void mark() {
Expand All @@ -31,14 +31,16 @@ pmclass ArcCons
pobject_lives(INTERP, (PObj *)c->the_car);
if (c->the_cdr)
pobject_lives(INTERP, (PObj *)c->the_cdr);
/*
PMC *obj;
GET_ATTR_the_car(INTERP, SELF, obj);
pobject_lives(INTERP, (PObj*)obj);
GET_ATTR_the_cdr(INTERP, SELF, obj);
pobject_lives(INTERP, (PObj*)obj);*/
}


VTABLE void destroy() {
Parrot_ArcCons_attributes *c = PARROT_ARCCONS(SELF);
if (c) {
mem_sys_free(c);
PMC_data(SELF) = NULL;
}
}

VTABLE STRING* name() {
return Parrot_str_new_constant(INTERP, "cons");
}
Expand Down
10 changes: 9 additions & 1 deletion src/pmc/arcsym.pmc
Expand Up @@ -10,13 +10,21 @@ pmclass ArcSym
VTABLE void init() {
Parrot_ArcSym_attributes *u = mem_allocate_zeroed_typed(Parrot_ArcSym_attributes);
PMC_data(SELF) = u;
PObj_custom_mark_SET(SELF);
PObj_custom_mark_destroy_SETALL(SELF);
}

VTABLE void mark() {
Parrot_ArcSym_attributes *s = PARROT_ARCSYM(SELF);
if (s->repr)
pobject_lives(INTERP, (PObj *)s->repr);

}
VTABLE void destroy() {
Parrot_ArcSym_attributes *s = PARROT_ARCSYM(SELF);
if (s) {
mem_sys_free(s);
PMC_data(SELF) = NULL;
}
}

VTABLE STRING* name() {
Expand Down

0 comments on commit c5d3fc1

Please sign in to comment.