mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-18 18:12:23 -07:00
pull out type-only identifier resolution and switch to match store; eliminate synchronous matching work
This commit is contained in:
+9
-52
@@ -1738,8 +1738,8 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: built-ins
|
||||
case E_IdentifierResolutionPath_BuiltIns:
|
||||
//- rjf: built-in constants
|
||||
case E_IdentifierResolutionPath_BuiltInConstants:
|
||||
{
|
||||
// rjf: "true"
|
||||
if(!string_mapped && str8_match(string, str8_lit("true"), 0))
|
||||
@@ -1762,56 +1762,13 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
mapped_bytecode_mode = E_Mode_Value;
|
||||
}
|
||||
|
||||
// rjf: built-in type names
|
||||
if(0){}
|
||||
#define BuiltInType_XList \
|
||||
BasicCase("uint8", U8)\
|
||||
BasicCase("uint8_t", U8)\
|
||||
BasicCase("uchar", UChar8)\
|
||||
BasicCase("uchar8", UChar8)\
|
||||
BasicCase("uint16", U16)\
|
||||
BasicCase("uint16_t", U16)\
|
||||
BasicCase("uchar16", UChar16)\
|
||||
BasicCase("uint32", U32)\
|
||||
BasicCase("uint32_t", U32)\
|
||||
BasicCase("uchar32", UChar32)\
|
||||
BasicCase("uint64", U64)\
|
||||
BasicCase("uint64_t", U64)\
|
||||
BasicCase("uint128", U128)\
|
||||
BasicCase("uint128_t", U128)\
|
||||
BasicCase("uint256", U256)\
|
||||
BasicCase("uint256_t", U256)\
|
||||
BasicCase("uint512", U512)\
|
||||
BasicCase("uint512_t", U512)\
|
||||
BasicCase("int8", S8)\
|
||||
BasicCase("int8_t", S8)\
|
||||
BasicCase("char", Char8)\
|
||||
BasicCase("char8", Char8)\
|
||||
BasicCase("int16", S16)\
|
||||
BasicCase("int16_t", S16)\
|
||||
BasicCase("char16", Char16)\
|
||||
BasicCase("int32", S32)\
|
||||
BasicCase("int32_t", S32)\
|
||||
BasicCase("char32", Char32)\
|
||||
BasicCase("int64", S64)\
|
||||
BasicCase("int64_t", S64)\
|
||||
BasicCase("int128", S128)\
|
||||
BasicCase("int128_t", S128)\
|
||||
BasicCase("int256", S256)\
|
||||
BasicCase("int256_t", S256)\
|
||||
BasicCase("int512", S512)\
|
||||
BasicCase("int512_t", S512)\
|
||||
BasicCase("void", Void)\
|
||||
BasicCase("bool", Bool)\
|
||||
BasicCase("float", F32)\
|
||||
BasicCase("float32", F32)\
|
||||
BasicCase("double", F64)\
|
||||
BasicCase("float64", F64)\
|
||||
|
||||
#define BasicCase(str, kind) else if(str8_match(string, str8_lit(str), 0)) {string_mapped = 1; mapped_type_key = e_type_key_basic(E_TypeKind_##kind);}
|
||||
BuiltInType_XList
|
||||
#undef BasicCase
|
||||
}break;
|
||||
|
||||
//- rjf: built-in types
|
||||
case E_IdentifierResolutionPath_BuiltInTypes:
|
||||
{
|
||||
mapped_type_key = e_leaf_builtin_type_key_from_name(string);
|
||||
string_mapped = !e_type_key_match(mapped_type_key, e_type_key_zero());
|
||||
}break;
|
||||
|
||||
//- rjf: debug info matches
|
||||
|
||||
+6
-3
@@ -15,7 +15,8 @@ typedef enum E_IdentifierResolutionPath
|
||||
E_IdentifierResolutionPath_ImplicitThisMember,
|
||||
E_IdentifierResolutionPath_Local,
|
||||
E_IdentifierResolutionPath_DebugInfoMatch,
|
||||
E_IdentifierResolutionPath_BuiltIns,
|
||||
E_IdentifierResolutionPath_BuiltInConstants,
|
||||
E_IdentifierResolutionPath_BuiltInTypes,
|
||||
E_IdentifierResolutionPath_Registers,
|
||||
E_IdentifierResolutionPath_RegisterAliases,
|
||||
E_IdentifierResolutionPath_Macros,
|
||||
@@ -84,7 +85,8 @@ E_IdentifierResolutionPath e_default_identifier_resolution_paths[] =
|
||||
E_IdentifierResolutionPath_ParentExprMember,
|
||||
E_IdentifierResolutionPath_ImplicitThisMember,
|
||||
E_IdentifierResolutionPath_Local,
|
||||
E_IdentifierResolutionPath_BuiltIns,
|
||||
E_IdentifierResolutionPath_BuiltInConstants,
|
||||
E_IdentifierResolutionPath_BuiltInTypes,
|
||||
E_IdentifierResolutionPath_DebugInfoMatch,
|
||||
E_IdentifierResolutionPath_Registers,
|
||||
E_IdentifierResolutionPath_RegisterAliases,
|
||||
@@ -104,7 +106,8 @@ E_IdentifierResolutionPath e_callable_identifier_resolution_paths[] =
|
||||
E_IdentifierResolutionPath_ParentExprMember,
|
||||
E_IdentifierResolutionPath_ImplicitThisMember,
|
||||
E_IdentifierResolutionPath_Local,
|
||||
E_IdentifierResolutionPath_BuiltIns,
|
||||
E_IdentifierResolutionPath_BuiltInConstants,
|
||||
E_IdentifierResolutionPath_BuiltInTypes,
|
||||
E_IdentifierResolutionPath_DebugInfoMatch,
|
||||
E_IdentifierResolutionPath_Registers,
|
||||
E_IdentifierResolutionPath_RegisterAliases,
|
||||
|
||||
+66
-147
@@ -526,156 +526,75 @@ e_string_from_expr(Arena *arena, E_Expr *expr, String8 parent_expr_string)
|
||||
//~ rjf: Parsing Functions
|
||||
|
||||
internal E_TypeKey
|
||||
e_leaf_type_from_name(String8 name)
|
||||
e_leaf_builtin_type_key_from_name(String8 name)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
E_TypeKey key = zero_struct;
|
||||
B32 found = 0;
|
||||
if(!found)
|
||||
E_TypeKey result = {0};
|
||||
if(0){}
|
||||
#define BuiltInType_XList \
|
||||
BasicCase("uint8", U8)\
|
||||
BasicCase("uint8_t", U8)\
|
||||
BasicCase("uchar", UChar8)\
|
||||
BasicCase("uchar8", UChar8)\
|
||||
BasicCase("uint16", U16)\
|
||||
BasicCase("uint16_t", U16)\
|
||||
BasicCase("uchar16", UChar16)\
|
||||
BasicCase("uint32", U32)\
|
||||
BasicCase("uint32_t", U32)\
|
||||
BasicCase("uchar32", UChar32)\
|
||||
BasicCase("uint64", U64)\
|
||||
BasicCase("uint64_t", U64)\
|
||||
BasicCase("uint128", U128)\
|
||||
BasicCase("uint128_t", U128)\
|
||||
BasicCase("uint256", U256)\
|
||||
BasicCase("uint256_t", U256)\
|
||||
BasicCase("uint512", U512)\
|
||||
BasicCase("uint512_t", U512)\
|
||||
BasicCase("int8", S8)\
|
||||
BasicCase("int8_t", S8)\
|
||||
BasicCase("char", Char8)\
|
||||
BasicCase("char8", Char8)\
|
||||
BasicCase("int16", S16)\
|
||||
BasicCase("int16_t", S16)\
|
||||
BasicCase("char16", Char16)\
|
||||
BasicCase("int32", S32)\
|
||||
BasicCase("int32_t", S32)\
|
||||
BasicCase("char32", Char32)\
|
||||
BasicCase("int64", S64)\
|
||||
BasicCase("int64_t", S64)\
|
||||
BasicCase("int128", S128)\
|
||||
BasicCase("int128_t", S128)\
|
||||
BasicCase("int256", S256)\
|
||||
BasicCase("int256_t", S256)\
|
||||
BasicCase("int512", S512)\
|
||||
BasicCase("int512_t", S512)\
|
||||
BasicCase("void", Void)\
|
||||
BasicCase("bool", Bool)\
|
||||
BasicCase("float", F32)\
|
||||
BasicCase("float32", F32)\
|
||||
BasicCase("double", F64)\
|
||||
BasicCase("float64", F64)
|
||||
#define BasicCase(str, kind) else if(str8_match(name, str8_lit(str), 0)) {result = e_type_key_basic(E_TypeKind_##kind);}
|
||||
BuiltInType_XList
|
||||
#undef BasicCase
|
||||
return result;
|
||||
}
|
||||
|
||||
internal E_TypeKey
|
||||
e_leaf_type_key_from_name(String8 name)
|
||||
{
|
||||
E_TypeKey key = e_leaf_builtin_type_key_from_name(name);
|
||||
if(!e_type_key_match(e_type_key_zero(), key))
|
||||
{
|
||||
#define Case(str) (str8_match(name, str8_lit(str), 0))
|
||||
if(0){}
|
||||
else if(Case("uint8") || Case("uint8_t"))
|
||||
DI_Match match = di_match_from_name(e_base_ctx->dbgi_match_store, name, 0);
|
||||
if(match.section == RDI_SectionKind_TypeNodes)
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_U8);
|
||||
}
|
||||
else if(Case("uchar8") || Case("uchar"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_UChar8);
|
||||
}
|
||||
else if(Case("uint16") || Case("uint16_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_U16);
|
||||
}
|
||||
else if(Case("uchar16"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_UChar16);
|
||||
}
|
||||
else if(Case("uint32") || Case("uint32_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_U32);
|
||||
}
|
||||
else if(Case("uchar32"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_UChar32);
|
||||
}
|
||||
else if(Case("uint64") || Case("uint64_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_U64);
|
||||
}
|
||||
else if(Case("uint128") || Case("uint128_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_U128);
|
||||
}
|
||||
else if(Case("uint256") || Case("uint256_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_U256);
|
||||
}
|
||||
else if(Case("uint512") || Case("uint512_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_U512);
|
||||
}
|
||||
else if(Case("s8") || Case("b8") || Case("B8") || Case("i8") || Case("int8") || Case("int8_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_S8);
|
||||
}
|
||||
else if(Case("char8") || Case("char"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_Char8);
|
||||
}
|
||||
else if(Case("int16") || Case("int16_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_S16);
|
||||
}
|
||||
else if(Case("char16"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_Char16);
|
||||
}
|
||||
else if(Case("int32") || Case("int32_t") || Case("char32"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_S32);
|
||||
}
|
||||
else if(Case("char32"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_Char32);
|
||||
}
|
||||
else if(Case("int64") || Case("int64_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_S64);
|
||||
}
|
||||
else if(Case("int256") || Case("int256_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_S256);
|
||||
}
|
||||
else if(Case("int512") || Case("int512_t"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_S512);
|
||||
}
|
||||
else if(Case("void"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_Void);
|
||||
}
|
||||
else if(Case("bool"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_Bool);
|
||||
}
|
||||
else if(Case("float") || Case("float32"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_F32);
|
||||
}
|
||||
else if(Case("double") || Case("float64"))
|
||||
{
|
||||
found = 1;
|
||||
key = e_type_key_basic(E_TypeKind_F64);
|
||||
}
|
||||
#undef Case
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
for(U64 module_idx = 0; module_idx < e_base_ctx->modules_count; module_idx += 1)
|
||||
{
|
||||
RDI_Parsed *rdi = e_base_ctx->modules[module_idx].rdi;
|
||||
RDI_NameMap *name_map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_Types);
|
||||
RDI_ParsedNameMap parsed_name_map = {0};
|
||||
rdi_parsed_from_name_map(rdi, name_map, &parsed_name_map);
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &parsed_name_map, name.str, name.size);
|
||||
if(node != 0)
|
||||
{
|
||||
U32 match_count = 0;
|
||||
U32 *matches = rdi_matches_from_map_node(rdi, node, &match_count);
|
||||
if(match_count != 0)
|
||||
{
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, matches[0]);
|
||||
found = (type_node->kind != RDI_TypeKind_NULL);
|
||||
key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), matches[0], module_idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
E_Module *module = &e_base_ctx->modules[match.dbgi_idx];
|
||||
RDI_Parsed *rdi = module->rdi;
|
||||
U32 type_idx = match.idx;
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, type_idx);
|
||||
key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, (U32)match.dbgi_idx);
|
||||
}
|
||||
}
|
||||
ProfEnd();
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -690,7 +609,7 @@ e_type_key_from_expr(E_Expr *expr)
|
||||
default:{}break;
|
||||
case E_ExprKind_LeafIdentifier:
|
||||
{
|
||||
result = e_leaf_type_from_name(expr->string);
|
||||
result = e_leaf_type_key_from_name(expr->string);
|
||||
}break;
|
||||
case E_ExprKind_TypeIdent:
|
||||
{
|
||||
@@ -744,7 +663,7 @@ e_push_type_parse_from_text_tokens(Arena *arena, String8 text, E_TokenArray toke
|
||||
{
|
||||
token_string = str8_substr(token_string, r1u64(1, token_string.size-1));
|
||||
}
|
||||
E_TypeKey type_key = e_leaf_type_from_name(token_string);
|
||||
E_TypeKey type_key = e_leaf_type_key_from_name(token_string);
|
||||
if(!e_type_key_match(e_type_key_zero(), type_key))
|
||||
{
|
||||
token_it += 1;
|
||||
|
||||
@@ -34,7 +34,8 @@ internal String8 e_string_from_expr(Arena *arena, E_Expr *expr, String8 parent_e
|
||||
////////////////////////////////
|
||||
//~ rjf: Parsing Functions
|
||||
|
||||
internal E_TypeKey e_leaf_type_from_name(String8 name);
|
||||
internal E_TypeKey e_leaf_builtin_type_key_from_name(String8 name);
|
||||
internal E_TypeKey e_leaf_type_key_from_name(String8 name);
|
||||
internal E_TypeKey e_type_key_from_expr(E_Expr *expr);
|
||||
internal E_Parse e_push_type_parse_from_text_tokens(Arena *arena, String8 text, E_TokenArray tokens);
|
||||
internal E_Parse e_push_parse_from_string_tokens__prec(Arena *arena, String8 text, E_TokenArray tokens, S64 max_precedence, U64 max_chain_count);
|
||||
|
||||
+24
-16
@@ -12420,24 +12420,27 @@ rd_frame(void)
|
||||
//
|
||||
RD_CfgList immediate_type_views = {0};
|
||||
CTRL_EntityArray modules = ctrl_entity_array_from_kind(&d_state->ctrl_entity_store->ctx, CTRL_EntityKind_Module);
|
||||
for EachIndex(idx, modules.count)
|
||||
ProfScope("gather config from loaded modules")
|
||||
{
|
||||
CTRL_Entity *module = modules.v[idx];
|
||||
String8 raddbg_data = ctrl_raddbg_data_from_module(scratch.arena, module->handle);
|
||||
U8 split_char = 0;
|
||||
String8List raddbg_data_text_parts = str8_split(scratch.arena, raddbg_data, &split_char, 1, 0);
|
||||
U64 cfg_idx = 0;
|
||||
for(String8Node *text_n = raddbg_data_text_parts.first; text_n != 0; text_n = text_n->next)
|
||||
for EachIndex(idx, modules.count)
|
||||
{
|
||||
String8 text = text_n->string;
|
||||
RD_CfgList cfgs = rd_cfg_tree_list_from_string(scratch.arena, str8_zero(), text);
|
||||
String8 module_name = ctrl_string_from_handle(scratch.arena, module->handle);
|
||||
for(RD_CfgNode *n = cfgs.first; n != 0; n = n->next, cfg_idx += 1)
|
||||
CTRL_Entity *module = modules.v[idx];
|
||||
String8 raddbg_data = ctrl_raddbg_data_from_module(scratch.arena, module->handle);
|
||||
U8 split_char = 0;
|
||||
String8List raddbg_data_text_parts = str8_split(scratch.arena, raddbg_data, &split_char, 1, 0);
|
||||
U64 cfg_idx = 0;
|
||||
for(String8Node *text_n = raddbg_data_text_parts.first; text_n != 0; text_n = text_n->next)
|
||||
{
|
||||
RD_Cfg *immediate_root = rd_immediate_cfg_from_keyf("module_%S_cfg_%I64x", module_name, cfg_idx);
|
||||
rd_cfg_release_all_children(immediate_root);
|
||||
rd_cfg_insert_child(immediate_root, immediate_root->last, n->v);
|
||||
rd_cfg_list_push(scratch.arena, &immediate_type_views, n->v);
|
||||
String8 text = text_n->string;
|
||||
RD_CfgList cfgs = rd_cfg_tree_list_from_string(scratch.arena, str8_zero(), text);
|
||||
String8 module_name = ctrl_string_from_handle(scratch.arena, module->handle);
|
||||
for(RD_CfgNode *n = cfgs.first; n != 0; n = n->next, cfg_idx += 1)
|
||||
{
|
||||
RD_Cfg *immediate_root = rd_immediate_cfg_from_keyf("module_%S_cfg_%I64x", module_name, cfg_idx);
|
||||
rd_cfg_release_all_children(immediate_root);
|
||||
rd_cfg_insert_child(immediate_root, immediate_root->last, n->v);
|
||||
rd_cfg_list_push(scratch.arena, &immediate_type_views, n->v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12445,6 +12448,7 @@ rd_frame(void)
|
||||
////////////////////////////
|
||||
//- rjf: construct default immediate-mode configs based on loaded modules
|
||||
//
|
||||
ProfScope("construct default immediate-mode configs based on loaded modules")
|
||||
{
|
||||
local_persist read_only struct
|
||||
{
|
||||
@@ -12571,7 +12575,7 @@ rd_frame(void)
|
||||
////////////////////////////
|
||||
//- rjf: process top-level graphical commands
|
||||
//
|
||||
if(rd_state->frame_depth == 1)
|
||||
if(rd_state->frame_depth == 1) ProfScope("process top-level graphical commands")
|
||||
{
|
||||
for(;rd_next_cmd(&cmd);) RD_RegsScope()
|
||||
{
|
||||
@@ -17113,6 +17117,10 @@ rd_frame(void)
|
||||
//////////////////////////////
|
||||
//- rjf: close frame scopes
|
||||
//
|
||||
// NOTE(rjf): this always must happen before the refresh, since that
|
||||
// will sleep for vsync, and we do not want to hold handles for long,
|
||||
// since eviction threads may be waiting to get rid of stuff.
|
||||
//
|
||||
di_scope_close(rd_state->frame_di_scope);
|
||||
ctrl_scope_close(rd_state->frame_ctrl_scope);
|
||||
rd_state->frame_di_scope = frame_di_scope_restore;
|
||||
|
||||
Reference in New Issue
Block a user