mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
rdi pass checkpoint: rdi baking; scope-organized locals gathering / sorting / organizing; plug into serialization path
This commit is contained in:
@@ -146,7 +146,7 @@ if "%convertperf%"=="1" set didbuild=1 && %compile% ..\src\scratc
|
||||
if "%debugstringperf%"=="1" set didbuild=1 && %compile% ..\src\scratch\debugstringperf.c %compile_link% %out%debugstringperf.exe || exit /b 1
|
||||
if "%parse_inline_sites%"=="1" set didbuild=1 && %compile% ..\src\scratch\parse_inline_sites.c %compile_link% %out%parse_inline_sites.exe || exit /b 1
|
||||
if "%strip_lib_debug%"=="1" set didbuild=1 && %compile% ..\src\strip_lib_debug\strip_lib_debug.c %compile_link% %out%strip_lib_debug.exe || exit /b 1
|
||||
if "%mule_main%"=="1" set didbuild=1 && del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp %out%mule_inline.obj && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp %out%mule_o2.obj && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
|
||||
if "%mule_main%"=="1" set didbuild=1 && del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
|
||||
if "%mule_module%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_module.cpp %link_dll% %out%mule_module.dll || exit /b 1
|
||||
if "%mule_hotload%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_hotload_main.c %compile_link% %out%mule_hotload.exe & %compile% ..\src\mule\mule_hotload_module_main.c %compile_link% %link_dll% %out%mule_hotload_module.dll || exit /b 1
|
||||
if "%torture%"=="1" set didbuild=1 && %compile% ..\src\torture\torture_main.c %compile_link% %out%torture.exe || exit /b1
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ commands =
|
||||
//- rjf: [raddbg]
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg meta telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .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
-14
@@ -1117,6 +1117,7 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
{RDI_DumpSubset_Procedures, RDI_SectionKind_ProcedureSymbols},
|
||||
{RDI_DumpSubset_GlobalVariables, RDI_SectionKind_GlobalVariableSymbols},
|
||||
{RDI_DumpSubset_ThreadVariables, RDI_SectionKind_ThreadVariableSymbols},
|
||||
{RDI_DumpSubset_LocalVariables, RDI_SectionKind_LocalVariableSymbols},
|
||||
{RDI_DumpSubset_Constants, RDI_SectionKind_ConstantSymbols},
|
||||
};
|
||||
for EachElement(symbol_table_idx, symbol_tables)
|
||||
@@ -1137,6 +1138,7 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
dumpf(" type_idx: %u\n", symbol->type_idx);
|
||||
dumpf(" root_scope_idx: %u\n", symbol->root_scope_idx);
|
||||
dumpf(" container_idx: %u\n", symbol->container_idx);
|
||||
// TODO(rjf): location info
|
||||
dumpf(" }\n");
|
||||
scratch_end(scratch);
|
||||
}
|
||||
@@ -1153,7 +1155,7 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
U64 scope_voffs_count = 0;
|
||||
U64 *scope_voffs = rdi_table_from_name(rdi, ScopeVOffData, &scope_voffs_count);
|
||||
U64 locals_count = 0;
|
||||
RDI_Local *locals = rdi_table_from_name(rdi, Locals, &locals_count);
|
||||
RDI_Symbol *locals = rdi_table_from_name(rdi, LocalVariableSymbols, &locals_count);
|
||||
U64 count = 0;
|
||||
RDI_Scope *v = rdi_table_from_name(rdi, Scopes, &count);
|
||||
RDI_Scope *nil = &v[0];
|
||||
@@ -1217,22 +1219,10 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
for(U32 local_idx = local_lo; local_idx < local_hi; local_idx += 1)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
RDI_Local *local_ptr = &locals[local_idx];
|
||||
RDI_Symbol *local_ptr = &locals[local_idx];
|
||||
dumpf("%.*s '%S': // local[%u]\n", depth*2, indent.str, str8_from_rdi_string_idx(rdi, local_ptr->name_string_idx), local_idx);
|
||||
dumpf("%.*s {\n", depth*2, indent.str);
|
||||
dumpf("%.*s kind: %S\n", depth*2, indent.str, rdi_string_from_local_kind(scratch.arena, local_ptr->kind));
|
||||
dumpf("%.*s type_idx: %u\n", depth*2, indent.str, local_ptr->type_idx);
|
||||
dumpf("%.*s locations:\n", depth*2, indent.str);
|
||||
dumpf("%.*s {\n", depth*2, indent.str);
|
||||
if(local_ptr->location_first < local_ptr->location_opl)
|
||||
{
|
||||
String8List locations_strings = rdi_strings_from_locations(arena, rdi, tli->arch, r1u64(local_ptr->location_first, local_ptr->location_opl));
|
||||
for(String8Node *n = locations_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
dumpf("%.*s %S\n", depth*2, indent.str, n->string);
|
||||
}
|
||||
}
|
||||
dumpf("%.*s }\n", depth*2, indent.str);
|
||||
dumpf("%.*s }\n", depth*2, indent.str);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ X(UserDefinedTypes, user_defined_types, "USER DEFINED TYPES")\
|
||||
X(GlobalVariables, global_variables, "GLOBAL VARIABLES")\
|
||||
X(GlobalVariablesVMap, global_variables_vmap, "GLOBAL VARIABLE VMAP")\
|
||||
X(ThreadVariables, thread_variables, "THREAD VARIABLES")\
|
||||
X(LocalVariables, local_variables, "LOCAL VARIABLES")\
|
||||
X(Constants, constants, "CONSTANTS")\
|
||||
X(Procedures, procedures, "PROCEDURES")\
|
||||
X(Scopes, scopes, "SCOPES")\
|
||||
|
||||
@@ -2973,6 +2973,7 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
RDI_U64 *scope_local_chunk_lane_offs; // [lane_count * scope_chunk_count]
|
||||
RDI_U64 *scope_voff_chunk_lane_counts; // [lane_count * scope_chunk_count]
|
||||
RDI_U64 *scope_voff_chunk_lane_offs; // [lane_count * scope_chunk_count]
|
||||
U64 total_local_count;
|
||||
};
|
||||
ScopeLayout *scope_layout = 0;
|
||||
ProfScope("compute layout for scope sub-lists (locals / voffs)")
|
||||
@@ -3026,6 +3027,7 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
scope_layout->total_local_count = local_layout_off;
|
||||
}
|
||||
lane_sync();
|
||||
}
|
||||
@@ -3041,7 +3043,7 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
RDI_U64 scopes_count;
|
||||
RDI_U64 *scope_voffs;
|
||||
RDI_U64 scope_voffs_count;
|
||||
RDIM_SymbolChunkList arranged_locals;
|
||||
RDIM_SymbolChunkNode arranged_locals_chunk;
|
||||
};
|
||||
BakedScopes *baked_scopes = 0;
|
||||
ProfScope("bake scopes")
|
||||
@@ -3062,6 +3064,13 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
baked_scopes->scope_voffs_count = all_scopes->scope_voff_count+1;
|
||||
baked_scopes->scope_voffs = push_array(arena, RDI_U64, baked_scopes->scope_voffs_count);
|
||||
}
|
||||
if(lane_idx() == lane_from_task_idx(2))
|
||||
{
|
||||
baked_scopes->arranged_locals_chunk.count = scope_layout->total_local_count;
|
||||
baked_scopes->arranged_locals_chunk.cap = baked_scopes->arranged_locals_chunk.count;
|
||||
baked_scopes->arranged_locals_chunk.base_idx = 0;
|
||||
baked_scopes->arranged_locals_chunk.v = push_array(scratch.arena, RDIM_Symbol, baked_scopes->arranged_locals_chunk.count);
|
||||
}
|
||||
lane_sync();
|
||||
|
||||
//- rjf: wide fill
|
||||
@@ -3096,18 +3105,18 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
for EachIndex(src_local_idx, src_local_n->count)
|
||||
{
|
||||
RDIM_Symbol *src_local = &src_local_n->v[src_local_idx];
|
||||
#if 0
|
||||
RDI_Symbol *dst_local = &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
|
||||
if(src_local->location_cases.count != 0)
|
||||
{
|
||||
dst_local->location_first = chunk_location_block_off;
|
||||
dst_local->location_opl = chunk_location_block_off + src_local->location_cases.count;
|
||||
chunk_location_block_off += src_local->location_cases.count;
|
||||
}
|
||||
#endif
|
||||
RDIM_Symbol *dst_local = &baked_scopes->arranged_locals_chunk.v[chunk_local_off];
|
||||
dst_local->chunk = &baked_scopes->arranged_locals_chunk;
|
||||
dst_local->is_extern = src_local->is_extern;
|
||||
dst_local->is_param = src_local->is_param;
|
||||
dst_local->name = src_local->name;
|
||||
dst_local->link_name = src_local->link_name;
|
||||
dst_local->type = src_local->type;
|
||||
dst_local->container_scope = src_local->container_scope;
|
||||
dst_local->container_type = src_local->container_type;
|
||||
dst_local->container_namespace = src_local->container_namespace;
|
||||
dst_local->root_scope = src_local->root_scope;
|
||||
dst_local->location_cases = src_local->location_cases;
|
||||
chunk_local_off += 1;
|
||||
}
|
||||
}
|
||||
@@ -3130,6 +3139,19 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
}
|
||||
lane_sync();
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage form local chunk list for all arranged locals
|
||||
//
|
||||
RDIM_SymbolChunkList *all_locals = 0;
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
all_locals = push_array(scratch.arena, RDIM_SymbolChunkList, 1);
|
||||
all_locals[0].first = all_locals[0].last = &baked_scopes->arranged_locals_chunk;
|
||||
all_locals[0].chunk_count = 1;
|
||||
all_locals[0].total_count = baked_scopes->arranged_locals_chunk.count;
|
||||
}
|
||||
lane_sync_u64(&all_locals, 0);
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage bake procedures
|
||||
//
|
||||
@@ -3554,7 +3576,7 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
{all_thread_variables, &baked_thread_variables, &baked_thread_variables_count},
|
||||
{all_procedures, &baked_procedures, &baked_procedures_count},
|
||||
{all_constants, &baked_constants, &baked_constants_count},
|
||||
{&baked_scopes->arranged_locals, &baked_locals, &baked_locals_count},
|
||||
{all_locals, &baked_locals, &baked_locals_count},
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user