Skip to content

Commit

Permalink
Fix fast getptls ccall lowering. (#55507)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5a633b7)
  • Loading branch information
gbaraldi authored and KristofferC committed Oct 9, 2024
1 parent 4b55053 commit fa29d0a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1584,9 +1584,8 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
emit_gc_safepoint(ctx.builder, ctx.types().T_size, get_current_ptls(ctx), ctx.tbaa().tbaa_const);
return ghostValue(ctx, jl_nothing_type);
}
else if (is_libjulia_func("jl_get_ptls_states")) {
else if (is_libjulia_func(jl_get_ptls_states)) {
++CCALL_STAT(jl_get_ptls_states);
assert(lrt == ctx.types().T_size);
assert(!isVa && !llvmcall && nccallargs == 0);
JL_GC_POP();
return mark_or_box_ccall_result(ctx,
Expand Down
3 changes: 0 additions & 3 deletions src/julia_threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,7 @@ typedef struct _jl_tls_states_t {
#endif
} jl_tls_states_t;

#ifndef JL_LIBRARY_EXPORTS
// deprecated (only for external consumers)
JL_DLLEXPORT void *jl_get_ptls_states(void);
#endif

// Update codegen version in `ccall.cpp` after changing either `pause` or `wake`
#ifdef __MIC__
Expand Down
3 changes: 3 additions & 0 deletions test/compiler/codegen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -870,3 +870,6 @@ function foonopreds()
pkgid.uuid !== nothing ? pkgid.uuid : false
end
@test foonopreds() !== nothing

# Core.getptls() special handling
@test !occursin("call ptr @jlplt", get_llvm(Core.getptls, Tuple{})) #It should lower to a direct load of the ptls and not a ccall

0 comments on commit fa29d0a

Please sign in to comment.