sketch out new unwind cache types

This commit is contained in:
Ryan Fleury
2024-03-21 13:53:12 -07:00
parent 1466b27385
commit 2c9ff37b2c
4 changed files with 35 additions and 15 deletions
+6 -12
View File
@@ -43,12 +43,6 @@ ctrl_event_cause_from_dmn_event_kind(DMN_EventKind event_kind)
return cause;
}
internal B32
ctrl_handle_match(DMN_Handle a, DMN_Handle b)
{
return MemoryMatchStruct(&a, &b);
}
////////////////////////////////
//~ rjf: Machine/Handle Pair Type Functions
@@ -923,7 +917,7 @@ ctrl_stored_hash_from_process_vaddr_range(CTRL_MachineID machine_id, DMN_Handle
{
for(CTRL_ProcessMemoryCacheNode *n = process_slot->first; n != 0; n = n->next)
{
if(n->machine_id == machine_id && ctrl_handle_match(n->process, process))
if(n->machine_id == machine_id && dmn_handle_match(n->process, process))
{
U64 range_slot_idx = range_hash%n->range_hash_slots_count;
CTRL_ProcessMemoryRangeHashSlot *range_slot = &n->range_hash_slots[range_slot_idx];
@@ -950,7 +944,7 @@ ctrl_stored_hash_from_process_vaddr_range(CTRL_MachineID machine_id, DMN_Handle
B32 process_node_exists = 0;
for(CTRL_ProcessMemoryCacheNode *n = process_slot->first; n != 0; n = n->next)
{
if(n->machine_id == machine_id && ctrl_handle_match(n->process, process))
if(n->machine_id == machine_id && dmn_handle_match(n->process, process))
{
process_node_exists = 1;
break;
@@ -978,7 +972,7 @@ ctrl_stored_hash_from_process_vaddr_range(CTRL_MachineID machine_id, DMN_Handle
{
for(CTRL_ProcessMemoryCacheNode *n = process_slot->first; n != 0; n = n->next)
{
if(n->machine_id == machine_id && ctrl_handle_match(n->process, process))
if(n->machine_id == machine_id && dmn_handle_match(n->process, process))
{
U64 range_slot_idx = range_hash%n->range_hash_slots_count;
CTRL_ProcessMemoryRangeHashSlot *range_slot = &n->range_hash_slots[range_slot_idx];
@@ -1018,7 +1012,7 @@ ctrl_stored_hash_from_process_vaddr_range(CTRL_MachineID machine_id, DMN_Handle
{
for(CTRL_ProcessMemoryCacheNode *n = process_slot->first; n != 0; n = n->next)
{
if(n->machine_id == machine_id && ctrl_handle_match(n->process, process))
if(n->machine_id == machine_id && dmn_handle_match(n->process, process))
{
U64 range_slot_idx = range_hash%n->range_hash_slots_count;
CTRL_ProcessMemoryRangeHashSlot *range_slot = &n->range_hash_slots[range_slot_idx];
@@ -3662,7 +3656,7 @@ ctrl_mem_stream_thread__entry_point(void *p)
{
for(CTRL_ProcessMemoryCacheNode *n = process_slot->first; n != 0; n = n->next)
{
if(n->machine_id == machine_id && ctrl_handle_match(n->process, process))
if(n->machine_id == machine_id && dmn_handle_match(n->process, process))
{
U64 range_slot_idx = range_hash%n->range_hash_slots_count;
CTRL_ProcessMemoryRangeHashSlot *range_slot = &n->range_hash_slots[range_slot_idx];
@@ -3739,7 +3733,7 @@ ctrl_mem_stream_thread__entry_point(void *p)
{
for(CTRL_ProcessMemoryCacheNode *n = process_slot->first; n != 0; n = n->next)
{
if(n->machine_id == machine_id && ctrl_handle_match(n->process, process))
if(n->machine_id == machine_id && dmn_handle_match(n->process, process))
{
U64 range_slot_idx = range_hash%n->range_hash_slots_count;
CTRL_ProcessMemoryRangeHashSlot *range_slot = &n->range_hash_slots[range_slot_idx];
+28 -1
View File
@@ -471,6 +471,34 @@ struct CTRL_ThreadRegCache
CTRL_ThreadRegCacheStripe *stripes;
};
////////////////////////////////
//~ rjf: Unwind Cache Types
typedef struct CTRL_UnwindCacheNode CTRL_UnwindCacheNode;
struct CTRL_UnwindCacheNode
{
CTRL_UnwindCacheNode *next;
CTRL_UnwindCacheNode *prev;
// rjf: key
CTRL_MachineID machine_id;
DMN_Handle thread;
U64 run_gen;
U64 mem_gen;
U64 reg_gen;
// rjf: artifacts
CTRL_Unwind unwind;
U64 tls_base_vaddr;
};
typedef struct CTRL_UnwindCacheSlot CTRL_UnwindCacheSlot;
struct CTRL_UnwindCacheSlot
{
CTRL_UnwindCacheNode *first;
CTRL_UnwindCacheNode *last;
};
////////////////////////////////
//~ rjf: Wakeup Hook Function Types
@@ -554,7 +582,6 @@ read_only global CTRL_Entity ctrl_entity_nil =
internal U64 ctrl_hash_from_string(String8 string);
internal U64 ctrl_hash_from_machine_id_handle(CTRL_MachineID machine_id, DMN_Handle handle);
internal CTRL_EventCause ctrl_event_cause_from_dmn_event_kind(DMN_EventKind event_kind);
internal B32 ctrl_handle_match(DMN_Handle a, DMN_Handle b);
////////////////////////////////
//~ rjf: Machine/Handle Pair Type Functions
+1 -1
View File
@@ -195,7 +195,7 @@ dasm_handle_from_ctrl_process_range_arch(CTRL_MachineID machine, DMN_Handle proc
for(DASM_Entity *e = slot->first; e != 0; e = e->next)
{
if(e->machine_id == machine &&
ctrl_handle_match(e->process, process) &&
dmn_handle_match(e->process, process) &&
MemoryMatchStruct(&e->vaddr_range, &vaddr_range) &&
e->arch == arch)
{
-1
View File
@@ -6931,7 +6931,6 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
if(cache_node->unwind.error != 0)
{
good = 0;
break;
}
}
if(good)