@@ -2297,7 +2297,8 @@ jl_typemap_entry_t *jl_method_table_add(jl_methtable_t *mt, jl_method_t *method,
22972297 JL_LOCK (& mt -> writelock );
22982298 // add our new entry
22992299 assert (jl_atomic_load_relaxed (& method -> primary_world ) == ~(size_t )0 ); // min-world
2300- assert (jl_atomic_load_relaxed (& method -> dispatch_status ) == 0 );
2300+ assert ((jl_atomic_load_relaxed (& method -> dispatch_status ) & METHOD_SIG_LATEST_WHICH ) == 0 );
2301+ assert ((jl_atomic_load_relaxed (& method -> dispatch_status ) & METHOD_SIG_LATEST_ONLY ) == 0 );
23012302 newentry = jl_typemap_alloc ((jl_tupletype_t * )method -> sig , simpletype , jl_emptysvec , (jl_value_t * )method , ~(size_t )0 , 1 );
23022303 jl_typemap_insert (& mt -> defs , (jl_value_t * )mt , newentry , jl_cachearg_offset (mt ));
23032304 update_max_args (mt , method -> sig );
@@ -2319,7 +2320,8 @@ void jl_method_table_activate(jl_methtable_t *mt, jl_typemap_entry_t *newentry)
23192320 JL_LOCK (& mt -> writelock );
23202321 size_t world = jl_atomic_load_relaxed (& method -> primary_world );
23212322 assert (world == jl_atomic_load_relaxed (& jl_world_counter ) + 1 ); // min-world
2322- assert (jl_atomic_load_relaxed (& method -> dispatch_status ) == 0 );
2323+ assert ((jl_atomic_load_relaxed (& method -> dispatch_status ) & METHOD_SIG_LATEST_WHICH ) == 0 );
2324+ assert ((jl_atomic_load_relaxed (& method -> dispatch_status ) & METHOD_SIG_LATEST_ONLY ) == 0 );
23232325 assert (jl_atomic_load_relaxed (& newentry -> min_world ) == ~(size_t )0 );
23242326 assert (jl_atomic_load_relaxed (& newentry -> max_world ) == 1 );
23252327 jl_atomic_store_relaxed (& newentry -> min_world , world );
@@ -2334,15 +2336,15 @@ void jl_method_table_activate(jl_methtable_t *mt, jl_typemap_entry_t *newentry)
23342336 // then check what entries we replaced
23352337 oldvalue = get_intersect_matches (jl_atomic_load_relaxed (& mt -> defs ), newentry , & replaced , jl_cachearg_offset (mt ), max_world );
23362338 int invalidated = 0 ;
2337- int only = 1 ; // compute if this will be currently the only result that would returned from `ml_matches` given `sig`
2339+ int only = !( jl_atomic_load_relaxed ( & method -> dispatch_status ) & METHOD_SIG_PRECOMPILE_MANY ) ; // will compute if this will be currently the only result that would returned from `ml_matches` given `sig`
23382340 if (replaced ) {
23392341 oldvalue = (jl_value_t * )replaced ;
23402342 jl_method_t * m = replaced -> func .method ;
2341- int m_dispatch = jl_atomic_load_relaxed (& m -> dispatch_status );
23422343 invalidated = 1 ;
23432344 method_overwrite (newentry , m );
23442345 // this is an optimized version of below, given we know the type-intersection is exact
23452346 jl_method_table_invalidate (mt , m , max_world );
2347+ int m_dispatch = jl_atomic_load_relaxed (& m -> dispatch_status );
23462348 jl_atomic_store_relaxed (& m -> dispatch_status , 0 );
23472349 only = m_dispatch & METHOD_SIG_LATEST_ONLY ;
23482350 }
@@ -2476,7 +2478,7 @@ void jl_method_table_activate(jl_methtable_t *mt, jl_typemap_entry_t *newentry)
24762478 }
24772479 if (only ) {
24782480 if (morespec [j ] == (char )morespec_is || ambig == morespec_is ||
2479- (morespec [ j ] == ( char ) morespec_unknown && ambig == morespec_unknown && !jl_type_morespecific (type , m -> sig ))) {
2481+ (ambig == morespec_unknown && !jl_type_morespecific (type , m -> sig ))) {
24802482 only = 0 ;
24812483 }
24822484 }
0 commit comments