Skip to content

Commit fe29d89

Browse files
committed
Missing GC marking in VMArray REPR on Parrot.
1 parent 3fde283 commit fe29d89

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/vm/parrot/6model/reprs/VMArray.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,23 @@ static void gc_free(PARROT_INTERP, PMC *obj) {
332332
mem_sys_free(instance);
333333
}
334334

335+
/* This Parrot-specific addition to the API is used to mark a repr's
336+
* per-type data. */
337+
static void gc_mark_repr_data(PARROT_INTERP, STable *st) {
338+
VMArrayREPRData *repr_data = (VMArrayREPRData *) st->REPR_data;
339+
if (repr_data)
340+
Parrot_gc_mark_PMC_alive(interp, repr_data->elem_type);
341+
}
342+
343+
/* This Parrot-specific addition to the API is used to free a repr instance. */
344+
static void gc_free_repr_data(PARROT_INTERP, STable *st) {
345+
if (st->REPR_data) {
346+
free(st->REPR_data);
347+
st->REPR_data = NULL;
348+
}
349+
}
350+
351+
335352
static void at_pos_native(PARROT_INTERP, STable *st, void *data, INTVAL index, NativeValue *value) {
336353
VMArrayBody *body = (VMArrayBody *) data;
337354
VMArrayREPRData *repr_data = (VMArrayREPRData *) st->REPR_data;
@@ -518,6 +535,8 @@ REPROps * VMArray_initialize(PARROT_INTERP) {
518535
this_repr->serialize_repr_data = serialize_repr_data;
519536
this_repr->deserialize_repr_data = deserialize_repr_data;
520537
this_repr->gc_free = gc_free;
538+
this_repr->gc_mark_repr_data = gc_mark_repr_data;
539+
this_repr->gc_free_repr_data = gc_free_repr_data;
521540
this_repr->get_storage_spec = get_storage_spec;
522541
this_repr->pos_funcs = mem_allocate_zeroed_typed(REPROps_Positional);
523542
this_repr->pos_funcs->at_pos_native = at_pos_native;

0 commit comments

Comments
 (0)