Skip to content

Commit

Permalink
Merge pull request JuliaLang#15610 from JuliaLang/yyc/threads/fix
Browse files Browse the repository at this point in the history
Fix threading build
  • Loading branch information
JeffBezanson committed Mar 24, 2016
2 parents 7f51e66 + 6e60f58 commit bee7ba4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
19 changes: 15 additions & 4 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5181,13 +5181,24 @@ static void init_julia_llvm_env(Module *m)
add_named_global(jltls_states_func, jl_get_ptls_states_getter());
if (imaging_mode) {
PointerType *pfunctype = jltls_states_func->getFunctionType()->getPointerTo();
// This is **NOT** a external variable or a normal global variable
// This is a special internal global slot with a special index
// in the global variable table.
jltls_states_func_ptr =
new GlobalVariable(*m, pfunctype,
false, GlobalVariable::ExternalLinkage,
NULL, "jl_get_ptls_states.ptr");
false, GlobalVariable::InternalLinkage,
ConstantPointerNull::get(pfunctype),
"jl_get_ptls_states.ptr");
addComdat(jltls_states_func_ptr);
void **p = (void**)jl_emit_and_add_to_shadow(jltls_states_func_ptr);
*p = (void*)jl_get_ptls_states_getter();
// make the pointer valid for this session
#if defined(USE_MCJIT) || defined(USE_ORCJIT)
auto p = new uintptr_t(0);
jl_ExecutionEngine->addGlobalMapping(jltls_states_func_ptr->getName(),
(uintptr_t)p);
#else
uintptr_t *p = (uintptr_t*)jl_ExecutionEngine->getPointerToGlobal(jltls_states_func_ptr);
#endif
*p = (uintptr_t)jl_get_ptls_states_getter();
jl_sysimg_gvars.push_back(ConstantExpr::getBitCast(jltls_states_func_ptr,
T_psize));
jltls_states_func_idx = jl_sysimg_gvars.size();
Expand Down
2 changes: 1 addition & 1 deletion src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ JL_DLLEXPORT jl_value_t *jl_threading_run(jl_svec_t *args)
int8_t gc_state = jl_gc_unsafe_enter();
JL_GC_PUSH1(&argtypes);
argtypes = arg_type_tuple(jl_svec_data(args), jl_svec_len(args));
jl_lambda_info_t *li = jl_get_specialization1(argtypes, NULL);
jl_lambda_info_t *li = jl_get_specialization1(argtypes);
jl_generate_fptr(li);

threadwork.command = TI_THREADWORK_RUN;
Expand Down

0 comments on commit bee7ba4

Please sign in to comment.