add custom marker

This commit is contained in:
Yuichi Nishiwaki 2014-09-16 16:18:19 +09:00
parent db5a4e367b
commit eb261a293a
2 changed files with 4 additions and 0 deletions

3
gc.c
View File

@ -481,6 +481,9 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
while (xh_next(&it)) {
gc_mark(pic, xh_val(it.e, pic_value));
}
if (data->type->mark) {
data->type->mark(pic, data->data, gc_mark);
}
break;
}
case PIC_TT_DICT: {

View File

@ -12,6 +12,7 @@ extern "C" {
typedef struct {
const char *type_name;
void (*dtor)(pic_state *, void *);
void (*mark)(pic_state *, void *, void (*)(pic_state *, pic_value));
} pic_data_type;
struct pic_data {