fix impossible disasm loading condition; do not go wide on dbgi matching unless we have significant-enough dbgis

This commit is contained in:
Ryan Fleury
2025-10-07 11:34:30 -07:00
parent fadef8a886
commit 2acf77ad9e
9 changed files with 59 additions and 20 deletions
+15 -4
View File
@@ -367,7 +367,8 @@ di_close(DI_Key key)
//- rjf: release node's resources if needed
if(node_released)
{
{
ins_atomic_u64_dec_eval(&di_shared->load_count);
os_file_map_view_close(file_map, file_base, r1u64(0, file_props.size));
os_file_map_close(file_map);
os_file_close(file);
@@ -387,6 +388,13 @@ di_load_gen(void)
U64 result = ins_atomic_u64_eval(&di_shared->load_gen);
return result;
}
internal U64
di_load_count(void)
{
U64 result = ins_atomic_u64_eval(&di_shared->load_count);
return result;
}
internal DI_KeyArray
di_push_all_loaded_keys(Arena *arena)
@@ -942,7 +950,8 @@ di_async_tick(void)
MemoryCopyStruct(&node->rdi, &rdi_parsed);
node->completion_count += 1;
node->working_count -= 1;
ins_atomic_u64_inc_eval(&di_shared->load_gen);
ins_atomic_u64_inc_eval(&di_shared->load_gen);
ins_atomic_u64_inc_eval(&di_shared->load_count);
}
else
{
@@ -1539,8 +1548,10 @@ di_match_from_string(String8 string, U64 index, DI_Key preferred_dbgi_key, U64 e
str8_list_push(scratch.arena, &key_parts, str8_struct(&preferred_dbgi_key));
str8_list_push(scratch.arena, &key_parts, str8_struct(&string.size));
str8_list_push(scratch.arena, &key_parts, string);
String8 key = str8_list_join(scratch.arena, &key_parts, 0);
AC_Artifact artifact = ac_artifact_from_key(access, key, di_match_artifact_create, 0, endt_us, .flags = AC_Flag_Wide, .gen = di_load_gen());
String8 key = str8_list_join(scratch.arena, &key_parts, 0);
U64 dbgi_count = di_load_count();
B32 wide = (dbgi_count > 256);
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());
result.key.u64[0] = artifact.u64[0];
result.key.u64[1] = artifact.u64[1];
result.section_kind = artifact.u64[2];
+2
View File
@@ -246,6 +246,7 @@ struct DI_Shared
{
Arena *arena;
U64 load_gen;
U64 load_count;
// rjf: key -> path cache
U64 key2path_slots_count;
@@ -328,6 +329,7 @@ internal void di_close(DI_Key key);
//~ rjf: Debug Info Lookups
internal U64 di_load_gen(void);
internal U64 di_load_count(void);
internal DI_KeyArray di_push_all_loaded_keys(Arena *arena);
internal RDI_Parsed *di_rdi_from_key(Access *access, DI_Key key, B32 high_priority, U64 endt_us);