Skip to content
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
1 change: 0 additions & 1 deletion src/anticodegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ JL_DLLEXPORT size_t jl_LLVMDisasmInstruction(void *DC, uint8_t *Bytes, uint64_t
int32_t jl_assign_functionID(const char *fname) UNAVAILABLE

void jl_init_codegen(void) { }
void jl_fptr_to_llvm(void *fptr, jl_method_instance_t *lam, int specsig) { }

int jl_getFunctionInfo(jl_frame_t **frames, uintptr_t pointer, int skipC, int noInline)
{
Expand Down
21 changes: 8 additions & 13 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ void *jl_create_native(jl_array_t *methods, const jl_cgparams_t cgparams, int _p
JL_LOCK(&codegen_lock);

CompilationPolicy policy = (CompilationPolicy) _policy;
std::unique_ptr<Module> clone(jl_create_llvm_module("text"));

// compile all methods for the current world and type-inference world
size_t compile_for[] = { jl_typeinf_world, jl_world_counter };
Expand All @@ -311,7 +312,7 @@ void *jl_create_native(jl_array_t *methods, const jl_cgparams_t cgparams, int _p
jl_value_t *item = jl_array_ptr_ref(methods, i);
if (jl_is_simplevector(item)) {
if (worlds == 1)
jl_compile_extern_c(shadow_output, &params, NULL, jl_svecref(item, 0), jl_svecref(item, 1));
jl_compile_extern_c(clone.get(), &params, NULL, jl_svecref(item, 0), jl_svecref(item, 1));
continue;
}
mi = (jl_method_instance_t*)item;
Expand Down Expand Up @@ -348,8 +349,6 @@ void *jl_create_native(jl_array_t *methods, const jl_cgparams_t cgparams, int _p

// clones the contents of the module `m` to the shadow_output collector
// while examining and recording what kind of function pointer we have
ValueToValueMapTy VMap;
std::unique_ptr<Module> clone(CloneModule(*shadow_output, VMap));
for (auto &def : emitted) {
jl_merge_module(clone.get(), std::move(std::get<0>(def.second)));
jl_code_instance_t *this_code = def.first;
Expand All @@ -374,6 +373,11 @@ void *jl_create_native(jl_array_t *methods, const jl_cgparams_t cgparams, int _p
}
data->jl_fvar_map[this_code] = std::make_tuple(func_id, cfunc_id);
}
if (params._shared_module) {
std::unique_ptr<Module> shared(params._shared_module);
params._shared_module = NULL;
jl_merge_module(clone.get(), std::move(shared));
}

// now get references to the globals in the merged module
// and set them to be internalized and initialized at startup
Expand Down Expand Up @@ -532,7 +536,7 @@ void jl_dump_native(void *native_code,

// reflect the address of the jl_RTLD_DEFAULT_handle variable
// back to the caller, so that we can check for consistency issues
GlobalValue *jlRTLD_DEFAULT_var = data->M->getNamedValue("jl_RTLD_DEFAULT_handle");
GlobalValue *jlRTLD_DEFAULT_var = jl_emit_RTLD_DEFAULT_var(data->M.get());
addComdat(new GlobalVariable(*data->M,
jlRTLD_DEFAULT_var->getType(),
true,
Expand Down Expand Up @@ -598,15 +602,6 @@ void jl_dump_native(void *native_code,
delete data;
}

// clones the contents of the module `m` to the shadow_output collector
// TODO: this should be deprecated
void jl_add_to_shadow(Module *m)
{
ValueToValueMapTy VMap;
std::unique_ptr<Module> clone(CloneModule(*m, VMap));
jl_merge_module(shadow_output, std::move(clone));
}


void addTargetPasses(legacy::PassManagerBase *PM, TargetMachine *TM)
{
Expand Down
Loading