@@ -158,6 +158,8 @@ static htable_t external_mis;
158
158
// Inference tracks newly-inferred MethodInstances during precompilation
159
159
// and registers them by calling jl_set_newly_inferred
160
160
static jl_array_t * newly_inferred JL_GLOBALLY_ROOTED ;
161
+ // Mutex for newly_inferred
162
+ static jl_mutex_t newly_inferred_mutex ;
161
163
162
164
// New roots to add to Methods. These can't be added until after
163
165
// recaching is complete, so we have to hold on to them separately
@@ -2785,14 +2787,23 @@ JL_DLLEXPORT void jl_init_restored_modules(jl_array_t *init_order)
2785
2787
2786
2788
// --- entry points ---
2787
2789
2788
- // Register all newly-inferred MethodInstances
2789
- // This gets called as the final step of Base.include_package_for_output
2790
+ // Register array of newly-inferred MethodInstances
2791
+ // This gets called as the first step of Base.include_package_for_output
2790
2792
JL_DLLEXPORT void jl_set_newly_inferred (jl_value_t * _newly_inferred )
2791
2793
{
2792
2794
assert (_newly_inferred == NULL || jl_is_array (_newly_inferred ));
2793
2795
newly_inferred = (jl_array_t * ) _newly_inferred ;
2794
2796
}
2795
2797
2798
+ JL_DLLEXPORT void jl_push_newly_inferred (jl_value_t * linfo )
2799
+ {
2800
+ JL_LOCK (& newly_inferred_mutex );
2801
+ size_t end = jl_array_len (newly_inferred );
2802
+ jl_array_grow_end (newly_inferred , 1 );
2803
+ jl_arrayset (newly_inferred , linfo , end );
2804
+ JL_UNLOCK (& newly_inferred_mutex );
2805
+ }
2806
+
2796
2807
// Serialize the modules in `worklist` to file `fname`
2797
2808
JL_DLLEXPORT int jl_save_incremental (const char * fname , jl_array_t * worklist )
2798
2809
{
0 commit comments