Skip to content

Commit 876853b

Browse files
gbaraldiKristofferC
authored andcommitted
Fix fast getptls ccall lowering. (#55507)
(cherry picked from commit 5a633b7)
1 parent 95e255f commit 876853b

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
@@ -1558,9 +1558,8 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
15581558
emit_gc_safepoint(ctx.builder, ctx.types().T_size, get_current_ptls(ctx), ctx.tbaa().tbaa_const);
15591559
return ghostValue(ctx, jl_nothing_type);
15601560
}
1561-
else if (is_libjulia_func("jl_get_ptls_states")) {
1561+
else if (is_libjulia_func(jl_get_ptls_states)) {
15621562
++CCALL_STAT(jl_get_ptls_states);
1563-
assert(lrt == ctx.types().T_size);
15641563
assert(!isVa && !llvmcall && nccallargs == 0);
15651564
JL_GC_POP();
15661565
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
@@ -275,10 +275,7 @@ typedef struct _jl_tls_states_t {
275275
#endif
276276
} jl_tls_states_t;
277277

278-
#ifndef JL_LIBRARY_EXPORTS
279-
// deprecated (only for external consumers)
280278
JL_DLLEXPORT void *jl_get_ptls_states(void);
281-
#endif
282279

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

test/compiler/codegen.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,3 +913,6 @@ end
913913
let x = Incomplete55396(55396)
914914
@test x.x === (55396,)
915915
end
916+
917+
# Core.getptls() special handling
918+
@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)