From 544fea092994b8447adb8fba9781a86a8417e21b Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Wed, 1 Oct 2025 17:19:15 -0700 Subject: [PATCH] actually - keep (path * stamp -> key) and (key -> path * stamp) history - we do not need to evict these. also fix incorrect file map view closure on debug info close --- src/dbg_info/dbg_info2.c | 56 ++----------------------------- src/os/core/win32/os_core_win32.c | 5 +++ 2 files changed, 8 insertions(+), 53 deletions(-) diff --git a/src/dbg_info/dbg_info2.c b/src/dbg_info/dbg_info2.c index c3e25df9..e95d18dd 100644 --- a/src/dbg_info/dbg_info2.c +++ b/src/dbg_info/dbg_info2.c @@ -268,7 +268,7 @@ di2_open(DI2_Key key) DI2_Node *node = 0; for(DI2_Node *n = slot->first; n != 0; n = n->next) { - if(di2_key_match(n->key, key) && ins_atomic_u64_eval(&n->completion_count) > 0) + if(di2_key_match(n->key, key)) { node = n; break; @@ -353,6 +353,7 @@ di2_close(DI2_Key key) file = node->file; file_map = node->file_map; file_props = node->file_props; + file_base = node->file_base; arena = node->arena; break; } @@ -362,57 +363,6 @@ di2_close(DI2_Key key) } } - //- rjf: remove (path -> key) and (key -> path) records - if(node_released) - { - Temp scratch = scratch_begin(0, 0); - - // rjf: remove from key -> path cache; obtain path - String8 path = {0}; - { - U64 key2path_slot_idx = hash%di2_shared->key2path_slots_count; - DI2_KeySlot *key2path_slot = &di2_shared->key2path_slots[key2path_slot_idx]; - Stripe *key2path_stripe = stripe_from_slot_idx(&di2_shared->key2path_stripes, key2path_slot_idx); - RWMutexScope(key2path_stripe->rw_mutex, 1) - { - for(DI2_KeyPathNode *n = key2path_slot->first; n != 0; n = n->next) - { - if(di2_key_match(n->key, key)) - { - DLLRemove(key2path_slot->first, key2path_slot->last, n); - n->next = key2path_stripe->free; - key2path_stripe->free = n; - path = str8_copy(scratch.arena, n->path); - break; - } - } - } - } - - // rjf: remove from path -> key cache - { - U64 path_hash = u64_hash_from_str8(path); - U64 path2key_slot_idx = path_hash%di2_shared->path2key_slots_count; - DI2_KeySlot *path2key_slot = &di2_shared->path2key_slots[path2key_slot_idx]; - Stripe *path2key_stripe = stripe_from_slot_idx(&di2_shared->path2key_stripes, path2key_slot_idx); - RWMutexScope(path2key_stripe->rw_mutex, 1) - { - for(DI2_KeyPathNode *n = path2key_slot->first; n != 0; n = n->next) - { - if(str8_match(n->path, path, 0) && di2_key_match(n->key, key)) - { - DLLRemove(path2key_slot->first, path2key_slot->last, n); - n->next = path2key_stripe->free; - path2key_stripe->free = n; - break; - } - } - } - } - - scratch_end(scratch); - } - //- rjf: release node's resources if needed if(node_released) { @@ -624,7 +574,7 @@ di2_async_tick(void) { for(DI2_Node *n = slot->first; n != 0; n = n->next) { - if(di2_key_match(n->key, key)) + if(di2_key_match(n->key, key) && ins_atomic_u64_eval(&n->completion_count) == 0) { request_is_duplicate = (ins_atomic_u64_eval_cond_assign(&n->working_count, 1, 0) != 0); break; diff --git a/src/os/core/win32/os_core_win32.c b/src/os/core/win32/os_core_win32.c index a2e8cd9f..13602237 100644 --- a/src/os/core/win32/os_core_win32.c +++ b/src/os/core/win32/os_core_win32.c @@ -336,6 +336,11 @@ os_file_open(OS_AccessFlags flags, String8 path) { result.u64[0] = (U64)file; } + else + { + DWORD err = GetLastError(); + (void)err; + } scratch_end(scratch); return result; }