mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-28 02:10:13 +00:00
pipe obj reads through IO layer
This commit is contained in:
committed by
Ryan Fleury
parent
4c972c0fba
commit
ad3e6e0b79
+11
-14
@@ -873,16 +873,6 @@ lnk_make_linker_coff_obj(Arena *arena,
|
||||
return obj;
|
||||
}
|
||||
|
||||
internal
|
||||
THREAD_POOL_TASK_FUNC(lnk_load_thin_objs_task)
|
||||
{
|
||||
LNK_InputObj *input = ((LNK_InputObj **)raw_task)[task_id];
|
||||
if (input->is_thin) {
|
||||
input->data = lnk_read_data_from_file_path(arena, input->path);
|
||||
input->has_disk_read_failed = (input->data.size == 0);
|
||||
}
|
||||
}
|
||||
|
||||
internal String8
|
||||
lnk_get_lib_name(String8 path)
|
||||
{
|
||||
@@ -1461,12 +1451,19 @@ lnk_build_link_context(TP_Context *tp, TP_Arena *tp_arena, LNK_Config *config)
|
||||
}
|
||||
ProfEnd();
|
||||
|
||||
ProfBegin("Load Objs From Disk");
|
||||
LNK_InputObj **input_obj_arr = lnk_array_from_input_obj_list(scratch.arena, unique_obj_input_list);
|
||||
tp_for_parallel(tp, tp_arena, unique_obj_input_list.count, lnk_load_thin_objs_task, input_obj_arr);
|
||||
ProfBegin("Load Objs From Disk");
|
||||
U64 thin_inputs_count = 0;
|
||||
LNK_InputObj **thin_inputs = lnk_thin_array_from_input_obj_list(scratch.arena, unique_obj_input_list, &thin_inputs_count);
|
||||
String8Array thin_input_paths = lnk_path_array_from_input_obj_array(scratch.arena, thin_inputs, thin_inputs_count);
|
||||
String8Array thin_input_datas = lnk_read_data_from_file_path_parallel(tp, tp_arena->v[0], thin_input_paths);
|
||||
for (U64 thin_input_idx = 0; thin_input_idx < thin_inputs_count; thin_input_idx += 1) {
|
||||
thin_inputs[thin_input_idx]->has_disk_read_failed = thin_input_datas.v[thin_input_idx].size == 0;
|
||||
thin_inputs[thin_input_idx]->data = thin_input_datas.v[thin_input_idx];
|
||||
}
|
||||
ProfEnd();
|
||||
|
||||
|
||||
ProfBegin("Disk Read Check");
|
||||
LNK_InputObj **input_obj_arr = lnk_array_from_input_obj_list(scratch.arena, unique_obj_input_list);
|
||||
for (U64 input_idx = 0; input_idx < unique_obj_input_list.count; ++input_idx) {
|
||||
if (input_obj_arr[input_idx]->has_disk_read_failed) {
|
||||
lnk_error(LNK_Error_InvalidPath, "unable to find obj \"%S\"", input_obj_arr[input_idx]->path);
|
||||
|
||||
@@ -47,6 +47,32 @@ lnk_array_from_input_obj_list(Arena *arena, LNK_InputObjList list)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal LNK_InputObj **
|
||||
lnk_thin_array_from_input_obj_list(Arena *arena, LNK_InputObjList list, U64 *count_out)
|
||||
{
|
||||
for (LNK_InputObj *input = list.first; input != 0; input = input->next) {
|
||||
if (input->is_thin) { *count_out += 1; }
|
||||
}
|
||||
LNK_InputObj **thin_inputs = push_array(arena, LNK_InputObj *, *count_out);
|
||||
U64 input_idx = 0;
|
||||
for (LNK_InputObj *input = list.first; input != 0; input = input->next) {
|
||||
if (input->is_thin) { thin_inputs[input_idx++] = input; }
|
||||
}
|
||||
return thin_inputs;
|
||||
}
|
||||
|
||||
internal String8Array
|
||||
lnk_path_array_from_input_obj_array(Arena *arena, LNK_InputObj **arr, U64 count)
|
||||
{
|
||||
String8Array paths = {0};
|
||||
paths.count = count;
|
||||
paths.v = push_array(arena, String8, count);
|
||||
for (U64 i = 0; i < count; i += 1) {
|
||||
paths.v[i] = arr[i]->path;
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
internal int
|
||||
lnk_input_obj_compar(const void *raw_a, const void *raw_b)
|
||||
{
|
||||
|
||||
@@ -62,6 +62,8 @@ internal LNK_InputObj * lnk_input_obj_list_push(Arena *arena, LNK_InputObjList
|
||||
internal void lnk_input_obj_list_concat_in_place(LNK_InputObjList *list, LNK_InputObjList *to_concat);
|
||||
|
||||
internal LNK_InputObj ** lnk_array_from_input_obj_list(Arena *arena, LNK_InputObjList list);
|
||||
internal LNK_InputObj ** lnk_thin_array_from_input_obj_list(Arena *arena, LNK_InputObjList list, U64 *count_out);
|
||||
internal String8Array lnk_path_array_from_input_obj_array(Arena *arena, LNK_InputObj **arr, U64 count);
|
||||
internal LNK_InputObjList lnk_list_from_input_obj_arr(LNK_InputObj **arr, U64 count);
|
||||
internal LNK_InputObjList lnk_input_obj_list_from_string_list(Arena *arena, String8List list);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user