eliminate separate chunk list for location cases

This commit is contained in:
Ryan Fleury
2025-09-04 15:08:17 -07:00
parent fa05bbf2a5
commit cc9f45299a
6 changed files with 28 additions and 101 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ commands =
{
//- rjf: [raddbg]
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "raddbg_stable --ipc kill_all && build radbin release telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "raddbg_stable --ipc kill_all && build radbin debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [raddbg wsl]
// .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+4 -24
View File
@@ -1007,26 +1007,6 @@ rdim_location_chunk_list_concat_in_place(RDIM_LocationChunkList *dst, RDIM_Locat
RDIM_IdxedChunkListConcatInPlace(RDIM_LocationChunkNode, dst, to_push, dst->total_encoded_size += to_push->total_encoded_size);
}
RDI_PROC RDIM_LocationCase2 *
rdim_location_case_chunk_list_push(RDIM_Arena *arena, RDIM_LocationCaseChunkList *list, RDI_U64 cap)
{
RDIM_IdxedChunkListPush(arena, list, RDIM_LocationCaseChunkNode, RDIM_LocationCase2, cap, result);
return result;
}
RDI_PROC RDI_U64
rdim_idx_from_location_case(RDIM_LocationCase2 *location_case)
{
RDIM_IdxedChunkListElementGetIdx(location_case, idx);
return idx;
}
RDI_PROC void
rdim_location_case_chunk_list_concat_in_place(RDIM_LocationCaseChunkList *dst, RDIM_LocationCaseChunkList *to_push)
{
RDIM_IdxedChunkListConcatInPlace(RDIM_LocationCaseChunkNode, dst, to_push);
}
////////////////////////////////
//~ rjf: [Building] Scope Info Building
@@ -1050,9 +1030,9 @@ RDI_PROC void
rdim_scope_chunk_list_concat_in_place(RDIM_ScopeChunkList *dst, RDIM_ScopeChunkList *to_push)
{
RDIM_IdxedChunkListConcatInPlace(RDIM_ScopeChunkNode, dst, to_push,
dst->scope_voff_count += to_push->scope_voff_count,
dst->local_count += to_push->local_count,
dst->location_count += to_push->location_count);
dst->scope_voff_count += to_push->scope_voff_count,
dst->local_count += to_push->local_count,
dst->location_case_count += to_push->location_case_count);
}
RDI_PROC void
@@ -1214,7 +1194,7 @@ rdim_location_set_push_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM
locset->location_case_count += 1;
location_case->voff_range = voff_range;
location_case->location = location;
scopes->location_count +=1;
scopes->location_case_count +=1;
}
//- rjf:location block chunk list
+2 -26
View File
@@ -848,30 +848,11 @@ struct RDIM_LocationChunkList
typedef struct RDIM_LocationCase2 RDIM_LocationCase2;
struct RDIM_LocationCase2
{
struct RDIM_LocationCaseChunkNode *chunk;
RDIM_LocationCase2 *next;
RDIM_Location2 *location;
RDIM_Rng1U64 voff_range;
};
typedef struct RDIM_LocationCaseChunkNode RDIM_LocationCaseChunkNode;
struct RDIM_LocationCaseChunkNode
{
RDIM_LocationCaseChunkNode *next;
RDIM_LocationCase2 *v;
RDI_U64 count;
RDI_U64 cap;
RDI_U64 base_idx;
};
typedef struct RDIM_LocationCaseChunkList RDIM_LocationCaseChunkList;
struct RDIM_LocationCaseChunkList
{
RDIM_LocationCaseChunkNode *first;
RDIM_LocationCaseChunkNode *last;
RDI_U64 chunk_count;
RDI_U64 total_count;
};
//- rjf: locations (OLD)
typedef struct RDIM_Location RDIM_Location;
@@ -1022,7 +1003,7 @@ struct RDIM_ScopeChunkList
RDI_U64 total_count;
RDI_U64 scope_voff_count;
RDI_U64 local_count;
RDI_U64 location_count;
RDI_U64 location_case_count;
};
////////////////////////////////
@@ -1041,7 +1022,6 @@ struct RDIM_BakeParams
RDIM_SrcFileChunkList src_files;
RDIM_LineTableChunkList line_tables;
RDIM_LocationChunkList locations;
RDIM_LocationCaseChunkList location_cases;
RDIM_SymbolChunkList global_variables;
RDIM_SymbolChunkList thread_variables;
RDIM_SymbolChunkList constants;
@@ -1707,10 +1687,6 @@ RDI_PROC RDI_U64 rdim_idx_from_location(RDIM_Location2 *location);
RDI_PROC RDI_U64 rdim_off_from_location(RDIM_Location2 *location);
RDI_PROC void rdim_location_chunk_list_concat_in_place(RDIM_LocationChunkList *dst, RDIM_LocationChunkList *to_push);
RDI_PROC RDIM_LocationCase2 *rdim_location_case_chunk_list_push(RDIM_Arena *arena, RDIM_LocationCaseChunkList *list, RDI_U64 cap);
RDI_PROC RDI_U64 rdim_idx_from_location_case(RDIM_LocationCase2 *location_case);
RDI_PROC void rdim_location_case_chunk_list_concat_in_place(RDIM_LocationCaseChunkList *dst, RDIM_LocationCaseChunkList *to_push);
////////////////////////////////
//~ rjf: [Building] Scope Info Building
+10 -20
View File
@@ -330,7 +330,7 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
}
}
lane_sync();
RDI_Arch arch = RDI_Arch_NULL;
RDI_Arch arch = p2r2_shared->arch;
U64 arch_addr_size = rdi_addr_size_from_arch(arch);
//////////////////////////////////////////////////////////////
@@ -2828,7 +2828,6 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
if(lane_idx() == 0)
{
p2r2_shared->syms_locations = push_array(arena, RDIM_LocationChunkList, all_syms_count);
p2r2_shared->syms_location_cases = push_array(arena, RDIM_LocationCaseChunkList, all_syms_count);
p2r2_shared->syms_procedures = push_array(arena, RDIM_SymbolChunkList, all_syms_count);
p2r2_shared->syms_global_variables = push_array(arena, RDIM_SymbolChunkList, all_syms_count);
p2r2_shared->syms_thread_variables = push_array(arena, RDIM_SymbolChunkList, all_syms_count);
@@ -2858,7 +2857,6 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
CV_SymParsed *sym = all_syms[sym_idx];
Rng1U64 sym_rec_range = r1u64(0, sym->sym_ranges.count);
U64 sym_locations_chunk_cap = 16384;
U64 sym_location_cases_chunk_cap = 16384;
U64 sym_procedures_chunk_cap = 16384;
U64 sym_global_variables_chunk_cap = 16384;
U64 sym_thread_variables_chunk_cap = 16384;
@@ -2866,7 +2864,6 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
U64 sym_scopes_chunk_cap = 16384;
U64 sym_inline_sites_chunk_cap = 16384;
RDIM_LocationChunkList *sym_locations = &p2r2_shared->syms_locations[sym_idx];
RDIM_LocationCaseChunkList *sym_location_cases = &p2r2_shared->syms_location_cases[sym_idx];
RDIM_SymbolChunkList *sym_procedures = &p2r2_shared->syms_procedures[sym_idx];
RDIM_SymbolChunkList *sym_global_variables = &p2r2_shared->syms_global_variables[sym_idx];
RDIM_SymbolChunkList *sym_thread_variables = &p2r2_shared->syms_thread_variables[sym_idx];
@@ -3294,6 +3291,7 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
// rjf: build location
RDIM_LocationInfo loc_info = p2r2_location_info_from_addr_reg_off(arena, arch, reg_code, byte_size, byte_pos, (S64)(S32)var_off, extra_indirection_to_value);
RDIM_Location2 *loc2 = rdim_location_chunk_list_push_new(arena, sym_locations, sym_locations_chunk_cap, &loc_info);
#if 0
RDIM_LocationCase2 *loc_case = rdim_location_case_chunk_list_push(arena, sym_location_cases, sym_locations_chunk_cap);
loc_case->location = loc2;
loc_case->voff_range.min = 0;
@@ -3302,6 +3300,7 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
// rjf: equip location case to local
local->first_location_case = loc_case;
local->location_case_count = 1;
#endif
// rjf: set location case
RDIM_Location *loc = p2r_location_from_addr_reg_off(arena, arch, reg_code, byte_size, byte_pos, (S64)(S32)var_off, extra_indirection_to_value);
@@ -3774,56 +3773,49 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
rdim_location_chunk_list_concat_in_place(&p2r2_shared->all_locations, &p2r2_shared->syms_locations[idx]);
}
}
if(lane_idx() == lane_from_task_idx(1)) ProfScope("join location cases")
{
for EachIndex(idx, all_syms_count)
{
rdim_location_case_chunk_list_concat_in_place(&p2r2_shared->all_location_cases, &p2r2_shared->syms_location_cases[idx]);
}
}
if(lane_idx() == lane_from_task_idx(2)) ProfScope("join procedures")
if(lane_idx() == lane_from_task_idx(1)) ProfScope("join procedures")
{
for EachIndex(idx, all_syms_count)
{
rdim_symbol_chunk_list_concat_in_place(&p2r2_shared->all_procedures, &p2r2_shared->syms_procedures[idx]);
}
}
if(lane_idx() == lane_from_task_idx(3)) ProfScope("join global variables")
if(lane_idx() == lane_from_task_idx(2)) ProfScope("join global variables")
{
for EachIndex(idx, all_syms_count)
{
rdim_symbol_chunk_list_concat_in_place(&p2r2_shared->all_global_variables, &p2r2_shared->syms_global_variables[idx]);
}
}
if(lane_idx() == lane_from_task_idx(4)) ProfScope("join thread variables")
if(lane_idx() == lane_from_task_idx(3)) ProfScope("join thread variables")
{
for EachIndex(idx, all_syms_count)
{
rdim_symbol_chunk_list_concat_in_place(&p2r2_shared->all_thread_variables, &p2r2_shared->syms_thread_variables[idx]);
}
}
if(lane_idx() == lane_from_task_idx(5)) ProfScope("join constants")
if(lane_idx() == lane_from_task_idx(4)) ProfScope("join constants")
{
for EachIndex(idx, all_syms_count)
{
rdim_symbol_chunk_list_concat_in_place(&p2r2_shared->all_constants, &p2r2_shared->syms_constants[idx]);
}
}
if(lane_idx() == lane_from_task_idx(6)) ProfScope("join scopes")
if(lane_idx() == lane_from_task_idx(5)) ProfScope("join scopes")
{
for EachIndex(idx, all_syms_count)
{
rdim_scope_chunk_list_concat_in_place(&p2r2_shared->all_scopes, &p2r2_shared->syms_scopes[idx]);
}
}
if(lane_idx() == lane_from_task_idx(7)) ProfScope("join inline sites")
if(lane_idx() == lane_from_task_idx(6)) ProfScope("join inline sites")
{
for EachIndex(idx, all_syms_count)
{
rdim_inline_site_chunk_list_concat_in_place(&p2r2_shared->all_inline_sites, &p2r2_shared->syms_inline_sites[idx]);
}
}
if(lane_idx() == lane_from_task_idx(8)) ProfScope("join typedefs")
if(lane_idx() == lane_from_task_idx(7)) ProfScope("join typedefs")
{
for EachIndex(idx, all_syms_count)
{
@@ -3834,7 +3826,6 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
}
lane_sync();
RDIM_LocationChunkList all_locations = p2r2_shared->all_locations;
RDIM_LocationCaseChunkList all_location_cases = p2r2_shared->all_location_cases;
RDIM_SymbolChunkList all_procedures = p2r2_shared->all_procedures;
RDIM_SymbolChunkList all_global_variables = p2r2_shared->all_global_variables;
RDIM_SymbolChunkList all_thread_variables = p2r2_shared->all_thread_variables;
@@ -3890,7 +3881,6 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
result.src_files = all_src_files;
result.line_tables = all_line_tables;
result.locations = all_locations;
result.location_cases = all_location_cases;
result.global_variables = all_global_variables;
result.thread_variables = all_thread_variables;
result.constants = all_constants;
-2
View File
@@ -88,7 +88,6 @@ struct P2R2_Shared
RDIM_UDTChunkList all_udts;
RDIM_LocationChunkList *syms_locations;
RDIM_LocationCaseChunkList *syms_location_cases;
RDIM_SymbolChunkList *syms_procedures;
RDIM_SymbolChunkList *syms_global_variables;
RDIM_SymbolChunkList *syms_thread_variables;
@@ -98,7 +97,6 @@ struct P2R2_Shared
RDIM_TypeChunkList *syms_typedefs;
RDIM_LocationChunkList all_locations;
RDIM_LocationCaseChunkList all_location_cases;
RDIM_SymbolChunkList all_procedures;
RDIM_SymbolChunkList all_global_variables;
RDIM_SymbolChunkList all_thread_variables;
+11 -28
View File
@@ -1757,6 +1757,11 @@ rdim2_bake(Arena *arena, RDIM_BakeParams *params)
for EachNode(src_local, RDIM_Local, src_scope->first_local)
{
RDI_Local *dst_local = &rdim2_shared->baked_scopes.locals[chunk_local_off];
dst_local->kind = src_local->kind;
dst_local->name_string_idx = rdim_bake_idx_from_string(bake_strings, src_local->name);
dst_local->type_idx = (RDI_U32)rdim_idx_from_type(src_local->type); // TODO(rjf): @u64_to_u32
// dst_local->location_first = location_block_idx_first;
// dst_local->location_opl = location_block_idx_opl;
chunk_local_off += 1;
}
U64 local_idx_opl = chunk_local_off;
@@ -1941,41 +1946,36 @@ rdim2_bake(Arena *arena, RDIM_BakeParams *params)
rdim2_shared->baked_locations.location_data = push_array(arena, RDI_U8, rdim2_shared->baked_locations.location_data_size);
}
if(lane_idx() == lane_from_task_idx(3))
{
rdim2_shared->baked_location_blocks.location_blocks_count = params->location_cases.total_count+1;
rdim2_shared->baked_location_blocks.location_blocks = push_array(arena, RDI_LocationBlock, rdim2_shared->baked_location_blocks.location_blocks_count);
}
if(lane_idx() == lane_from_task_idx(4))
{
rdim2_shared->baked_global_variables.global_variables_count = params->global_variables.total_count+1;
rdim2_shared->baked_global_variables.global_variables = push_array(arena, RDI_GlobalVariable, rdim2_shared->baked_global_variables.global_variables_count);
}
if(lane_idx() == lane_from_task_idx(5))
if(lane_idx() == lane_from_task_idx(4))
{
rdim2_shared->baked_thread_variables.thread_variables_count = params->thread_variables.total_count+1;
rdim2_shared->baked_thread_variables.thread_variables = push_array(arena, RDI_ThreadVariable, rdim2_shared->baked_thread_variables.thread_variables_count);
}
if(lane_idx() == lane_from_task_idx(6))
if(lane_idx() == lane_from_task_idx(5))
{
rdim2_shared->baked_constants.constants_count = params->constants.total_count+1;
rdim2_shared->baked_constants.constants = push_array(arena, RDI_Constant, rdim2_shared->baked_constants.constants_count);
}
if(lane_idx() == lane_from_task_idx(7))
if(lane_idx() == lane_from_task_idx(6))
{
rdim2_shared->baked_constants.constant_values_count = params->constants.total_count+1;
rdim2_shared->baked_constants.constant_values = push_array(arena, RDI_U32, rdim2_shared->baked_constants.constant_values_count);
}
if(lane_idx() == lane_from_task_idx(8))
if(lane_idx() == lane_from_task_idx(7))
{
rdim2_shared->baked_constants.constant_value_data_size = params->constants.total_value_data_size;
rdim2_shared->baked_constants.constant_value_data = push_array(arena, RDI_U8, rdim2_shared->baked_constants.constant_value_data_size);
}
if(lane_idx() == lane_from_task_idx(9))
if(lane_idx() == lane_from_task_idx(8))
{
rdim2_shared->baked_procedures.procedures_count = params->procedures.total_count+1;
rdim2_shared->baked_procedures.procedures = push_array(arena, RDI_Procedure, rdim2_shared->baked_procedures.procedures_count);
}
if(lane_idx() == lane_from_task_idx(10))
if(lane_idx() == lane_from_task_idx(9))
{
rdim2_shared->baked_inline_sites.inline_sites_count = params->inline_sites.total_count+1;
rdim2_shared->baked_inline_sites.inline_sites = push_array(arena, RDI_InlineSite, rdim2_shared->baked_inline_sites.inline_sites_count);
@@ -2121,23 +2121,6 @@ rdim2_bake(Arena *arena, RDIM_BakeParams *params)
}
}
//- rjf: bake location blocks
ProfScope("bake location blocks")
{
for EachNode(n, RDIM_LocationCaseChunkNode, params->location_cases.first)
{
Rng1U64 range = lane_range(n->count);
for EachInRange(n_idx, range)
{
RDIM_LocationCase2 *src = &n->v[n_idx];
RDI_LocationBlock *dst = &rdim2_shared->baked_location_blocks.location_blocks[n->base_idx + n_idx + 1];
dst->scope_off_first = (RDI_U32)src->voff_range.min; // TODO(rjf): @u64_to_u32
dst->scope_off_opl = (RDI_U32)src->voff_range.max; // TODO(rjf): @u64_to_u32
dst->location_data_off = rdim_off_from_location(src->location);
}
}
}
//- rjf: bake global variables
ProfScope("bake global variables")
{