Skip to content

Commit

Permalink
fixes for threads and tasks with trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Aug 28, 2024
1 parent c6d0651 commit a6e5a29
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions juliac/buildscript.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ end
init_active_project() = ACTIVE_PROJECT[] = nothing
set_active_project(projfile::Union{AbstractString,Nothing}) = ACTIVE_PROJECT[] = projfile
disable_library_threading() = nothing
start_profile_listener() = nothing
@inline function invokelatest(f::F, args...; kwargs...) where F
return f(args...; kwargs...)
end
Expand Down Expand Up @@ -198,6 +199,10 @@ let mod = Base.include(Base.__toplevel__, inputfile)
end
#entrypoint(join, (Base.GenericIOBuffer{Memory{UInt8}}, Array{Base.SubString{String}, 1}, String))
#entrypoint(join, (Base.GenericIOBuffer{Memory{UInt8}}, Array{String, 1}, Char))
entrypoint(Base.task_done_hook, (Task,))
entrypoint(Base.wait, ())
entrypoint(Base.trypoptask, (Base.StickyWorkqueue,))
entrypoint(Base.checktaskempty, ())
if add_ccallables
ccall(:jl_add_ccallable_entrypoints, Cvoid, ())
end
Expand Down
12 changes: 10 additions & 2 deletions src/staticdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,17 @@ static void jl_queue_module_for_serialization(jl_serializer_state *s, jl_module_
}
if (jl_options.static_call_graph) {
jl_binding_t *b = (jl_binding_t*)jl_svecref(table, i);
if ((b != NULL) && (b->value != NULL) && (jl_is_module(jl_atomic_load_relaxed(&b->value))
|| (strcmp(jl_symbol_name(b->globalref->name), "__init__") == 0)))
// keep binding objects that are defined and ...
if (b != NULL && b->value != NULL &&
// ... point to modules ...
(jl_is_module(jl_atomic_load_relaxed(&b->value)) ||
// ... or point to __init__ methods ...
!strcmp(jl_symbol_name(b->globalref->name), "__init__") ||
// ... or point to Base functions accessed by the runtime
(m == jl_base_module && (!strcmp(jl_symbol_name(b->globalref->name), "wait") ||
!strcmp(jl_symbol_name(b->globalref->name), "task_done_hook"))))) {
jl_queue_for_serialization(s, b, m);
}
}
}
}
Expand Down

0 comments on commit a6e5a29

Please sign in to comment.