mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user