예제 #1
0
파일: gc.c 프로젝트: ChappedSky/julia
static void run_finalizers(void)
{
    void *o = NULL;
    jl_function_t *f=NULL;
    jl_value_t *ff=NULL;
    JL_GC_PUSH(&o, &f, &ff);
    while (to_finalize.len > 0) {
        o = arraylist_pop(&to_finalize);
        ff = (jl_value_t*)ptrhash_get(&finalizer_table, o);
        assert(ff != HT_NOTFOUND);
        ptrhash_remove(&finalizer_table, o);
        while (jl_is_tuple(ff)) {
            f = (jl_function_t*)jl_t0(ff);
            assert(jl_is_function(f));
            JL_TRY {
                jl_apply(f, (jl_value_t**)&o, 1);
            }
            JL_CATCH {
            }
            ff = jl_t1(ff);
        }
        f = (jl_function_t*)ff;
        assert(jl_is_function(f));
        jl_apply(f, (jl_value_t**)&o, 1);
    }
    JL_GC_POP();
}
예제 #2
0
파일: gc.c 프로젝트: RichMng/julia
static void run_finalizers(void)
{
    void *o = NULL;
    jl_value_t *ff = NULL;
    JL_GC_PUSH2(&o, &ff);
    while (to_finalize.len > 0) {
        o = arraylist_pop(&to_finalize);
        ff = (jl_value_t*)ptrhash_get(&finalizer_table, o);
        assert(ff != HT_NOTFOUND);
        ptrhash_remove(&finalizer_table, o);
        run_finalizer((jl_value_t*)o, ff);
    }
    JL_GC_POP();
}
예제 #3
0
파일: gc.c 프로젝트: Carreau/julia
static int finalize_object(jl_value_t *o)
{
    jl_value_t *ff = NULL;
    int success = 0;
    JL_GC_PUSH1(&ff);
    ff = (jl_value_t*)ptrhash_get(&finalizer_table, o);
    if (ff != HT_NOTFOUND) {
        ptrhash_remove(&finalizer_table, o);
        run_finalizer((jl_value_t*)o, ff);
        success = 1;
    }
    JL_GC_POP();
    return success;
}