@@ -521,20 +521,22 @@ size_t jl_typeinf_world = 0;
521
521
JL_DLLEXPORT void jl_set_typeinf_func (jl_value_t * f )
522
522
{
523
523
jl_typeinf_func = (jl_function_t * )f ;
524
- jl_typeinf_world = jl_get_tls_world_age ();
525
- ++ jl_world_counter ; // make type-inference the only thing in this world
526
- // give type inference a chance to see all of these
527
- // TODO: also reinfer if max_world != ~(size_t)0
528
- jl_array_t * unspec = jl_alloc_vec_any (0 );
529
- JL_GC_PUSH1 (& unspec );
530
- jl_foreach_reachable_mtable (reset_mt_caches , (void * )unspec );
531
- size_t i , l ;
532
- for (i = 0 , l = jl_array_len (unspec ); i < l ; i ++ ) {
533
- jl_method_instance_t * li = (jl_method_instance_t * )jl_array_ptr_ref (unspec , i );
534
- if (!jl_is_rettype_inferred (li ))
535
- jl_type_infer (& li , jl_world_counter , 1 );
524
+ if (jl_typeinf_world == 0 ) {
525
+ jl_typeinf_world = jl_get_tls_world_age ();
526
+ ++ jl_world_counter ; // make type-inference the only thing in this world
527
+ // give type inference a chance to see all of these
528
+ // TODO: also reinfer if max_world != ~(size_t)0
529
+ jl_array_t * unspec = jl_alloc_vec_any (0 );
530
+ JL_GC_PUSH1 (& unspec );
531
+ jl_foreach_reachable_mtable (reset_mt_caches , (void * )unspec );
532
+ size_t i , l ;
533
+ for (i = 0 , l = jl_array_len (unspec ); i < l ; i ++ ) {
534
+ jl_method_instance_t * li = (jl_method_instance_t * )jl_array_ptr_ref (unspec , i );
535
+ if (!jl_is_rettype_inferred (li ))
536
+ jl_type_infer (& li , jl_world_counter , 1 );
537
+ }
538
+ JL_GC_POP ();
536
539
}
537
- JL_GC_POP ();
538
540
}
539
541
540
542
static int very_general_type (jl_value_t * t )
0 commit comments