mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-07 06:18:42 +00:00
more determinism fixes
This commit is contained in:
@@ -379,7 +379,12 @@ str8_is_before(String8 a, String8 b)
|
|||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(off+1 == common_size)
|
else if(a.str[off] > b.str[off])
|
||||||
|
{
|
||||||
|
result = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(off+1 == common_size)
|
||||||
{
|
{
|
||||||
result = (a.size < b.size);
|
result = (a.size < b.size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1740,7 +1740,12 @@ rdim_bake_idx_run_is_before(void *l, void *r)
|
|||||||
is_less_than = 1;
|
is_less_than = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(off+1 == common_count)
|
else if(lir->idxes[off] > rir->idxes[off])
|
||||||
|
{
|
||||||
|
is_less_than = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if(off+1 == common_count)
|
||||||
{
|
{
|
||||||
is_less_than = (lir->count < rir->count);
|
is_less_than = (lir->count < rir->count);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -763,36 +763,34 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
|
|||||||
{
|
{
|
||||||
rdim_unit_chunk_list_push(arena, &p2r2_shared->all_units, comp_units->count);
|
rdim_unit_chunk_list_push(arena, &p2r2_shared->all_units, comp_units->count);
|
||||||
}
|
}
|
||||||
p2r2_shared->lanes_main_line_tables = push_array(arena, RDIM_LineTableChunkList, lane_count());
|
p2r2_shared->units_line_tables = push_array(arena, RDIM_LineTableChunkList, comp_units->count);
|
||||||
p2r2_shared->lanes_inline_line_tables = push_array(arena, RDIM_LineTableChunkList, lane_count());
|
p2r2_shared->units_first_inline_site_line_tables = push_array(arena, RDIM_LineTable *, comp_units->count);
|
||||||
p2r2_shared->lanes_first_inline_site_line_tables = push_array(arena, RDIM_LineTable *, lane_count());
|
|
||||||
p2r2_shared->sym_lane_take_counter = 0;
|
p2r2_shared->sym_lane_take_counter = 0;
|
||||||
}
|
}
|
||||||
lane_sync();
|
lane_sync();
|
||||||
RDIM_Unit *units = p2r2_shared->all_units.first->v;
|
RDIM_Unit *units = p2r2_shared->all_units.first->v;
|
||||||
U64 units_count = p2r2_shared->all_units.first->count;
|
U64 units_count = p2r2_shared->all_units.first->count;
|
||||||
RDIM_LineTableChunkList *lanes_main_line_tables = p2r2_shared->lanes_main_line_tables;
|
RDIM_LineTableChunkList *units_line_tables = p2r2_shared->units_line_tables;
|
||||||
RDIM_LineTableChunkList *lanes_inline_line_tables = p2r2_shared->lanes_inline_line_tables;
|
|
||||||
Assert(units_count == comp_units->count);
|
Assert(units_count == comp_units->count);
|
||||||
|
|
||||||
//- rjf: do per-lane work
|
//- rjf: do per-lane work
|
||||||
|
ProfScope("wide fill") for(;;)
|
||||||
{
|
{
|
||||||
RDIM_LineTableChunkList *dst_main_line_tables = &lanes_main_line_tables[lane_idx()];
|
//- rjf: take next unit
|
||||||
RDIM_LineTableChunkList *dst_inline_line_tables = &lanes_inline_line_tables[lane_idx()];
|
U64 unit_num = ins_atomic_u64_inc_eval(&p2r2_shared->sym_lane_take_counter);
|
||||||
|
if(unit_num > comp_units->count)
|
||||||
//- rjf: per-unit line table conversion
|
|
||||||
ProfScope("per-unit line table conversion")
|
|
||||||
{
|
|
||||||
Rng1U64 range = lane_range(units_count);
|
|
||||||
for EachInRange(idx, range)
|
|
||||||
{
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
PDB_CompUnit *src_unit = comp_units->units[idx];
|
U64 unit_idx = unit_num-1;
|
||||||
CV_SymParsed *src_unit_sym = all_syms[idx+1];
|
RDIM_LineTableChunkList *dst_line_tables = &units_line_tables[unit_idx];
|
||||||
CV_C13Parsed *src_unit_c13 = all_c13s[idx+1];
|
PDB_CompUnit *src_unit = comp_units->units[unit_idx];
|
||||||
RDIM_Unit *dst_unit = &units[idx];
|
CV_SymParsed *src_unit_sym = all_syms[unit_idx+1];
|
||||||
|
CV_C13Parsed *src_unit_c13 = all_c13s[unit_idx+1];
|
||||||
|
RDIM_Unit *dst_unit = &units[unit_idx];
|
||||||
|
|
||||||
// rjf: produce unit name
|
// rjf: extract unit name
|
||||||
String8 unit_name = src_unit->obj_name;
|
String8 unit_name = src_unit->obj_name;
|
||||||
if(unit_name.size != 0)
|
if(unit_name.size != 0)
|
||||||
{
|
{
|
||||||
@@ -812,9 +810,10 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
|
|||||||
}
|
}
|
||||||
String8 obj_folder_path = backslashed_from_str8(scratch.arena, str8_chop_last_slash(obj_name));
|
String8 obj_folder_path = backslashed_from_str8(scratch.arena, str8_chop_last_slash(obj_name));
|
||||||
|
|
||||||
// rjf: build this unit's line table, fill out primary line info (inline info added after)
|
//- rjf: main unit line table conversion
|
||||||
|
ProfScope("main unit line table conversion")
|
||||||
|
{
|
||||||
RDIM_LineTable *line_table = 0;
|
RDIM_LineTable *line_table = 0;
|
||||||
ProfScope("build unit line table")
|
|
||||||
for(CV_C13SubSectionNode *node = src_unit_c13->first_sub_section;
|
for(CV_C13SubSectionNode *node = src_unit_c13->first_sub_section;
|
||||||
node != 0;
|
node != 0;
|
||||||
node = node->next)
|
node = node->next)
|
||||||
@@ -865,9 +864,9 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
|
|||||||
{
|
{
|
||||||
if(line_table == 0)
|
if(line_table == 0)
|
||||||
{
|
{
|
||||||
line_table = rdim_line_table_chunk_list_push(arena, dst_main_line_tables, 256);
|
line_table = rdim_line_table_chunk_list_push(arena, dst_line_tables, 256);
|
||||||
}
|
}
|
||||||
RDIM_LineSequence *seq = rdim_line_table_push_sequence(arena, dst_main_line_tables, line_table, src_file_node->src_file, lines->voffs, lines->line_nums, lines->col_nums, lines->line_count);
|
RDIM_LineSequence *seq = rdim_line_table_push_sequence(arena, dst_line_tables, line_table, src_file_node->src_file, lines->voffs, lines->line_nums, lines->col_nums, lines->line_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -880,37 +879,12 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
|
|||||||
dst_unit->archive_file = src_unit->group_name;
|
dst_unit->archive_file = src_unit->group_name;
|
||||||
dst_unit->language = p2r_rdi_language_from_cv_language(src_unit_sym->info.language);
|
dst_unit->language = p2r_rdi_language_from_cv_language(src_unit_sym->info.language);
|
||||||
dst_unit->line_table = line_table;
|
dst_unit->line_table = line_table;
|
||||||
dst_unit->voff_ranges = unit_ranges[idx];
|
dst_unit->voff_ranges = unit_ranges[unit_idx];
|
||||||
|
|
||||||
scratch_end(scratch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: build per-inline-site line tables
|
//- rjf: build per-inline-site line tables
|
||||||
ProfScope("build per-inline-site line tables")
|
ProfScope("build per-inline-site line tables")
|
||||||
{
|
{
|
||||||
for(;;)
|
|
||||||
{
|
|
||||||
//- rjf: take next unit
|
|
||||||
U64 unit_num = ins_atomic_u64_inc_eval(&p2r2_shared->sym_lane_take_counter);
|
|
||||||
if(unit_num > comp_units->count)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
U64 unit_idx = unit_num-1;
|
|
||||||
|
|
||||||
//- rjf: unpack unit
|
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
|
||||||
PDB_CompUnit *src_unit = comp_units->units[unit_idx];
|
|
||||||
CV_SymParsed *src_unit_sym = all_syms[unit_idx+1];
|
|
||||||
CV_C13Parsed *src_unit_c13 = all_c13s[unit_idx+1];
|
|
||||||
String8 obj_name = src_unit->obj_name;
|
|
||||||
if(str8_match(obj_name, str8_lit("* Linker *"), 0) ||
|
|
||||||
str8_match(obj_name, str8_lit("Import:"), StringMatchFlag_RightSideSloppy))
|
|
||||||
{
|
|
||||||
MemoryZeroStruct(&obj_name);
|
|
||||||
}
|
|
||||||
String8 obj_folder_path = backslashed_from_str8(scratch.arena, str8_chop_last_slash(obj_name));
|
|
||||||
CV_RecRange *rec_ranges_first = src_unit_sym->sym_ranges.ranges;
|
CV_RecRange *rec_ranges_first = src_unit_sym->sym_ranges.ranges;
|
||||||
CV_RecRange *rec_ranges_opl = src_unit_sym->sym_ranges.ranges + src_unit_sym->sym_ranges.count;
|
CV_RecRange *rec_ranges_opl = src_unit_sym->sym_ranges.ranges + src_unit_sym->sym_ranges.count;
|
||||||
U64 base_voff = 0;
|
U64 base_voff = 0;
|
||||||
@@ -1083,13 +1057,13 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
|
|||||||
{
|
{
|
||||||
if(line_table == 0)
|
if(line_table == 0)
|
||||||
{
|
{
|
||||||
line_table = rdim_line_table_chunk_list_push(arena, dst_inline_line_tables, 256);
|
line_table = rdim_line_table_chunk_list_push(arena, dst_line_tables, 256);
|
||||||
if(p2r2_shared->lanes_first_inline_site_line_tables[lane_idx()] == 0)
|
if(p2r2_shared->units_first_inline_site_line_tables[unit_idx] == 0)
|
||||||
{
|
{
|
||||||
p2r2_shared->lanes_first_inline_site_line_tables[lane_idx()] = line_table;
|
p2r2_shared->units_first_inline_site_line_tables[unit_idx] = line_table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rdim_line_table_push_sequence(arena, dst_inline_line_tables, line_table, src_file_node->src_file, voffs, line_nums, 0, line_count);
|
rdim_line_table_push_sequence(arena, dst_line_tables, line_table, src_file_node->src_file, voffs, line_nums, 0, line_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
// rjf: clear line chunks for subsequent sequences
|
// rjf: clear line chunks for subsequent sequences
|
||||||
@@ -1126,29 +1100,24 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
|
|||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
lane_sync();
|
lane_sync();
|
||||||
RDIM_UnitChunkList all_units = p2r2_shared->all_units;
|
RDIM_UnitChunkList all_units = p2r2_shared->all_units;
|
||||||
RDIM_LineTableChunkList *lanes_main_line_tables = p2r2_shared->lanes_main_line_tables;
|
RDIM_LineTableChunkList *units_line_tables = p2r2_shared->units_line_tables;
|
||||||
RDIM_LineTableChunkList *lanes_inline_line_tables = p2r2_shared->lanes_inline_line_tables;
|
RDIM_LineTable **units_first_inline_site_line_tables = p2r2_shared->units_first_inline_site_line_tables;
|
||||||
RDIM_LineTable **lanes_first_inline_site_line_tables = p2r2_shared->lanes_first_inline_site_line_tables;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
//- rjf: join all line tables
|
//- rjf: join all line tables
|
||||||
//
|
//
|
||||||
ProfScope("join all line tables") if(lane_idx() == 0)
|
ProfScope("join all line tables") if(lane_idx() == 0)
|
||||||
{
|
{
|
||||||
for EachIndex(idx, lane_count())
|
for EachIndex(idx, comp_units->count)
|
||||||
{
|
{
|
||||||
rdim_line_table_chunk_list_concat_in_place(&p2r2_shared->all_line_tables, &p2r2_shared->lanes_main_line_tables[idx]);
|
rdim_line_table_chunk_list_concat_in_place(&p2r2_shared->all_line_tables, &units_line_tables[idx]);
|
||||||
}
|
|
||||||
for EachIndex(idx, lane_count())
|
|
||||||
{
|
|
||||||
rdim_line_table_chunk_list_concat_in_place(&p2r2_shared->all_line_tables, &p2r2_shared->lanes_inline_line_tables[idx]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lane_sync();
|
lane_sync();
|
||||||
@@ -3035,7 +3004,7 @@ p2r2_convert(Arena *arena, P2R_ConvertParams *params)
|
|||||||
};
|
};
|
||||||
P2R_ScopeNode *top_scope_node = 0;
|
P2R_ScopeNode *top_scope_node = 0;
|
||||||
P2R_ScopeNode *free_scope_node = 0;
|
P2R_ScopeNode *free_scope_node = 0;
|
||||||
RDIM_LineTable *inline_site_line_table = lanes_first_inline_site_line_tables[lane_idx()];
|
RDIM_LineTable *inline_site_line_table = sym_idx > 0 ? units_first_inline_site_line_tables[sym_idx-1] : 0;
|
||||||
for(CV_RecRange *rec_range = rec_ranges_first;
|
for(CV_RecRange *rec_range = rec_ranges_first;
|
||||||
rec_range < rec_ranges_opl;
|
rec_range < rec_ranges_opl;
|
||||||
rec_range += 1)
|
rec_range += 1)
|
||||||
|
|||||||
@@ -68,9 +68,8 @@ struct P2R2_Shared
|
|||||||
P2R_SrcFileMap src_file_map;
|
P2R_SrcFileMap src_file_map;
|
||||||
|
|
||||||
RDIM_UnitChunkList all_units;
|
RDIM_UnitChunkList all_units;
|
||||||
RDIM_LineTableChunkList *lanes_main_line_tables;
|
RDIM_LineTableChunkList *units_line_tables;
|
||||||
RDIM_LineTableChunkList *lanes_inline_line_tables;
|
RDIM_LineTable **units_first_inline_site_line_tables;
|
||||||
RDIM_LineTable **lanes_first_inline_site_line_tables;
|
|
||||||
|
|
||||||
RDIM_LineTableChunkList all_line_tables;
|
RDIM_LineTableChunkList all_line_tables;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user