Skip to content

Commit fa29d0a

Browse files
gbaraldiKristofferC
authored andcommitted
Fix fast getptls ccall lowering. (#55507)
(cherry picked from commit 5a633b7)
1 parent 4b55053 commit fa29d0a

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/ccall.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,9 +1584,8 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
15841584
emit_gc_safepoint(ctx.builder, ctx.types().T_size, get_current_ptls(ctx), ctx.tbaa().tbaa_const);
15851585
return ghostValue(ctx, jl_nothing_type);
15861586
}
1587-
else if (is_libjulia_func("jl_get_ptls_states")) {
1587+
else if (is_libjulia_func(jl_get_ptls_states)) {
15881588
++CCALL_STAT(jl_get_ptls_states);
1589-
assert(lrt == ctx.types().T_size);
15901589
assert(!isVa && !llvmcall && nccallargs == 0);
15911590
JL_GC_POP();
15921591
return mark_or_box_ccall_result(ctx,

src/julia_threads.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,7 @@ typedef struct _jl_tls_states_t {
287287
#endif
288288
} jl_tls_states_t;
289289

290-
#ifndef JL_LIBRARY_EXPORTS
291-
// deprecated (only for external consumers)
292290
JL_DLLEXPORT void *jl_get_ptls_states(void);
293-
#endif
294291

295292
// Update codegen version in `ccall.cpp` after changing either `pause` or `wake`
296293
#ifdef __MIC__

test/compiler/codegen.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,3 +870,6 @@ function foonopreds()
870870
pkgid.uuid !== nothing ? pkgid.uuid : false
871871
end
872872
@test foonopreds() !== nothing
873+
874+
# Core.getptls() special handling
875+
@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 commit comments

Comments
 (0)