예제 #1
0
파일: data.cpp 프로젝트: v-dorosh/rubinius
void Data::Info::mark(Object* t, ObjectMark& mark) {
    auto_mark(t, mark);

    Data* data = force_as<Data>(t);

    if(mark.mature_gc_in_progress()) {
        // Don't scan objects concurrently since this might
        // not be thread safe. The C library in use here
        // might be in the process of freeing up malloc'ed
        // resources so we would see objects in an invalid
        // state and scan wrong pointers etc.
        return;
    }

    if(data->freed_p()) {
        // TODO: Fix the issue of finalizer ordering.
        // std::cerr << "Data::Info::mark called for already freed object" << std::endl;
        return;
    }

    Data::MarkFunctor marker = data->mark();

    if(marker) {
        ObjectMark* cur = capi::current_mark();
        capi::set_current_mark(&mark);

        (*marker)(data->data());

        capi::set_current_mark(cur);
    }
}