diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index dec07293..764a8936 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -1366,14 +1366,16 @@ ctrl_entity_store_apply_events(CTRL_EntityCtxRWStore *store, CTRL_EventList *lis }break; case CTRL_EventKind_ModuleDebugInfoPathChange: { + Temp scratch = scratch_begin(0, 0); CTRL_Entity *module = ctrl_entity_from_handle(&store->ctx, event->entity); CTRL_Entity *debug_info_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath); if(debug_info_path == &ctrl_entity_nil) { debug_info_path = ctrl_entity_alloc(store, module, CTRL_EntityKind_DebugInfoPath, Arch_Null, ctrl_handle_zero(), 0); } - ctrl_entity_equip_string(store, debug_info_path, event->string); + ctrl_entity_equip_string(store, debug_info_path, path_normalized_from_string(scratch.arena, event->string)); debug_info_path->timestamp = event->timestamp; + scratch_end(scratch); }break; //- rjf: dynamic, program-created breakpoints @@ -3813,7 +3815,10 @@ ctrl_thread__entry_point(void *p) CTRL_Entity *debug_info_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath); DI_Key old_dbgi_key = {debug_info_path->string, debug_info_path->timestamp}; di_close(&old_dbgi_key); - OS_MutexScopeW(ctrl_state->ctrl_thread_entity_ctx_rw_mutex) ctrl_entity_equip_string(ctrl_state->ctrl_thread_entity_store, debug_info_path, path); + OS_MutexScopeW(ctrl_state->ctrl_thread_entity_ctx_rw_mutex) + { + ctrl_entity_equip_string(ctrl_state->ctrl_thread_entity_store, debug_info_path, path_normalized_from_string(scratch.arena, path)); + } U64 new_dbgi_timestamp = os_properties_from_file_path(path).modified; debug_info_path->timestamp = new_dbgi_timestamp; DI_Key new_dbgi_key = {debug_info_path->string, new_dbgi_timestamp}; diff --git a/src/dbgi/dbgi.c b/src/dbgi/dbgi.c index a08d9b87..2be972d8 100644 --- a/src/dbgi/dbgi.c +++ b/src/dbgi/dbgi.c @@ -462,25 +462,24 @@ di_open(DI_Key *key) Temp scratch = scratch_begin(0, 0); if(key->path.size != 0) { - DI_Key key_normalized = di_normalized_key_from_key(scratch.arena, key); - U64 hash = di_hash_from_key(&key_normalized); + U64 hash = di_hash_from_key(key); U64 slot_idx = hash%di_shared->slots_count; U64 stripe_idx = slot_idx%di_shared->stripes_count; DI_Slot *slot = &di_shared->slots[slot_idx]; DI_Stripe *stripe = &di_shared->stripes[stripe_idx]; - log_infof("open_debug_info: {\"%S\", 0x%I64x}\n", key_normalized.path, key_normalized.min_timestamp); + log_infof("open_debug_info: {\"%S\", 0x%I64x}\n", key->path, key->min_timestamp); OS_MutexScopeW(stripe->rw_mutex) { //- rjf: find existing node - DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key_normalized); + DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, key); //- rjf: allocate node if none exists; insert into slot if(node == 0) { - U64 current_timestamp = os_properties_from_file_path(key_normalized.path).modified; + U64 current_timestamp = os_properties_from_file_path(key->path).modified; if(current_timestamp == 0) { - current_timestamp = key_normalized.min_timestamp; + current_timestamp = key->min_timestamp; } node = stripe->free_node; if(node != 0) @@ -493,7 +492,7 @@ di_open(DI_Key *key) } MemoryZeroStruct(node); DLLPushBack(slot->first, slot->last, node); - String8 path_stored = di_string_alloc__stripe_mutex_w_guarded(stripe, key_normalized.path); + String8 path_stored = di_string_alloc__stripe_mutex_w_guarded(stripe, key->path); node->key.path = path_stored; node->key.min_timestamp = current_timestamp; } @@ -504,7 +503,7 @@ di_open(DI_Key *key) node->ref_count += 1; if(node->ref_count == 1) { - di_u2p_enqueue_key(&key_normalized, max_U64); + di_u2p_enqueue_key(key, max_U64); ins_atomic_u64_eval_assign(&node->is_working, 1); DeferLoop(os_rw_mutex_drop_w(stripe->rw_mutex), os_rw_mutex_take_w(stripe->rw_mutex)) { @@ -524,17 +523,16 @@ di_close(DI_Key *key) Temp scratch = scratch_begin(0, 0); if(key->path.size != 0) { - DI_Key key_normalized = di_normalized_key_from_key(scratch.arena, key); - U64 hash = di_hash_from_key(&key_normalized); + U64 hash = di_hash_from_key(key); U64 slot_idx = hash%di_shared->slots_count; U64 stripe_idx = slot_idx%di_shared->stripes_count; DI_Slot *slot = &di_shared->slots[slot_idx]; DI_Stripe *stripe = &di_shared->stripes[stripe_idx]; - log_infof("close_debug_info: {\"%S\", 0x%I64x}\n", key_normalized.path, key_normalized.min_timestamp); + log_infof("close_debug_info: {\"%S\", 0x%I64x}\n", key->path, key->min_timestamp); OS_MutexScopeW(stripe->rw_mutex) { //- rjf: find existing node - DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key_normalized); + DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, key); //- rjf: node exists -> decrement reference count; release if(node != 0) @@ -588,8 +586,7 @@ di_rdi_from_key(DI_Scope *scope, DI_Key *key, B32 high_priority, U64 endt_us) if(key->path.size != 0) { Temp scratch = scratch_begin(0, 0); - DI_Key key_normalized = di_normalized_key_from_key(scratch.arena, key); - U64 hash = di_hash_from_key(&key_normalized); + U64 hash = di_hash_from_key(key); U64 slot_idx = hash%di_shared->slots_count; U64 stripe_idx = slot_idx%di_shared->stripes_count; DI_Slot *slot = &di_shared->slots[slot_idx]; @@ -597,7 +594,7 @@ di_rdi_from_key(DI_Scope *scope, DI_Key *key, B32 high_priority, U64 endt_us) ProfScope("grab node") OS_MutexScopeR(stripe->rw_mutex) for(;;) { //- rjf: find existing node - DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key_normalized); + DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, key); //- rjf: no node? this path is not opened if(node == 0) @@ -623,7 +620,7 @@ di_rdi_from_key(DI_Scope *scope, DI_Key *key, B32 high_priority, U64 endt_us) if(node != 0 && !node->parse_done && !ins_atomic_u64_eval(&node->is_working) && - di_u2p_enqueue_key(&key_normalized, endt_us)) + di_u2p_enqueue_key(key, endt_us)) { ProfScope("ask for parse") { diff --git a/src/eval/eval_ir.c b/src/eval/eval_ir.c index 1dd8a8ee..fa740c8a 100644 --- a/src/eval/eval_ir.c +++ b/src/eval/eval_ir.c @@ -1617,7 +1617,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I { //- rjf: try to map identifier via this path E_IdentifierResolutionPath path = identifier_resolution_rule->paths[path_idx]; - switch(path) + ProfScope("identifier resolution %i", path) switch(path) { default:{}break; diff --git a/src/eval/eval_parse.c b/src/eval/eval_parse.c index 937ce6c5..a3b7cd29 100644 --- a/src/eval/eval_parse.c +++ b/src/eval/eval_parse.c @@ -528,6 +528,7 @@ e_string_from_expr(Arena *arena, E_Expr *expr, String8 parent_expr_string) internal E_TypeKey e_leaf_type_from_name(String8 name) { + ProfBeginFunction(); E_TypeKey key = zero_struct; B32 found = 0; if(!found) @@ -674,6 +675,7 @@ e_leaf_type_from_name(String8 name) } } } + ProfEnd(); return key; } diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 12b5f436..80f16d70 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -11787,6 +11787,7 @@ rd_frame(void) rd_state->meta_name2type_map[0] = e_string2typekey_map_make(rd_frame_arena(), 256); EV_ExpandRuleTable *expand_rule_table = push_array(scratch.arena, EV_ExpandRuleTable, 1); rd_state->view_ui_rule_map = rd_view_ui_rule_map_make(scratch.arena, 512); + ProfScope("build extra types & maps") { //- rjf: add macros for command groups {