From a9e753bc8d6224ec0972504a5506332aa495972f Mon Sep 17 00:00:00 2001 From: Yichao Yu Date: Fri, 2 Sep 2016 11:47:26 -0400 Subject: [PATCH] Fix `jl_get_specialization` signature mismatch (partial backport of b7c25d1ef4442f745006a527700a07c04da60944) ref #18334 --- src/codegen.cpp | 6 ++---- src/gf.c | 2 -- src/julia_internal.h | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index d5f052817e6f5..f84d395bab762 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1038,8 +1038,6 @@ void jl_extern_c(jl_function_t *f, jl_value_t *rt, jl_value_t *argt, char *name) // for use in reflection from Julia. // this is paired with jl_dump_function_ir and jl_dump_function_asm in particular ways: // misuse will leak memory or cause read-after-free -extern "C" JL_DLLEXPORT jl_lambda_info_t *jl_get_specialized(jl_method_t *m, jl_tupletype_t *types, jl_svec_t *sp); - extern "C" JL_DLLEXPORT void *jl_get_llvmf(jl_tupletype_t *tt, bool getwrapper, bool getdeclarations) { @@ -1077,7 +1075,7 @@ void *jl_get_llvmf(jl_tupletype_t *tt, bool getwrapper, bool getdeclarations) // first copy the linfo to avoid corrupting it and // confusing the compiler about the // validity of the code it already generated - temp = jl_get_specialized(linfo->def, linfo->specTypes, linfo->sparam_vals); + temp = jl_get_specialized(linfo->def, linfo->specTypes, linfo->sparam_vals, 1); jl_type_infer(temp, 0); if (temp->code == jl_nothing || temp->inInference) { JL_GC_POP(); @@ -1123,7 +1121,7 @@ void *jl_get_llvmf(jl_tupletype_t *tt, bool getwrapper, bool getdeclarations) // normally we don't generate native code for these functions, so need an exception here // This leaks a bit of memory to cache the native code that we'll never actually need if (linfo->functionObjectsDecls.functionObject == NULL) { - temp = jl_get_specialized(linfo->def, linfo->specTypes, linfo->sparam_vals); + temp = jl_get_specialized(linfo->def, linfo->specTypes, linfo->sparam_vals, 1); jl_type_infer(temp, 0); temp->jlcall_api = 0; temp->constval = jl_nothing; diff --git a/src/gf.c b/src/gf.c index 26c37d3ee922c..b913d4cf8ac0d 100644 --- a/src/gf.c +++ b/src/gf.c @@ -117,8 +117,6 @@ static int8_t jl_cachearg_offset(jl_methtable_t *mt) /// ----- Insertion logic for special entries ----- /// -JL_DLLEXPORT jl_lambda_info_t *jl_get_specialized(jl_method_t *m, jl_tupletype_t *types, jl_svec_t *sp, int allow_exec); - // get or create the LambdaInfo for a specialization JL_DLLEXPORT jl_lambda_info_t *jl_specializations_get_linfo(jl_method_t *m, jl_tupletype_t *type, jl_svec_t *sparams) { diff --git a/src/julia_internal.h b/src/julia_internal.h index 3097e6d0aa69e..a514a52e7d02b 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -428,6 +428,7 @@ JL_DLLEXPORT jl_array_t *jl_idtable_rehash(jl_array_t *a, size_t newsz); JL_DLLEXPORT jl_methtable_t *jl_new_method_table(jl_sym_t *name, jl_module_t *module); jl_lambda_info_t *jl_get_specialization1(jl_tupletype_t *types); int jl_has_call_ambiguities(jl_tupletype_t *types, jl_method_t *m); +JL_DLLEXPORT jl_lambda_info_t *jl_get_specialized(jl_method_t *m, jl_tupletype_t *types, jl_svec_t *sp, int allow_exec); uint32_t jl_module_next_counter(jl_module_t *m); void jl_fptr_to_llvm(jl_fptr_t fptr, jl_lambda_info_t *lam, int specsig);