Skip to content

Commit

Permalink
Forward port changes from dropping the typeinfer lock
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored Nov 29, 2022
1 parent 5d50292 commit 80f7706
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ function cache_result!(interp::AbstractInterpreter, result::InferenceResult)
if track_newly_inferred[]
m = linfo.def
if isa(m, Method) && m.module != Core
push!(newly_inferred, ci)
ccall(:jl_push_newly_inferred, Cvoid, (Any,), linfo)
end
end
end
Expand Down
15 changes: 15 additions & 0 deletions src/staticdata_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,27 @@ static uint64_t jl_worklist_key(jl_array_t *worklist) JL_NOTSAFEPOINT
}

static jl_array_t *newly_inferred JL_GLOBALLY_ROOTED /*FIXME*/;
// Mutex for newly_inferred
static jl_mutex_t newly_inferred_mutex;

// Register array of newly-inferred MethodInstances
// This gets called as the first step of Base.include_package_for_output
JL_DLLEXPORT void jl_set_newly_inferred(jl_value_t* _newly_inferred)
{
assert(_newly_inferred == NULL || jl_is_array(_newly_inferred));
newly_inferred = (jl_array_t*) _newly_inferred;
}

JL_DLLEXPORT void jl_push_newly_inferred(jl_value_t* linfo)
{
JL_LOCK(&newly_inferred_mutex);
size_t end = jl_array_len(newly_inferred);
jl_array_grow_end(newly_inferred, 1);
jl_arrayset(newly_inferred, linfo, end);
JL_UNLOCK(&newly_inferred_mutex);
}


static int method_instance_in_queue(jl_method_instance_t *mi)
{
return ptrhash_get(&external_mis, mi) != HT_NOTFOUND;
Expand Down

0 comments on commit 80f7706

Please sign in to comment.