From b7c25d1ef4442f745006a527700a07c04da60944 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 Also fix a few other compiler warnings. --- src/codegen.cpp | 12 +++++------- src/gf.c | 2 -- src/julia_internal.h | 1 + 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index 8d9f29d663600..671dbd0a17346 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1036,8 +1036,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_defn(jl_lambda_info_t *linfo, bool getwrapper) { @@ -1053,7 +1051,7 @@ void *jl_get_llvmf_defn(jl_lambda_info_t *linfo, bool getwrapper) // 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) { // something went wrong: abort! @@ -1142,7 +1140,7 @@ void *jl_get_llvmf_decl(jl_lambda_info_t *linfo, bool getwrapper) if (linfo->functionObjectsDecls.functionObject == NULL) { jl_lambda_info_t *temp = NULL; JL_GC_PUSH1(&temp); - 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; @@ -4521,7 +4519,7 @@ static std::unique_ptr emit_function(jl_lambda_info_t *lam, jl_llvm_func jl_expr_t *expr = jl_is_expr(stmt) ? (jl_expr_t*)stmt : nullptr; #ifndef NDEBUG if (jl_is_labelnode(stmt)) { - int lname = jl_labelnode_label(stmt); + size_t lname = jl_labelnode_label(stmt); if (lname != i + 1) { jl_safe_printf("Label number mismatch.\n"); jl_(stmts); @@ -4652,7 +4650,7 @@ static std::unique_ptr emit_function(jl_lambda_info_t *lam, jl_llvm_func // `seq_next` is the next statement we want to emit // i.e. if it exists, it's the next one following control flow and // should be emitted into the current insert point. - if (seq_next >= 0 && seq_next < stmtslen) { + if (seq_next >= 0 && (unsigned)seq_next < stmtslen) { cursor = seq_next; return; } @@ -4667,7 +4665,7 @@ static std::unique_ptr emit_function(jl_lambda_info_t *lam, jl_llvm_func cursor = item.first; workstack.pop_back(); }; - auto add_to_list = [&] (int pos, BasicBlock *bb) { + auto add_to_list = [&] (unsigned pos, BasicBlock *bb) { if (pos >= stmtslen) return; workstack.push_back({pos, bb}); diff --git a/src/gf.c b/src/gf.c index 0e69c74090e73..569a6193cb696 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 abc4d7323e163..87d323fa363f3 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -426,6 +426,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); JL_DLLEXPORT 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);