@@ -822,17 +822,9 @@ static void cache_insert_type_linear(jl_datatype_t *type, ssize_t insert_at)
822
822
#ifndef NDEBUG
823
823
static int is_cacheable (jl_datatype_t * type )
824
824
{
825
- // only cache types whose behavior will not depend on the identities
826
- // of contained TypeVars
827
- assert (jl_is_datatype (type ));
828
- jl_svec_t * t = type -> parameters ;
829
- if (jl_svec_len (t ) == 0 && jl_emptytuple_type != NULL ) // Tuple{} is the only type eligible for this that doesn't have parameters
830
- return 0 ;
831
- // cache abstract types with no free type vars
832
- if (jl_is_abstracttype (type ))
833
- return !jl_has_free_typevars ((jl_value_t * )type );
834
- // ... or concrete types
835
- return jl_is_concrete_type ((jl_value_t * )type );
825
+ // ensure cache only contains types whose behavior will not depend on the
826
+ // identities of contained TypeVars
827
+ return !jl_has_free_typevars ((jl_value_t * )type );
836
828
}
837
829
#endif
838
830
@@ -1943,18 +1935,19 @@ void jl_init_types(void) JL_GC_DISABLED
1943
1935
jl_methtable_type -> name -> mt = jl_nonfunction_mt ;
1944
1936
jl_methtable_type -> super = jl_any_type ;
1945
1937
jl_methtable_type -> parameters = jl_emptysvec ;
1946
- jl_methtable_type -> name -> names = jl_perm_symsvec (11 , "name" , "defs" ,
1947
- "cache" , "max_args" ,
1938
+ jl_methtable_type -> name -> names = jl_perm_symsvec (12 , "name" , "defs" ,
1939
+ "leafcache" , " cache" , "max_args" ,
1948
1940
"kwsorter" , "module" ,
1949
1941
"backedges" , "" , "" , "offs" , "" );
1950
- jl_methtable_type -> types = jl_svec (11 , jl_symbol_type , jl_any_type , jl_any_type , jl_any_type /*jl_long*/ ,
1942
+ jl_methtable_type -> types = jl_svec (12 , jl_symbol_type , jl_any_type , jl_any_type ,
1943
+ jl_any_type , jl_any_type /*jl_long*/ ,
1951
1944
jl_any_type , jl_any_type /*module*/ ,
1952
1945
jl_any_type /*any vector*/ , jl_any_type /*long*/ , jl_any_type /*int32*/ ,
1953
1946
jl_any_type /*uint8*/ , jl_any_type /*uint8*/ );
1954
1947
jl_methtable_type -> instance = NULL ;
1955
1948
jl_methtable_type -> abstract = 0 ;
1956
1949
jl_methtable_type -> mutabl = 1 ;
1957
- jl_methtable_type -> ninitialized = 4 ;
1950
+ jl_methtable_type -> ninitialized = 5 ;
1958
1951
jl_precompute_memoized_dt (jl_methtable_type , 1 );
1959
1952
1960
1953
jl_symbol_type -> name = jl_new_typename_in (jl_symbol ("Symbol" ), core );
@@ -2152,6 +2145,9 @@ void jl_init_types(void) JL_GC_DISABLED
2152
2145
jl_array_symbol_type = jl_apply_type2 ((jl_value_t * )jl_array_type , (jl_value_t * )jl_symbol_type , jl_box_long (1 ));
2153
2146
jl_array_uint8_type = jl_apply_type2 ((jl_value_t * )jl_array_type , (jl_value_t * )jl_uint8_type , jl_box_long (1 ));
2154
2147
jl_array_int32_type = jl_apply_type2 ((jl_value_t * )jl_array_type , (jl_value_t * )jl_int32_type , jl_box_long (1 ));
2148
+ jl_an_empty_vec_any = (jl_value_t * )jl_alloc_vec_any (0 ); // used internally
2149
+ jl_nonfunction_mt -> leafcache = (jl_array_t * )jl_an_empty_vec_any ;
2150
+ jl_type_type_mt -> leafcache = (jl_array_t * )jl_an_empty_vec_any ;
2155
2151
2156
2152
jl_expr_type =
2157
2153
jl_new_datatype (jl_symbol ("Expr" ), core ,
@@ -2466,18 +2462,18 @@ void jl_init_types(void) JL_GC_DISABLED
2466
2462
jl_svecset (jl_typename_type -> types , 1 , jl_module_type );
2467
2463
jl_svecset (jl_typename_type -> types , 6 , jl_long_type );
2468
2464
jl_svecset (jl_typename_type -> types , 3 , jl_type_type );
2469
- jl_svecset (jl_methtable_type -> types , 3 , jl_long_type );
2470
- jl_svecset (jl_methtable_type -> types , 5 , jl_module_type );
2471
- jl_svecset (jl_methtable_type -> types , 6 , jl_array_any_type );
2465
+ jl_svecset (jl_methtable_type -> types , 4 , jl_long_type );
2466
+ jl_svecset (jl_methtable_type -> types , 6 , jl_module_type );
2467
+ jl_svecset (jl_methtable_type -> types , 7 , jl_array_any_type );
2472
2468
#ifdef __LP64__
2473
- jl_svecset (jl_methtable_type -> types , 7 , jl_int64_type ); // unsigned long
2474
- jl_svecset (jl_methtable_type -> types , 8 , jl_int64_type ); // uint32_t plus alignment
2469
+ jl_svecset (jl_methtable_type -> types , 8 , jl_int64_type ); // unsigned long
2470
+ jl_svecset (jl_methtable_type -> types , 9 , jl_int64_type ); // uint32_t plus alignment
2475
2471
#else
2476
- jl_svecset (jl_methtable_type -> types , 7 , jl_int32_type ); // DWORD
2477
- jl_svecset (jl_methtable_type -> types , 8 , jl_int32_type ); // uint32_t
2472
+ jl_svecset (jl_methtable_type -> types , 8 , jl_int32_type ); // DWORD
2473
+ jl_svecset (jl_methtable_type -> types , 9 , jl_int32_type ); // uint32_t
2478
2474
#endif
2479
- jl_svecset (jl_methtable_type -> types , 9 , jl_uint8_type );
2480
2475
jl_svecset (jl_methtable_type -> types , 10 , jl_uint8_type );
2476
+ jl_svecset (jl_methtable_type -> types , 11 , jl_uint8_type );
2481
2477
jl_svecset (jl_method_type -> types , 13 , jl_method_instance_type );
2482
2478
jl_svecset (jl_method_instance_type -> types , 5 , jl_code_instance_type );
2483
2479
jl_svecset (jl_code_instance_type -> types , 8 , jl_voidpointer_type );
0 commit comments