Skip to content

Commit

Permalink
Use the tls states cb function directly for non-imaging code
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Nov 22, 2015
1 parent ba275d0 commit 2ecc7e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5641,7 +5641,7 @@ static void init_julia_llvm_env(Module *m)
AttributeSet::FunctionIndex, Attribute::ReadNone)
.addAttribute(jltls_states_func->getContext(),
AttributeSet::FunctionIndex, Attribute::NoUnwind));
add_named_global(jltls_states_func, (void*)&jl_get_ptls_states);
add_named_global(jltls_states_func, (void*)jl_get_ptls_states_getter());
#endif

std::vector<Type*> args1(0);
Expand Down
1 change: 1 addition & 0 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ void jl_set_base_ctx(char *__stk);
void jl_init_threading(void);
void jl_start_threads(void);
void jl_shutdown_threading(void);
jl_get_ptls_states_func jl_get_ptls_states_getter(void);

void jl_dump_bitcode(char *fname, const char *sysimg_data, size_t sysimg_len);
void jl_dump_objfile(char *fname, int jit_model, const char *sysimg_data, size_t sysimg_len);
Expand Down
5 changes: 5 additions & 0 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ DLLEXPORT void jl_set_ptls_states_getter(jl_get_ptls_states_func f)
jl_tls_states_cb = f;
}
}
jl_get_ptls_states_func jl_get_ptls_states_getter(void)
{
// for codegen
return jl_tls_states_cb;
}
#else
DLLEXPORT jl_tls_states_t jl_tls_states;
DLLEXPORT JL_CONST_FUNC jl_tls_states_t *(jl_get_ptls_states)(void)
Expand Down

0 comments on commit 2ecc7e5

Please sign in to comment.