Ejemplo n.º 1
0
Archivo: P6str.c Proyecto: plobsing/nqp
/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, PMC *obj) {
    P6strInstance *instance = (P6strInstance *)PMC_data(obj);
    if (!PMC_IS_NULL(instance->common.stable))
        Parrot_gc_mark_PMC_alive(interp, instance->common.stable);
    if (!PMC_IS_NULL(instance->common.sc))
        Parrot_gc_mark_PMC_alive(interp, instance->common.sc);
    if (!STRING_IS_NULL(instance->value))
        Parrot_gc_mark_STRING_alive(interp, instance->value);
}
Ejemplo n.º 2
0
/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, STable *st, void *data) {
    KnowHOWREPRBody *body = (KnowHOWREPRBody *)data;
    UNUSED(st);
    if (!STRING_IS_NULL(body->name))
        Parrot_gc_mark_STRING_alive(interp, body->name);
    if (!PMC_IS_NULL(body->methods))
        Parrot_gc_mark_PMC_alive(interp, body->methods);
    if (!PMC_IS_NULL(body->attributes))
        Parrot_gc_mark_PMC_alive(interp, body->attributes);
}
Ejemplo n.º 3
0
Archivo: P6opaque.c Proyecto: ruz/nqp
/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, PMC *obj) {
    P6opaqueInstance *instance = (P6opaqueInstance *)PMC_data(obj);
    
    /* Mark STable and SC. */
    if (!PMC_IS_NULL(instance->common.stable))
        Parrot_gc_mark_PMC_alive(interp, instance->common.stable);
    if (!PMC_IS_NULL(instance->common.sc))
        Parrot_gc_mark_PMC_alive(interp, instance->common.sc);

    /* If there's spill storage, mark that. */
    if (!PMC_IS_NULL(instance->spill))
        Parrot_gc_mark_PMC_alive(interp, instance->spill);
    
    /* Mark contained PMC and string attributes, provided this is a
     * real object. */
    if (instance->spill) {
        P6opaqueREPRData *repr_data = (P6opaqueREPRData *)STABLE(obj)->REPR_data;
        INTVAL i;

        /* Mark PMCs. */
        if (repr_data->gc_pmc_mark_offsets) {
            for (i = 0; i < repr_data->num_attributes; i++) {
                INTVAL offset = repr_data->gc_pmc_mark_offsets[i];
                if (offset) {
                    PMC *to_mark = get_pmc_at_offset(instance, offset);
                    if (!PMC_IS_NULL(to_mark))
                        Parrot_gc_mark_PMC_alive(interp, to_mark);
                }
                else {
                    break;
                }
            }
        }

        /* Mark strings. */
        if (repr_data->gc_str_mark_offsets) {
            for (i = 0; i < repr_data->num_attributes; i++) {
                INTVAL offset = repr_data->gc_str_mark_offsets[i];
                if (offset) {
                    STRING *to_mark = get_str_at_offset(instance, offset);
                    if (to_mark)
                        Parrot_gc_mark_STRING_alive(interp, to_mark);
                }
                else {
                    break;
                }
            }
        }
    }
}
Ejemplo n.º 4
0
Archivo: NFA.c Proyecto: bdw/nqp
/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, STable *st, void *data) {
    NFABody *body = (NFABody *)data;
    INTVAL i, j;
    
    if (!PMC_IS_NULL(body->fates))
        Parrot_gc_mark_PMC_alive(interp, body->fates);
    
    for (i = 0; i < body->num_states; i++) {
        INTVAL edges = body->num_state_edges[i];
        for (j = 0; j < edges; j++) {
            switch (body->states[i][j].act) {
                case EDGE_CHARLIST:
                case EDGE_CHARLIST_NEG:
                    Parrot_gc_mark_STRING_alive(interp, body->states[i][j].arg.s);
            }
        }
    }
}
Ejemplo n.º 5
0
Archivo: P6str.c Proyecto: Arcterus/nqp
/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, STable *st, void *data) {
    P6strBody *body = (P6strBody *)data;
    if (!STRING_IS_NULL(body->value))
        Parrot_gc_mark_STRING_alive(interp, body->value);
}