Skip to content

Commit f8aaa04

Browse files
gbaraldivchuravy
authored andcommitted
Fix adopt_thread interaction + fix ccall tests
1 parent ef80063 commit f8aaa04

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/llvm-ptls.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void LowerPTLS::fix_pgcstack_use(CallInst *pgcstack, Function *pgcstack_getter,
198198
if (isa<ReturnInst>(BB.getTerminator())) {
199199
// Don't use emit_gc_safe_leave here, as that introduces a new BB while iterating BBs
200200
builder.SetInsertPoint(BB.getTerminator());
201-
Value *ptls = get_current_ptls_from_task(builder, get_current_task_from_pgcstack(builder, pgcstack), tbaa_gcframe);
201+
Value *ptls = get_current_ptls_from_task(builder, get_current_task_from_pgcstack(builder, phi), tbaa_gcframe);
202202
unsigned offset = offsetof(jl_tls_states_t, gc_state);
203203
Value *gc_state = builder.CreateConstInBoundsGEP1_32(Type::getInt8Ty(builder.getContext()), ptls, offset, "gc_state");
204204
builder.CreateAlignedStore(last_gc_state, gc_state, Align(sizeof(void*)))->setOrdering(AtomicOrdering::Release);

test/ccall.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,7 @@ using Base: ccall_macro_parse, ccall_macro_lower
17451745
:Cvoid, # returntype
17461746
Any[:Cstring, :Cstring, :Cint], # argument types
17471747
Any["%s = %d\n", :name, :value], # argument symbols
1748+
false, # is gc_safe
17481749
1 # number of required arguments (for varargs)
17491750
)
17501751
end
@@ -1757,7 +1758,7 @@ end
17571758
)::Cstring))...)
17581759
@test call == Base.remove_linenums!(
17591760
quote
1760-
ccall($(Expr(:escape, :((:func, libstring)))), $(Expr(:cconv, :ccall, 0)), $(Expr(:escape, :Cstring)), ($(Expr(:escape, :Cstring)), $(Expr(:escape, :Cint)), $(Expr(:escape, :Cint))), $(Expr(:escape, :str)), $(Expr(:escape, :num1)), $(Expr(:escape, :num2)))
1761+
ccall($(Expr(:escape, :((:func, libstring)))), $(Expr(:cconv, (:ccall, UInt16(0), false), 0)), $(Expr(:escape, :Cstring)), ($(Expr(:escape, :Cstring)), $(Expr(:escape, :Cint)), $(Expr(:escape, :Cint))), $(Expr(:escape, :str)), $(Expr(:escape, :num1)), $(Expr(:escape, :num2)))
17611762
end)
17621763

17631764
local fptr = :x

0 commit comments

Comments
 (0)