Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jl_get_specialization signature mismatch #18334

Merged
merged 1 commit into from
Sep 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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!
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -4521,7 +4519,7 @@ static std::unique_ptr<Module> 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);
Expand Down Expand Up @@ -4652,7 +4650,7 @@ static std::unique_ptr<Module> 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;
}
Expand All @@ -4667,7 +4665,7 @@ static std::unique_ptr<Module> 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});
Expand Down
2 changes: 0 additions & 2 deletions src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down