Skip to content

Commit 80f7706

Browse files
authored
Forward port changes from dropping the typeinfer lock
1 parent 5d50292 commit 80f7706

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

base/compiler/typeinfer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ function cache_result!(interp::AbstractInterpreter, result::InferenceResult)
407407
if track_newly_inferred[]
408408
m = linfo.def
409409
if isa(m, Method) && m.module != Core
410-
push!(newly_inferred, ci)
410+
ccall(:jl_push_newly_inferred, Cvoid, (Any,), linfo)
411411
end
412412
end
413413
end

src/staticdata_utils.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,27 @@ static uint64_t jl_worklist_key(jl_array_t *worklist) JL_NOTSAFEPOINT
8787
}
8888

8989
static jl_array_t *newly_inferred JL_GLOBALLY_ROOTED /*FIXME*/;
90+
// Mutex for newly_inferred
91+
static jl_mutex_t newly_inferred_mutex;
92+
93+
// Register array of newly-inferred MethodInstances
94+
// This gets called as the first step of Base.include_package_for_output
9095
JL_DLLEXPORT void jl_set_newly_inferred(jl_value_t* _newly_inferred)
9196
{
9297
assert(_newly_inferred == NULL || jl_is_array(_newly_inferred));
9398
newly_inferred = (jl_array_t*) _newly_inferred;
9499
}
95100

101+
JL_DLLEXPORT void jl_push_newly_inferred(jl_value_t* linfo)
102+
{
103+
JL_LOCK(&newly_inferred_mutex);
104+
size_t end = jl_array_len(newly_inferred);
105+
jl_array_grow_end(newly_inferred, 1);
106+
jl_arrayset(newly_inferred, linfo, end);
107+
JL_UNLOCK(&newly_inferred_mutex);
108+
}
109+
110+
96111
static int method_instance_in_queue(jl_method_instance_t *mi)
97112
{
98113
return ptrhash_get(&external_mis, mi) != HT_NOTFOUND;

0 commit comments

Comments
 (0)