@@ -759,33 +759,6 @@ JL_DLLEXPORT int jl_mi_try_insert(jl_method_instance_t *mi JL_ROOTING_ARGUMENT,
759759 return ret ;
760760}
761761
762- static int get_method_unspec_list (jl_typemap_entry_t * def , void * closure )
763- {
764- size_t world = jl_atomic_load_acquire (& jl_world_counter );
765- jl_value_t * specializations = jl_atomic_load_relaxed (& def -> func .method -> specializations );
766- if (specializations == (jl_value_t * )jl_emptysvec )
767- return 1 ;
768- if (!jl_is_svec (specializations )) {
769- jl_method_instance_t * mi = (jl_method_instance_t * )specializations ;
770- assert (jl_is_method_instance (mi ));
771- if (jl_rettype_inferred_native (mi , world , world ) == jl_nothing )
772- jl_array_ptr_1d_push ((jl_array_t * )closure , (jl_value_t * )mi );
773- return 1 ;
774- }
775- size_t i , l = jl_svec_len (specializations );
776- JL_GC_PUSH1 (& specializations );
777- for (i = 0 ; i < l ; i ++ ) {
778- jl_method_instance_t * mi = (jl_method_instance_t * )jl_svecref (specializations , i );
779- if ((jl_value_t * )mi != jl_nothing ) {
780- assert (jl_is_method_instance (mi ));
781- if (jl_rettype_inferred_native (mi , world , world ) == jl_nothing )
782- jl_array_ptr_1d_push ((jl_array_t * )closure , (jl_value_t * )mi );
783- }
784- }
785- JL_GC_POP ();
786- return 1 ;
787- }
788-
789762int foreach_mtable_in_module (
790763 jl_module_t * m ,
791764 int (* visit )(jl_methtable_t * mt , void * env ),
@@ -865,42 +838,14 @@ int jl_foreach_reachable_mtable(int (*visit)(jl_methtable_t *mt, void *env), voi
865838 return 1 ;
866839}
867840
868- static int reset_mt_caches (jl_methtable_t * mt , void * env )
869- {
870- // removes all method caches
871- // this might not be entirely safe (GC or MT), thus we only do it very early in bootstrapping
872- if (!mt -> frozen ) { // make sure not to reset builtin functions
873- jl_atomic_store_release (& mt -> leafcache , (jl_genericmemory_t * )jl_an_empty_memory_any );
874- jl_atomic_store_release (& mt -> cache , jl_nothing );
875- }
876- jl_typemap_visitor (jl_atomic_load_relaxed (& mt -> defs ), get_method_unspec_list , env );
877- return 1 ;
878- }
879-
880841
881842jl_function_t * jl_typeinf_func JL_GLOBALLY_ROOTED = NULL ;
882843JL_DLLEXPORT size_t jl_typeinf_world = 1 ;
883844
884845JL_DLLEXPORT void jl_set_typeinf_func (jl_value_t * f )
885846{
886- size_t newfunc = jl_typeinf_world == 1 && jl_typeinf_func == NULL ;
887847 jl_typeinf_func = (jl_function_t * )f ;
888848 jl_typeinf_world = jl_get_tls_world_age ();
889- int world = jl_atomic_fetch_add (& jl_world_counter , 1 ) + 1 ; // make type-inference the only thing in this world
890- if (newfunc ) {
891- // give type inference a chance to see all of these
892- // TODO: also reinfer if max_world != ~(size_t)0
893- jl_array_t * unspec = jl_alloc_vec_any (0 );
894- JL_GC_PUSH1 (& unspec );
895- jl_foreach_reachable_mtable (reset_mt_caches , (void * )unspec );
896- size_t i , l ;
897- for (i = 0 , l = jl_array_nrows (unspec ); i < l ; i ++ ) {
898- jl_method_instance_t * mi = (jl_method_instance_t * )jl_array_ptr_ref (unspec , i );
899- if (jl_rettype_inferred_native (mi , world , world ) == jl_nothing )
900- jl_type_infer (mi , world , SOURCE_MODE_NOT_REQUIRED );
901- }
902- JL_GC_POP ();
903- }
904849}
905850
906851static int very_general_type (jl_value_t * t )
0 commit comments