Beispiel #1
0
// return a new lambda-info that has some extra static parameters merged in
JL_DLLEXPORT jl_lambda_info_t *jl_get_specialized(jl_method_t *m, jl_tupletype_t *types, jl_svec_t *sp)
{
    jl_lambda_info_t *linfo = m->lambda_template;
    jl_lambda_info_t *new_linfo;
    assert(jl_svec_len(linfo->sparam_syms) == jl_svec_len(sp) || sp == jl_emptysvec);

    if (!m->isstaged) {
        new_linfo = jl_copy_lambda(linfo);
        new_linfo->specTypes = types;
        new_linfo->def = m;
        new_linfo->sparam_vals = sp;

        if (jl_options.compile_enabled == JL_OPTIONS_COMPILE_OFF ||
                jl_options.compile_enabled == JL_OPTIONS_COMPILE_MIN) {
            // copy fptr from the template method definition
            new_linfo->fptr = linfo->fptr;
            new_linfo->jlcall_api = linfo->jlcall_api;
            if (jl_options.compile_enabled == JL_OPTIONS_COMPILE_OFF && new_linfo->fptr == NULL) {
                jl_printf(JL_STDERR,"code missing for ");
                jl_static_show(JL_STDERR, (jl_value_t*)new_linfo);
                jl_printf(JL_STDERR, "  sysimg may not have been built with --compile=all\n");
            }
        }
    }
    else {
        new_linfo = jl_instantiate_staged(m, types, sp);
    }
    return new_linfo;
}
Beispiel #2
0
// return a new lambda-info that has some extra static parameters merged in
JL_DLLEXPORT jl_lambda_info_t *jl_get_specialized(jl_method_t *m, jl_tupletype_t *types, jl_svec_t *sp, int allow_exec)
{
    jl_lambda_info_t *linfo = m->lambda_template;
    jl_lambda_info_t *new_linfo;
    assert(jl_svec_len(linfo->sparam_syms) == jl_svec_len(sp) || sp == jl_emptysvec);

    if (!m->isstaged) {
        new_linfo = jl_copy_lambda(linfo);
        new_linfo->specTypes = types;
        new_linfo->def = m;
        new_linfo->sparam_vals = sp;
    }
    else if (!allow_exec) {
        new_linfo = jl_copy_lambda(linfo);
        new_linfo->specTypes = types;
        new_linfo->def = m;
        new_linfo->sparam_vals = sp;
        jl_set_lambda_code_null(new_linfo);
    }
    else {
        new_linfo = jl_instantiate_staged(m, types, sp);
    }
    return new_linfo;
}