@@ -1499,59 +1499,70 @@ di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *g
14991499
15001500 //- rjf: get all loaded keys
15011501 DI_KeyArray dbgi_keys = di_push_all_loaded_keys (scratch .arena );
1502-
1502+
1503+ //- rjf: take cancellation signal
1504+ B32 cancelled = 0 ;
1505+ if (lane_idx () == 0 )
1506+ {
1507+ cancelled = ins_atomic_u32_eval (cancel_signal );
1508+ }
1509+ lane_sync_u64 (& cancelled , 0 );
1510+
15031511 //- rjf: wide search across all debug infos
1504- DI_Match * lane_matches = 0 ;
1505- if (lane_idx () == 0 )
1506- {
1507- lane_matches = push_array (scratch .arena , DI_Match , lane_count ());
1508- }
1509- lane_sync_u64 (& lane_matches , 0 );
1510- {
1511- read_only local_persist RDI_NameMapKind name_map_kinds [] =
1512- {
1513- RDI_NameMapKind_GlobalVariables ,
1514- RDI_NameMapKind_ThreadVariables ,
1515- RDI_NameMapKind_Constants ,
1516- RDI_NameMapKind_Procedures ,
1517- RDI_NameMapKind_Types ,
1518- };
1519- read_only local_persist RDI_SectionKind name_map_section_kinds [] =
1512+ DI_Match * lane_matches = 0 ;
1513+ if (!cancelled )
1514+ {
1515+ if (lane_idx () == 0 )
15201516 {
1521- RDI_SectionKind_GlobalVariables ,
1522- RDI_SectionKind_ThreadVariables ,
1523- RDI_SectionKind_Constants ,
1524- RDI_SectionKind_Procedures ,
1525- RDI_SectionKind_TypeNodes ,
1526- };
1527- Rng1U64 range = lane_range (dbgi_keys .count );
1528- for EachInRange (dbgi_idx , range )
1517+ lane_matches = push_array (scratch .arena , DI_Match , lane_count ());
1518+ }
1519+ lane_sync_u64 (& lane_matches , 0 );
15291520 {
1530- Access * access = access_open ();
1521+ read_only local_persist RDI_NameMapKind name_map_kinds [] =
1522+ {
1523+ RDI_NameMapKind_GlobalVariables ,
1524+ RDI_NameMapKind_ThreadVariables ,
1525+ RDI_NameMapKind_Constants ,
1526+ RDI_NameMapKind_Procedures ,
1527+ RDI_NameMapKind_Types ,
1528+ };
1529+ read_only local_persist RDI_SectionKind name_map_section_kinds [] =
1530+ {
1531+ RDI_SectionKind_GlobalVariables ,
1532+ RDI_SectionKind_ThreadVariables ,
1533+ RDI_SectionKind_Constants ,
1534+ RDI_SectionKind_Procedures ,
1535+ RDI_SectionKind_TypeNodes ,
1536+ };
1537+ Rng1U64 range = lane_range (dbgi_keys .count );
1538+ for EachInRange (dbgi_idx , range )
15311539 {
1532- DI_Key dbgi_key = dbgi_keys .v [dbgi_idx ];
1533- RDI_Parsed * rdi = di_rdi_from_key (access , dbgi_key , 0 , 0 );
1534- for EachElement (name_map_kind_idx , name_map_kinds )
1540+ Access * access = access_open ();
15351541 {
1536- RDI_NameMap * name_map = rdi_element_from_name_idx (rdi , NameMaps , name_map_kinds [name_map_kind_idx ]);
1537- RDI_ParsedNameMap parsed_name_map = {0 };
1538- rdi_parsed_from_name_map (rdi , name_map , & parsed_name_map );
1539- RDI_NameMapNode * map_node = rdi_name_map_lookup (rdi , & parsed_name_map , name .str , name .size );
1540- U32 num = 0 ;
1541- U32 * run = rdi_matches_from_map_node (rdi , map_node , & num );
1542- if (num != 0 )
1542+ DI_Key dbgi_key = dbgi_keys .v [dbgi_idx ];
1543+ RDI_Parsed * rdi = di_rdi_from_key (access , dbgi_key , 0 , 0 );
1544+ for EachElement (name_map_kind_idx , name_map_kinds )
15431545 {
1544- lane_matches [lane_idx ()].key = dbgi_key ;
1545- lane_matches [lane_idx ()].section_kind = name_map_section_kinds [name_map_kind_idx ];
1546- lane_matches [lane_idx ()].idx = run [num - 1 ];
1546+ RDI_NameMap * name_map = rdi_element_from_name_idx (rdi , NameMaps , name_map_kinds [name_map_kind_idx ]);
1547+ RDI_ParsedNameMap parsed_name_map = {0 };
1548+ rdi_parsed_from_name_map (rdi , name_map , & parsed_name_map );
1549+ RDI_NameMapNode * map_node = rdi_name_map_lookup (rdi , & parsed_name_map , name .str , name .size );
1550+ U32 num = 0 ;
1551+ U32 * run = rdi_matches_from_map_node (rdi , map_node , & num );
1552+ if (num != 0 )
1553+ {
1554+ lane_matches [lane_idx ()].key = dbgi_key ;
1555+ lane_matches [lane_idx ()].section_kind = name_map_section_kinds [name_map_kind_idx ];
1556+ lane_matches [lane_idx ()].idx = run [num - 1 ];
1557+ }
15471558 }
15481559 }
1560+ access_close (access );
15491561 }
1550- access_close (access );
1551- }
1552- }
1553- lane_sync ();
1554-
1562+ }
1563+ }
1564+ lane_sync ();
1565+
15551566 //- rjf: pick match
15561567 DI_Match match = {0 };
15571568 for EachIndex (idx , lane_count ())
@@ -1597,7 +1608,7 @@ di_match_from_string(String8 string, U64 index, DI_Key preferred_dbgi_key, U64 e
15971608 String8 key = str8_list_join (scratch .arena , & key_parts , 0 );
15981609 U64 dbgi_count = di_load_count ();
15991610 B32 wide = (dbgi_count > 256 );
1600- AC_Artifact artifact = ac_artifact_from_key (access , key , di_match_artifact_create , 0 , endt_us , .flags = wide ? AC_Flag_Wide : 0 , .gen = di_load_gen ());
1611+ AC_Artifact artifact = ac_artifact_from_key (access , key , di_match_artifact_create , 0 , endt_us , .flags = wide ? AC_Flag_Wide : 0 , .gen = di_load_gen (), . evict_threshold_us = wide ? 20000000 : 10000000 );
16011612 result .key .u64 [0 ] = artifact .u64 [0 ];
16021613 result .key .u64 [1 ] = artifact .u64 [1 ];
16031614 result .section_kind = artifact .u64 [2 ];
0 commit comments