mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
checkpoint
This commit is contained in:
+41
-68
@@ -1245,10 +1245,12 @@ lnk_hash_cv_leaf_deep(Arena *arena,
|
|||||||
Rng1U64 *ti_ranges,
|
Rng1U64 *ti_ranges,
|
||||||
CV_DebugT *leaves,
|
CV_DebugT *leaves,
|
||||||
LNK_LeafHashes *hashes,
|
LNK_LeafHashes *hashes,
|
||||||
|
CV_TypeIndexSource ti_source,
|
||||||
|
CV_TypeIndex ti,
|
||||||
LNK_LeafLocType loc_type,
|
LNK_LeafLocType loc_type,
|
||||||
U32 loc_idx,
|
U32 loc_idx,
|
||||||
CV_TypeIndexInfoList ti_info_list,
|
CV_TypeIndexInfoList ti_info_list,
|
||||||
String8 data)
|
CV_Leaf leaf)
|
||||||
{
|
{
|
||||||
Temp temp = temp_begin(arena);
|
Temp temp = temp_begin(arena);
|
||||||
|
|
||||||
@@ -1257,20 +1259,17 @@ lnk_hash_cv_leaf_deep(Arena *arena,
|
|||||||
CV_TypeIndexInfoList ti_info_list;
|
CV_TypeIndexInfoList ti_info_list;
|
||||||
CV_TypeIndexInfo *ti_info;
|
CV_TypeIndexInfo *ti_info;
|
||||||
CV_Leaf leaf;
|
CV_Leaf leaf;
|
||||||
String8 data;
|
|
||||||
CV_TypeIndex ti;
|
CV_TypeIndex ti;
|
||||||
CV_TypeIndexSource ti_source;
|
CV_TypeIndexSource ti_source;
|
||||||
};
|
};
|
||||||
|
|
||||||
// set up root frame
|
// set up root frame
|
||||||
struct stack_s *root_frame = push_array_no_zero(temp.arena, struct stack_s, 1);
|
struct stack_s *root_frame = push_array(temp.arena, struct stack_s, 1);
|
||||||
root_frame->next = 0;
|
|
||||||
root_frame->ti_info_list = ti_info_list;
|
root_frame->ti_info_list = ti_info_list;
|
||||||
root_frame->ti_info = ti_info_list.first;
|
root_frame->ti_info = ti_info_list.first;
|
||||||
root_frame->data = data;
|
root_frame->leaf = leaf;
|
||||||
root_frame->ti = 0;
|
root_frame->ti = ti;
|
||||||
root_frame->ti_source = CV_TypeIndexSource_NULL;
|
root_frame->ti_source = ti_source;
|
||||||
MemoryZeroStruct(&root_frame->leaf);
|
|
||||||
|
|
||||||
U64 **curr_hashes = hashes->v[loc_type][loc_idx];
|
U64 **curr_hashes = hashes->v[loc_type][loc_idx];
|
||||||
|
|
||||||
@@ -1283,18 +1282,18 @@ lnk_hash_cv_leaf_deep(Arena *arena,
|
|||||||
stack->ti_info = stack->ti_info->next;
|
stack->ti_info = stack->ti_info->next;
|
||||||
|
|
||||||
// get type index info
|
// get type index info
|
||||||
CV_TypeIndex *ti_ptr = (CV_TypeIndex *) (stack->data.str + curr_ti_info->offset);
|
CV_TypeIndex *ti_ptr = (CV_TypeIndex *) (stack->leaf.data.str + curr_ti_info->offset);
|
||||||
CV_TypeIndex ti = memory_read32(ti_ptr);
|
CV_TypeIndex ti = memory_read32(ti_ptr);
|
||||||
|
|
||||||
// is index complex?
|
// is index complex?
|
||||||
if (ti >= ti_ranges[curr_ti_info->source].min) {
|
if (ti >= ti_ranges[curr_ti_info->source].min) {
|
||||||
// TODO: handle malformed index
|
// TODO: handle malformed index
|
||||||
AssertAlways(ti < ti_ranges[curr_ti_info->source].max);
|
AssertAlways(ti < ti_ranges[curr_ti_info->source].max);
|
||||||
U64 ti_idx = (ti - ti_ranges[curr_ti_info->source].min);
|
U64 leaf_idx = (ti - ti_ranges[curr_ti_info->source].min);
|
||||||
|
|
||||||
// was leaf hashed?
|
// was leaf hashed?
|
||||||
if (curr_hashes[curr_ti_info->source][ti_idx] == 0) { // :zero_hash_array
|
if (curr_hashes[curr_ti_info->source][leaf_idx] == 0) { // :zero_hash_array
|
||||||
CV_Leaf leaf = cv_debug_t_get_leaf(leaves[curr_ti_info->source], ti_idx);
|
CV_Leaf leaf = cv_debug_t_get_leaf(leaves[curr_ti_info->source], leaf_idx);
|
||||||
|
|
||||||
// find index offsets
|
// find index offsets
|
||||||
CV_TypeIndexInfoList sub_ti_info_list = cv_get_leaf_type_index_offsets(temp.arena, leaf.kind, leaf.data);
|
CV_TypeIndexInfoList sub_ti_info_list = cv_get_leaf_type_index_offsets(temp.arena, leaf.kind, leaf.data);
|
||||||
@@ -1302,12 +1301,10 @@ lnk_hash_cv_leaf_deep(Arena *arena,
|
|||||||
// do we have sub leaves?
|
// do we have sub leaves?
|
||||||
if (sub_ti_info_list.count) {
|
if (sub_ti_info_list.count) {
|
||||||
// fill out new frame
|
// fill out new frame
|
||||||
struct stack_s *frame = push_array_no_zero(temp.arena, struct stack_s, 1);
|
struct stack_s *frame = push_array(temp.arena, struct stack_s, 1);
|
||||||
frame->next = 0;
|
|
||||||
frame->ti_info_list = sub_ti_info_list;
|
frame->ti_info_list = sub_ti_info_list;
|
||||||
frame->ti_info = sub_ti_info_list.first;
|
frame->ti_info = sub_ti_info_list.first;
|
||||||
frame->leaf = leaf;
|
frame->leaf = leaf;
|
||||||
frame->data = leaf.data;
|
|
||||||
frame->ti = ti;
|
frame->ti = ti;
|
||||||
frame->ti_source = curr_ti_info->source;
|
frame->ti_source = curr_ti_info->source;
|
||||||
|
|
||||||
@@ -1315,14 +1312,7 @@ lnk_hash_cv_leaf_deep(Arena *arena,
|
|||||||
SLLStackPush(stack, frame);
|
SLLStackPush(stack, frame);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
curr_hashes[curr_ti_info->source][ti_idx] = lnk_hash_cv_leaf(input,
|
curr_hashes[curr_ti_info->source][leaf_idx] = lnk_hash_cv_leaf(input, hashes, loc_type, loc_idx, ti_ranges, CV_TypeIndex_Max, leaf, sub_ti_info_list);
|
||||||
hashes,
|
|
||||||
loc_type,
|
|
||||||
loc_idx,
|
|
||||||
ti_ranges,
|
|
||||||
CV_TypeIndex_Max,
|
|
||||||
leaf,
|
|
||||||
sub_ti_info_list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1330,24 +1320,17 @@ lnk_hash_cv_leaf_deep(Arena *arena,
|
|||||||
|
|
||||||
// no more type indices, pop frame
|
// no more type indices, pop frame
|
||||||
if (!stack->ti_info) {
|
if (!stack->ti_info) {
|
||||||
|
|
||||||
if (stack != root_frame) {
|
|
||||||
// sub leaves are hashed we can now hash parent leaf
|
|
||||||
U64 leaf_idx = stack->ti - ti_ranges[stack->ti_source].min;
|
|
||||||
curr_hashes[stack->ti_source][leaf_idx] = lnk_hash_cv_leaf(input,
|
|
||||||
hashes,
|
|
||||||
loc_type,
|
|
||||||
loc_idx,
|
|
||||||
ti_ranges,
|
|
||||||
CV_TypeIndex_Max,
|
|
||||||
stack->leaf,
|
|
||||||
stack->ti_info_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
SLLStackPop(stack);
|
SLLStackPop(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sub leaves are hashed we can now hash parent leaf
|
||||||
|
{
|
||||||
|
U64 leaf_idx = ti - ti_ranges[ti_source].min;
|
||||||
|
curr_hashes[ti_source][leaf_idx] = lnk_hash_cv_leaf(input, hashes, loc_type, loc_idx, ti_ranges, CV_TypeIndex_Max, leaf, ti_info_list);
|
||||||
|
Assert(curr_hashes[ti_source][leaf_idx] != 0);
|
||||||
|
}
|
||||||
|
|
||||||
temp_end(temp);
|
temp_end(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1502,39 +1485,25 @@ THREAD_POOL_TASK_FUNC(lnk_hash_debug_t_task)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal
|
internal
|
||||||
THREAD_POOL_TASK_FUNC(lnk_hash_type_server_leaves_task)
|
THREAD_POOL_TASK_FUNC(lnk_hash_debug_t_deep_task)
|
||||||
{
|
{
|
||||||
ProfBeginFunction();
|
ProfBeginFunction();
|
||||||
|
|
||||||
LNK_CvImportTypes *task = raw_task;
|
LNK_CvImportTypes *task = raw_task;
|
||||||
U64 obj_idx = task_id;
|
U64 ts_idx = task_id;
|
||||||
|
CV_TypeIndexSource ti_source = task->ti_source;
|
||||||
|
CV_DebugT debug_t = task->debug_t_arr [ts_idx];
|
||||||
|
Rng1U64 *ti_ranges = task->input->external_ti_ranges[ts_idx];
|
||||||
|
CV_DebugT *leaves = task->input->external_leaves [ts_idx];
|
||||||
|
|
||||||
LNK_CodeViewInput *input = task->input;
|
for EachIndex(leaf_idx, debug_t.count) {
|
||||||
LNK_LeafHashes *hashes = task->hashes;
|
U64 hash = task->hashes->v[LNK_LeafLocType_External][ts_idx] [ti_source][leaf_idx];
|
||||||
|
if (hash != 0) { continue; }
|
||||||
CV_SymbolListArray parsed_symbols = input->external_parsed_symbols[obj_idx];
|
|
||||||
CV_DebugS debug_s = input->external_debug_s_arr[obj_idx];
|
|
||||||
U64 ts_idx = input->external_obj_to_ts_idx_arr[obj_idx];
|
|
||||||
CV_DebugT *leaves = input->external_leaves[ts_idx];
|
|
||||||
Rng1U64 *ti_ranges = input->external_ti_ranges[ts_idx];
|
|
||||||
|
|
||||||
// hash leaves referenced in symbols
|
|
||||||
for EachIndex(i, parsed_symbols.count) {
|
|
||||||
CV_SymbolList symbol_list = parsed_symbols.v[i];
|
|
||||||
for EachNode(symnode, CV_SymbolNode, symbol_list.first) {
|
|
||||||
Temp temp = temp_begin(task->fixed_arenas[worker_id]);
|
|
||||||
CV_TypeIndexInfoList ti_info_list = cv_get_symbol_type_index_offsets(temp.arena, symnode->data.kind, symnode->data.data);
|
|
||||||
lnk_hash_cv_leaf_deep(temp.arena, task->input, ti_ranges, leaves, hashes, LNK_LeafLocType_External, ts_idx, ti_info_list, symnode->data.data);
|
|
||||||
temp_end(temp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// hash leaves referenced in inlinees
|
|
||||||
String8List inline_data_list = cv_sub_section_from_debug_s(debug_s, CV_C13SubSectionKind_InlineeLines);
|
|
||||||
for EachNode(inline_data_node, String8Node, inline_data_list.first) {
|
|
||||||
Temp temp = temp_begin(task->fixed_arenas[worker_id]);
|
Temp temp = temp_begin(task->fixed_arenas[worker_id]);
|
||||||
CV_TypeIndexInfoList ti_info_list = cv_get_inlinee_type_index_offsets(temp.arena, inline_data_node->string);
|
CV_Leaf leaf = cv_debug_t_get_leaf(debug_t, leaf_idx);
|
||||||
lnk_hash_cv_leaf_deep(temp.arena, task->input, ti_ranges, leaves, hashes, LNK_LeafLocType_External, ts_idx, ti_info_list, inline_data_node->string);
|
CV_TypeIndexInfoList ti_info_list = cv_get_leaf_type_index_offsets(temp.arena, leaf.kind, leaf.data);
|
||||||
|
CV_TypeIndex ti = ti_ranges[ti_source].min + leaf_idx;
|
||||||
|
lnk_hash_cv_leaf_deep(temp.arena, task->input, ti_ranges, leaves, task->hashes, ti_source, ti, LNK_LeafLocType_External, ts_idx, ti_info_list, leaf);
|
||||||
temp_end(temp);
|
temp_end(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2239,9 +2208,13 @@ lnk_merge_types(TP_Context *tp, TP_Arena *tp_temp, LNK_CodeViewInput *input)
|
|||||||
tp_for_parallel(tp, 0, input->internal_count, lnk_hash_debug_t_task, &task);
|
tp_for_parallel(tp, 0, input->internal_count, lnk_hash_debug_t_task, &task);
|
||||||
ProfEnd();
|
ProfEnd();
|
||||||
|
|
||||||
ProfBegin("Hash Type Server Leaves [Count: %.*s]", str8_varg(str8_from_count(scratch.arena, input->external_count)));
|
task.ti_source = CV_TypeIndexSource_IPI;
|
||||||
tp_for_parallel(tp, 0, input->external_count, lnk_hash_type_server_leaves_task, &task);
|
task.debug_t_arr = input->external_leaves[task.ti_source];
|
||||||
ProfEnd();
|
tp_for_parallel_prof(tp, 0, input->type_server_count, lnk_hash_debug_t_deep_task, &task, "Hash IPI Type Servers");
|
||||||
|
|
||||||
|
task.ti_source = CV_TypeIndexSource_TPI;
|
||||||
|
task.debug_t_arr = input->external_leaves[task.ti_source];
|
||||||
|
tp_for_parallel_prof(tp, 0, input->type_server_count, lnk_hash_debug_t_deep_task, &task, "Hash IPI Type Servers");
|
||||||
}
|
}
|
||||||
ProfEnd();
|
ProfEnd();
|
||||||
|
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ internal B32 lnk_match_leaf_ref (LNK_CodeViewInput *in
|
|||||||
|
|
||||||
// leaf hashing
|
// leaf hashing
|
||||||
internal U64 lnk_hash_cv_leaf (LNK_CodeViewInput *input, LNK_LeafHashes *hashes, LNK_LeafLocType loc_type, U32 loc_idx, Rng1U64 *ti_ranges, CV_TypeIndex curr_ti, CV_Leaf leaf, CV_TypeIndexInfoList ti_info_list);
|
internal U64 lnk_hash_cv_leaf (LNK_CodeViewInput *input, LNK_LeafHashes *hashes, LNK_LeafLocType loc_type, U32 loc_idx, Rng1U64 *ti_ranges, CV_TypeIndex curr_ti, CV_Leaf leaf, CV_TypeIndexInfoList ti_info_list);
|
||||||
internal void lnk_hash_cv_leaf_deep(Arena *arena, LNK_CodeViewInput *input, Rng1U64 *ti_ranges, CV_DebugT *leaves, LNK_LeafHashes *hashes, LNK_LeafLocType loc_type, U32 loc_idx, CV_TypeIndexInfoList ti_info_list, String8 data);
|
internal void lnk_hash_cv_leaf_deep(Arena *arena, LNK_CodeViewInput *input, Rng1U64 *ti_ranges, CV_DebugT *leaves, LNK_LeafHashes *hashes, CV_TypeIndexSource ti_source, CV_TypeIndex ti, LNK_LeafLocType loc_type, U32 loc_idx, CV_TypeIndexInfoList ti_info_list, CV_Leaf leaf);
|
||||||
internal U64 lnk_hash_from_leaf_ref(LNK_LeafHashes *hashes, LNK_LeafRef leaf_ref);
|
internal U64 lnk_hash_from_leaf_ref(LNK_LeafHashes *hashes, LNK_LeafRef leaf_ref);
|
||||||
|
|
||||||
// leaf hash table
|
// leaf hash table
|
||||||
|
|||||||
Reference in New Issue
Block a user