Skip to content

Commit bccff0f

Browse files
committed
Fix fast getptls ccall lowering.
1 parent 5230d27 commit bccff0f

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
@@ -1671,9 +1671,8 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
16711671
emit_gc_safepoint(ctx.builder, ctx.types().T_size, get_current_ptls(ctx), ctx.tbaa().tbaa_const);
16721672
return ghostValue(ctx, jl_nothing_type);
16731673
}
1674-
else if (is_libjulia_func("jl_get_ptls_states")) {
1674+
else if (is_libjulia_func(jl_get_ptls_states)) {
16751675
++CCALL_STAT(jl_get_ptls_states);
1676-
assert(lrt == ctx.types().T_size);
16771676
assert(!isVa && !llvmcall && nccallargs == 0);
16781677
JL_GC_POP();
16791678
return mark_or_box_ccall_result(ctx, get_current_ptls(ctx), retboxed, rt, unionall, static_rt);

src/julia_threads.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,7 @@ typedef struct _jl_tls_states_t {
206206
#endif
207207
} jl_tls_states_t;
208208

209-
#ifndef JL_LIBRARY_EXPORTS
210-
// deprecated (only for external consumers)
211209
JL_DLLEXPORT void *jl_get_ptls_states(void);
212-
#endif
213210

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

test/compiler/codegen.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,3 +966,6 @@ end
966966
let x = Incomplete55396(55396)
967967
@test x.x === (55396,)
968968
end
969+
970+
# Core.getptls() special handling
971+
@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)