示例#1
0
文件: descr.cpp 项目: rowhit/pyston
void BoxedMethodDescriptor::gcHandler(GCVisitor* v, Box* _o) {
    assert(_o->cls == method_cls);
    BoxedMethodDescriptor* o = static_cast<BoxedMethodDescriptor*>(_o);

    boxGCHandler(v, o);
    v->visit(o->type);
}
示例#2
0
文件: descr.cpp 项目: rowhit/pyston
void BoxedWrapperObject::gcHandler(GCVisitor* v, Box* _o) {
    assert(_o->cls == wrapperobject_cls);
    BoxedWrapperObject* o = static_cast<BoxedWrapperObject*>(_o);

    boxGCHandler(v, o);
    v->visit(o->obj);
}
示例#3
0
文件: set.cpp 项目: kod3r/pyston
extern "C" void setIteratorGCHandler(GCVisitor* v, Box* b) {
    boxGCHandler(v, b);

    BoxedSetIterator* it = (BoxedSetIterator*)b;

    v->visit(it->s);
}
示例#4
0
文件: long.cpp 项目: lameiro/pyston
void BoxedLong::gchandler(GCVisitor* v, Box* b) {
    boxGCHandler(v, b);

    BoxedLong* l = (BoxedLong*)b;

    v->visitPotentialRange((void**)&l->n, (void**)((&l->n) + 1));
}
示例#5
0
文件: descr.cpp 项目: rowhit/pyston
void BoxedWrapperDescriptor::gcHandler(GCVisitor* v, Box* _o) {
    assert(_o->cls == wrapperdescr_cls);
    BoxedWrapperDescriptor* o = static_cast<BoxedWrapperDescriptor*>(_o);

    boxGCHandler(v, o);
    v->visit(o->type);
}
示例#6
0
static void iterwrapperGCVisit(GCVisitor* v, Box* b) {
    assert(b->cls == iterwrapper_cls);
    boxGCHandler(v, b);

    BoxedIterWrapper* iw = static_cast<BoxedIterWrapper*>(b);
    v->visit(iw->iter);
    if (iw->next)
        v->visit(iw->next);
}
示例#7
0
static void seqiterGCVisit(GCVisitor* v, Box* b) {
    assert(b->cls == seqiter_cls || b->cls == seqreviter_cls);
    boxGCHandler(v, b);

    BoxedSeqIter* si = static_cast<BoxedSeqIter*>(b);
    v->visit(si->b);
    if (si->next)
        v->visit(si->next);
}
示例#8
0
// This probably belongs in tuple.cpp?
extern "C" void tupleGCHandler(GCVisitor *v, void* p) {
    boxGCHandler(v, p);

    BoxedTuple *t = (BoxedTuple*)p;
    int size = t->elts.size();
    for (int i = 0; i < size; i++) {
        v->visit(t->elts[i]);
    }
}
示例#9
0
extern "C" void sliceGCHandler(GCVisitor* v, void* p) {
    boxGCHandler(v, p);

    BoxedSlice* sl = static_cast<BoxedSlice*>(p);
    assert(sl->cls == slice_cls);

    v->visit(sl->start);
    v->visit(sl->stop);
    v->visit(sl->step);
}
示例#10
0
    static void gcHandler(GCVisitor* v, Box* _o) {
        assert(_o->cls == super_cls);
        BoxedSuper* o = static_cast<BoxedSuper*>(_o);

        boxGCHandler(v, o);
        if (o->type)
            v->visit(o->type);
        if (o->obj)
            v->visit(o->obj);
        if (o->obj_type)
            v->visit(o->obj_type);
    }
示例#11
0
// This probably belongs in list.cpp?
extern "C" void listGCHandler(GCVisitor *v, void* p) {
    boxGCHandler(v, p);

    BoxedList *l = (BoxedList*)p;
    int size = l->size;
    if (size) {
        v->visit(l->elts);
        v->visitRange((void**)&l->elts->elts[0], (void**)&l->elts->elts[size]);
    }

    static StatCounter sc("gc_listelts_visited");
    sc.log(size);
}
示例#12
0
// This probably belongs in dict.cpp?
extern "C" void dictGCHandler(GCVisitor* v, void* p) {
    boxGCHandler(v, p);

    BoxedDict* d = (BoxedDict*)p;

    // This feels like a cludge, but we need to find anything that
    // the unordered_map might have allocated.
    // Another way to handle this would be to rt_alloc the unordered_map
    // as well, though that incurs extra memory dereferences which would
    // be nice to avoid.
    void** start = (void**)&d->d;
    void** end = start + (sizeof(d->d) / 8);
    v->visitPotentialRange(start, end);
}
示例#13
0
extern "C" void hcBoxGCHandler(GCVisitor *v, void* p) {
    boxGCHandler(v, p);

    HCBox* b = (HCBox*)p;
    v->visit(b->hcls);
    int nattrs = b->hcls->attr_offsets.size();
    if (nattrs) {
        HCBox::AttrList *attr_list = b->attr_list;
        assert(attr_list);
        v->visit(attr_list);
        for (int i = 0; i < nattrs; i++) {
            v->visit(attr_list->attrs[i]);
        }
    }
}
示例#14
0
// This probably belongs in dict.cpp?
extern "C" void functionGCHandler(GCVisitor* v, void* p) {
    boxGCHandler(v, p);

    BoxedFunction* f = (BoxedFunction*)p;

    // It's ok for f->defaults to be NULL here even if f->ndefaults isn't,
    // since we could be collecting from inside a BoxedFunction constructor
    if (f->ndefaults) {
        assert(f->defaults);
        v->visit(f->defaults);
        // do a conservative scan since there can be NULLs in there:
        v->visitPotentialRange(reinterpret_cast<void* const*>(&f->defaults[0]),
                               reinterpret_cast<void* const*>(&f->defaults[f->ndefaults]));
    }
}
示例#15
0
extern "C" void generatorGCHandler(GCVisitor* v, Box* b) {
    boxGCHandler(v, b);

    BoxedGenerator* g = (BoxedGenerator*)b;

    v->visit(g->function);
    int num_args = g->function->f->numReceivedArgs();
    if (num_args >= 1)
        v->visit(g->arg1);
    if (num_args >= 2)
        v->visit(g->arg2);
    if (num_args >= 3)
        v->visit(g->arg3);
    if (g->args)
        v->visit(g->args);
    if (num_args > 3)
        v->visitPotentialRange(reinterpret_cast<void* const*>(&g->args->elts[0]),
                               reinterpret_cast<void* const*>(&g->args->elts[num_args - 3]));
    if (g->returnValue)
        v->visit(g->returnValue);
    if (g->exception.type)
        v->visit(g->exception.type);
    if (g->exception.value)
        v->visit(g->exception.value);
    if (g->exception.traceback)
        v->visit(g->exception.traceback);

    if (g->running) {
        v->visitPotentialRange((void**)&g->returnContext,
                               ((void**)&g->returnContext) + sizeof(g->returnContext) / sizeof(void*));
    } else {
        // g->context is always set for a running generator, but we can trigger a GC while constructing
        // a generator in which case we can see a NULL context
        if (g->context) {
#if STACK_GROWS_DOWN
            v->visitPotentialRange((void**)g->context, (void**)g->stack_begin);
#endif
        }
    }
}
示例#16
0
// This probably belongs in tuple.cpp?
extern "C" void tupleGCHandler(GCVisitor* v, void* p) {
    boxGCHandler(v, p);

    BoxedTuple* t = (BoxedTuple*)p;
    v->visitPotentialRange((void* const*)&t->elts, (void* const*)(&t->elts + 1));
}
示例#17
0
文件: dict.cpp 项目: Usarak/pyston
extern "C" void dictIteratorGCHandler(GCVisitor* v, void* p) {
    boxGCHandler(v, p);
    BoxedDictIterator* it = (BoxedDictIterator*)p;
    v->visit(it->d);
}
示例#18
0
extern "C" void listIteratorGCHandler(GCVisitor* v, void* p) {
    boxGCHandler(v, p);
    BoxedListIterator* it = (BoxedListIterator*)p;
    v->visit(it->l);
}
示例#19
0
extern "C" void typeGCHandler(GCVisitor* v, void* p) {
    boxGCHandler(v, p);

    BoxedClass* b = (BoxedClass*)p;
}
示例#20
0
文件: tuple.cpp 项目: jmgc/pyston
extern "C" void tupleIteratorGCHandler(GCVisitor* v, Box* b) {
    boxGCHandler(v, b);
    BoxedTupleIterator* it = (BoxedTupleIterator*)b;
    v->visit(it->t);
}
示例#21
0
extern "C" void listIteratorGCHandler(GCVisitor* v, Box* b) {
    boxGCHandler(v, b);
    BoxedListIterator* it = (BoxedListIterator*)b;
    v->visit(it->l);
}
示例#22
0
文件: code.cpp 项目: jmgc/pyston
 static void gcHandler(GCVisitor* v, Box* b) {
     assert(b->cls == code_cls);
     boxGCHandler(v, b);
 }