do not use worker thread arenas from main thread in rdi baker...

This commit is contained in:
Ryan Fleury
2025-05-14 09:51:46 -07:00
parent 141b96c17e
commit 70ae35cbd7
3 changed files with 105 additions and 122 deletions
+2 -1
View File
@@ -55,7 +55,8 @@ commands =
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta tester", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta tester", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: running target //- rjf: running target
.f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, .f3 = { .win = "pushd build && raddbg --user:dev.raddbg_user && popd", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "C:/devel/raddebugger/build/raddbg.exe --capture --user:C:/devel/raddebugger/build/local_dev.raddbg_user --project:C:/devel/raddebugger/build/local_dev.raddbg_project", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f3 = { .win = "C:/devel/raddebugger/build/raddbg.exe --capture --user:C:/devel/raddebugger/build/local_dev.raddbg_user --project:C:/devel/raddebugger/build/local_dev.raddbg_project", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
// .f3 = { .win = "wsl_launch /mnt/c/devel/raddebugger/build/raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, // .f3 = { .win = "wsl_launch /mnt/c/devel/raddebugger/build/raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+16 -16
View File
@@ -426,7 +426,7 @@ rdim_bake(RDIM_HelpState *state, RDIM_BakeParams *in_params)
RDIM_BakePathTree *path_tree = 0; RDIM_BakePathTree *path_tree = 0;
ProfScope("build interned path tree") ProfScope("build interned path tree")
{ {
path_tree = rdim_bake_path_tree_from_params(state->work_thread_arenas[0], in_params); path_tree = rdim_bake_path_tree_from_params(state->arena, in_params);
} }
////////////////////////////// //////////////////////////////
@@ -658,7 +658,7 @@ rdim_bake(RDIM_HelpState *state, RDIM_BakeParams *in_params)
////////////////////////////// //////////////////////////////
//- rjf: produce joined string map //- rjf: produce joined string map
// //
RDIM_BakeStringMapLoose *unsorted_bake_string_map = rdim_bake_string_map_loose_make(state->work_thread_arenas[0], &bake_string_map_topology); RDIM_BakeStringMapLoose *unsorted_bake_string_map = rdim_bake_string_map_loose_make(state->arena, &bake_string_map_topology);
ProfScope("produce joined string map") ProfScope("produce joined string map")
{ {
U64 slots_per_task = 16384; U64 slots_per_task = 16384;
@@ -685,16 +685,16 @@ rdim_bake(RDIM_HelpState *state, RDIM_BakeParams *in_params)
} }
// rjf: insert small top-level stuff // rjf: insert small top-level stuff
rdim_bake_string_map_loose_push_top_level_info(state->work_thread_arenas[0], &bake_string_map_topology, unsorted_bake_string_map, &in_params->top_level_info); rdim_bake_string_map_loose_push_top_level_info(state->arena, &bake_string_map_topology, unsorted_bake_string_map, &in_params->top_level_info);
rdim_bake_string_map_loose_push_binary_sections(state->work_thread_arenas[0], &bake_string_map_topology, unsorted_bake_string_map, &in_params->binary_sections); rdim_bake_string_map_loose_push_binary_sections(state->arena, &bake_string_map_topology, unsorted_bake_string_map, &in_params->binary_sections);
rdim_bake_string_map_loose_push_path_tree(state->work_thread_arenas[0], &bake_string_map_topology, unsorted_bake_string_map, path_tree); rdim_bake_string_map_loose_push_path_tree(state->arena, &bake_string_map_topology, unsorted_bake_string_map, path_tree);
} }
////////////////////////////// //////////////////////////////
//- rjf: kick off string map sorting tasks //- rjf: kick off string map sorting tasks
// //
ASYNC_TaskList sort_bake_string_map_tasks = {0}; ASYNC_TaskList sort_bake_string_map_tasks = {0};
RDIM_BakeStringMapLoose *sorted_bake_string_map__in_progress = rdim_bake_string_map_loose_make(state->work_thread_arenas[0], &bake_string_map_topology); RDIM_BakeStringMapLoose *sorted_bake_string_map__in_progress = rdim_bake_string_map_loose_make(state->arena, &bake_string_map_topology);
{ {
U64 slots_per_task = 4096; U64 slots_per_task = 4096;
U64 num_tasks = (bake_string_map_topology.slots_count+slots_per_task-1)/slots_per_task; U64 num_tasks = (bake_string_map_topology.slots_count+slots_per_task-1)/slots_per_task;
@@ -732,10 +732,10 @@ rdim_bake(RDIM_HelpState *state, RDIM_BakeParams *in_params)
//- rjf: build finalized string map //- rjf: build finalized string map
// //
ProfBegin("build finalized string map base indices"); ProfBegin("build finalized string map base indices");
RDIM_BakeStringMapBaseIndices bake_string_map_base_idxes = rdim_bake_string_map_base_indices_from_map_loose(state->work_thread_arenas[0], &bake_string_map_topology, sorted_bake_string_map); RDIM_BakeStringMapBaseIndices bake_string_map_base_idxes = rdim_bake_string_map_base_indices_from_map_loose(state->arena, &bake_string_map_topology, sorted_bake_string_map);
ProfEnd(); ProfEnd();
ProfBegin("build finalized string map"); ProfBegin("build finalized string map");
RDIM_BakeStringMapTight bake_strings = rdim_bake_string_map_tight_from_loose(state->work_thread_arenas[0], &bake_string_map_topology, &bake_string_map_base_idxes, sorted_bake_string_map); RDIM_BakeStringMapTight bake_strings = rdim_bake_string_map_tight_from_loose(state->arena, &bake_string_map_topology, &bake_string_map_base_idxes, sorted_bake_string_map);
ProfEnd(); ProfEnd();
////////////////////////////// //////////////////////////////
@@ -764,7 +764,7 @@ rdim_bake(RDIM_HelpState *state, RDIM_BakeParams *in_params)
RDIM_String8List location_data_blobs = {0}; RDIM_String8List location_data_blobs = {0};
// reserve null location block for opl // reserve null location block for opl
rdim_location_block_chunk_list_push_array(state->work_thread_arenas[0], &location_blocks, 1); rdim_location_block_chunk_list_push_array(state->arena, &location_blocks, 1);
// TODO: export location instead of VOFF // TODO: export location instead of VOFF
RDIM_BakeThreadVariablesIn bake_thread_variables_in = {&bake_strings, &in_params->thread_variables, type_indices}; RDIM_BakeThreadVariablesIn bake_thread_variables_in = {&bake_strings, &in_params->thread_variables, type_indices};
@@ -804,15 +804,15 @@ rdim_bake(RDIM_HelpState *state, RDIM_BakeParams *in_params)
RDIM_BakeIdxRunMap *idx_runs = 0; RDIM_BakeIdxRunMap *idx_runs = 0;
ProfScope("build interned idx run map") ProfScope("build interned idx run map")
{ {
idx_runs = rdim_bake_idx_run_map_from_params(state->work_thread_arenas[0], name_maps, type_indices, in_params); idx_runs = rdim_bake_idx_run_map_from_params(state->arena, name_maps, type_indices, in_params);
} }
////////////////////////////// //////////////////////////////
//- rjf: do small top-level bakes //- rjf: do small top-level bakes
// //
ProfScope("top level info") out.top_level_info = rdim_bake_top_level_info(state->work_thread_arenas[0], &bake_strings, &in_params->top_level_info); ProfScope("top level info") out.top_level_info = rdim_bake_top_level_info(state->arena, &bake_strings, &in_params->top_level_info);
ProfScope("binary sections") out.binary_sections = rdim_bake_binary_sections(state->work_thread_arenas[0], &bake_strings, &in_params->binary_sections); ProfScope("binary sections") out.binary_sections = rdim_bake_binary_sections(state->arena, &bake_strings, &in_params->binary_sections);
ProfScope("top level name maps section") out.top_level_name_maps = rdim_bake_name_maps_top_level(state->work_thread_arenas[0], &bake_strings, idx_runs, name_maps); ProfScope("top level name maps section") out.top_level_name_maps = rdim_bake_name_maps_top_level(state->arena, &bake_strings, idx_runs, name_maps);
////////////////////////////// //////////////////////////////
//- rjf: kick off pass 3 tasks //- rjf: kick off pass 3 tasks
@@ -875,14 +875,14 @@ rdim_bake(RDIM_HelpState *state, RDIM_BakeParams *in_params)
// //
ProfScope("join all name map bakes into final name map bake") ProfScope("join all name map bakes into final name map bake")
{ {
out.name_maps = rdim_name_map_bake_results_combine(state->work_thread_arenas[0], name_map_bakes, ArrayCount(name_map_bakes)); out.name_maps = rdim_name_map_bake_results_combine(state->arena, name_map_bakes, ArrayCount(name_map_bakes));
} }
//////////////////////////////// ////////////////////////////////
out.location_blocks = rdim_str8_list_join(state->work_thread_arenas[0], &location_blocks, rdim_str8(0,0)); out.location_blocks = rdim_str8_list_join(state->arena, &location_blocks, rdim_str8(0,0));
out.location_data = rdim_str8_list_join(state->work_thread_arenas[0], &location_data_blobs, rdim_str8(0,0)); out.location_data = rdim_str8_list_join(state->arena, &location_data_blobs, rdim_str8(0,0));
rdim_help_state = 0; rdim_help_state = 0;
+27 -45
View File
@@ -9,31 +9,13 @@ internal RDIM_DataModel
rdim_infer_data_model(OperatingSystem os, RDI_Arch arch) rdim_infer_data_model(OperatingSystem os, RDI_Arch arch)
{ {
RDIM_DataModel data_model = RDIM_DataModel_Null; RDIM_DataModel data_model = RDIM_DataModel_Null;
switch (os) { #define Case(os_name, arch_name, model_name) if(os == OperatingSystem_##os_name && arch == Arch_##arch_name) { data_model = RDIM_DataModel_##model_name; }
case OperatingSystem_Null: break; Case(Windows, x86, LLP64);
case OperatingSystem_Windows: { Case(Windows, x64, LLP64);
switch (arch) { Case(Linux, x86, ILP32);
case RDI_Arch_X86: Case(Linux, x64, LLP64);
case RDI_Arch_X64: Case(Mac, x64, LP64);
data_model = RDIM_DataModel_LLP64; break; #undef Case
default: NotImplemented;
}
} break;
case OperatingSystem_Linux: {
switch (arch) {
case RDI_Arch_X86: data_model = RDIM_DataModel_ILP32; break;
case RDI_Arch_X64: data_model = RDIM_DataModel_LLP64; break;
default: NotImplemented;
}
} break;
case OperatingSystem_Mac: {
switch (arch) {
case RDI_Arch_X86: NotImplemented; break;
case RDI_Arch_X64: data_model = RDIM_DataModel_LP64; break;
}
} break;
default: InvalidPath;
}
return data_model; return data_model;
} }
@@ -45,10 +27,10 @@ rdim_make_top_level_info(String8 image_name, Arch arch, U64 exe_hash, RDIM_Binar
// convert arch // convert arch
RDI_Arch arch_rdi; RDI_Arch arch_rdi;
switch (arch) { switch (arch) {
case Arch_Null: arch_rdi = RDI_Arch_NULL; break; case Arch_Null: arch_rdi = RDI_Arch_NULL; break;
case Arch_x64: arch_rdi = RDI_Arch_X64; break; case Arch_x64: arch_rdi = RDI_Arch_X64; break;
case Arch_x86: arch_rdi = RDI_Arch_X86; break; case Arch_x86: arch_rdi = RDI_Arch_X86; break;
default: NotImplemented; break; default: NotImplemented; break;
} }
@@ -669,7 +651,7 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params)
RDIM_BakePathTree *path_tree = 0; RDIM_BakePathTree *path_tree = 0;
ProfScope("build interned path tree") ProfScope("build interned path tree")
{ {
path_tree = rdim_bake_path_tree_from_params(state->work_thread_arenas[0], in_params); path_tree = rdim_bake_path_tree_from_params(state->arena, in_params);
} }
////////////////////////////// //////////////////////////////
@@ -900,7 +882,7 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params)
////////////////////////////// //////////////////////////////
//- rjf: produce joined string map //- rjf: produce joined string map
// //
RDIM_BakeStringMapLoose *unsorted_bake_string_map = rdim_bake_string_map_loose_make(state->work_thread_arenas[0], &bake_string_map_topology); RDIM_BakeStringMapLoose *unsorted_bake_string_map = rdim_bake_string_map_loose_make(state->arena, &bake_string_map_topology);
ProfScope("produce joined string map") ProfScope("produce joined string map")
{ {
U64 slots_per_task = 16384; U64 slots_per_task = 16384;
@@ -927,16 +909,16 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params)
} }
// rjf: insert small top-level stuff // rjf: insert small top-level stuff
rdim_bake_string_map_loose_push_top_level_info(state->work_thread_arenas[0], &bake_string_map_topology, unsorted_bake_string_map, &in_params->top_level_info); rdim_bake_string_map_loose_push_top_level_info(state->arena, &bake_string_map_topology, unsorted_bake_string_map, &in_params->top_level_info);
rdim_bake_string_map_loose_push_binary_sections(state->work_thread_arenas[0], &bake_string_map_topology, unsorted_bake_string_map, &in_params->binary_sections); rdim_bake_string_map_loose_push_binary_sections(state->arena, &bake_string_map_topology, unsorted_bake_string_map, &in_params->binary_sections);
rdim_bake_string_map_loose_push_path_tree(state->work_thread_arenas[0], &bake_string_map_topology, unsorted_bake_string_map, path_tree); rdim_bake_string_map_loose_push_path_tree(state->arena, &bake_string_map_topology, unsorted_bake_string_map, path_tree);
} }
////////////////////////////// //////////////////////////////
//- rjf: kick off string map sorting tasks //- rjf: kick off string map sorting tasks
// //
ASYNC_TaskList sort_bake_string_map_tasks = {0}; ASYNC_TaskList sort_bake_string_map_tasks = {0};
RDIM_BakeStringMapLoose *sorted_bake_string_map__in_progress = rdim_bake_string_map_loose_make(state->work_thread_arenas[0], &bake_string_map_topology); RDIM_BakeStringMapLoose *sorted_bake_string_map__in_progress = rdim_bake_string_map_loose_make(state->arena, &bake_string_map_topology);
{ {
U64 slots_per_task = 4096; U64 slots_per_task = 4096;
U64 num_tasks = (bake_string_map_topology.slots_count+slots_per_task-1)/slots_per_task; U64 num_tasks = (bake_string_map_topology.slots_count+slots_per_task-1)/slots_per_task;
@@ -974,10 +956,10 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params)
//- rjf: build finalized string map //- rjf: build finalized string map
// //
ProfBegin("build finalized string map base indices"); ProfBegin("build finalized string map base indices");
RDIM_BakeStringMapBaseIndices bake_string_map_base_idxes = rdim_bake_string_map_base_indices_from_map_loose(state->work_thread_arenas[0], &bake_string_map_topology, sorted_bake_string_map); RDIM_BakeStringMapBaseIndices bake_string_map_base_idxes = rdim_bake_string_map_base_indices_from_map_loose(state->arena, &bake_string_map_topology, sorted_bake_string_map);
ProfEnd(); ProfEnd();
ProfBegin("build finalized string map"); ProfBegin("build finalized string map");
RDIM_BakeStringMapTight bake_strings = rdim_bake_string_map_tight_from_loose(state->work_thread_arenas[0], &bake_string_map_topology, &bake_string_map_base_idxes, sorted_bake_string_map); RDIM_BakeStringMapTight bake_strings = rdim_bake_string_map_tight_from_loose(state->arena, &bake_string_map_topology, &bake_string_map_base_idxes, sorted_bake_string_map);
ProfEnd(); ProfEnd();
////////////////////////////// //////////////////////////////
@@ -1006,7 +988,7 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params)
RDIM_String8List location_data_blobs = {0}; RDIM_String8List location_data_blobs = {0};
// reserve null location block for opl // reserve null location block for opl
rdim_location_block_chunk_list_push_array(state->work_thread_arenas[0], &location_blocks, 1); rdim_location_block_chunk_list_push_array(state->arena, &location_blocks, 1);
// TODO: export location instead of VOFF // TODO: export location instead of VOFF
RDIM_BakeThreadVariablesIn bake_thread_variables_in = {&bake_strings, &in_params->thread_variables}; RDIM_BakeThreadVariablesIn bake_thread_variables_in = {&bake_strings, &in_params->thread_variables};
@@ -1046,15 +1028,15 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params)
RDIM_BakeIdxRunMap *idx_runs = 0; RDIM_BakeIdxRunMap *idx_runs = 0;
ProfScope("build interned idx run map") ProfScope("build interned idx run map")
{ {
idx_runs = rdim_bake_idx_run_map_from_params(state->work_thread_arenas[0], name_maps, in_params); idx_runs = rdim_bake_idx_run_map_from_params(state->arena, name_maps, in_params);
} }
////////////////////////////// //////////////////////////////
//- rjf: do small top-level bakes //- rjf: do small top-level bakes
// //
ProfScope("top level info") out.top_level_info = rdim_bake_top_level_info(state->work_thread_arenas[0], &bake_strings, &in_params->top_level_info); ProfScope("top level info") out.top_level_info = rdim_bake_top_level_info(state->arena, &bake_strings, &in_params->top_level_info);
ProfScope("binary sections") out.binary_sections = rdim_bake_binary_sections(state->work_thread_arenas[0], &bake_strings, &in_params->binary_sections); ProfScope("binary sections") out.binary_sections = rdim_bake_binary_sections(state->arena, &bake_strings, &in_params->binary_sections);
ProfScope("top level name maps section") out.top_level_name_maps = rdim_bake_name_maps_top_level(state->work_thread_arenas[0], &bake_strings, idx_runs, name_maps); ProfScope("top level name maps section") out.top_level_name_maps = rdim_bake_name_maps_top_level(state->arena, &bake_strings, idx_runs, name_maps);
////////////////////////////// //////////////////////////////
//- rjf: kick off pass 3 tasks //- rjf: kick off pass 3 tasks
@@ -1117,14 +1099,14 @@ rdim_bake(RDIM_LocalState *state, RDIM_BakeParams *in_params)
// //
ProfScope("join all name map bakes into final name map bake") ProfScope("join all name map bakes into final name map bake")
{ {
out.name_maps = rdim_name_map_bake_results_combine(state->work_thread_arenas[0], name_map_bakes, ArrayCount(name_map_bakes)); out.name_maps = rdim_name_map_bake_results_combine(state->arena, name_map_bakes, ArrayCount(name_map_bakes));
} }
//////////////////////////////// ////////////////////////////////
out.location_blocks = rdim_str8_list_join(state->work_thread_arenas[0], &location_blocks, rdim_str8(0,0)); out.location_blocks = rdim_str8_list_join(state->arena, &location_blocks, rdim_str8(0,0));
out.location_data = rdim_str8_list_join(state->work_thread_arenas[0], &location_data_blobs, rdim_str8(0,0)); out.location_data = rdim_str8_list_join(state->arena, &location_data_blobs, rdim_str8(0,0));
rdim_local_state = 0; rdim_local_state = 0;