mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-14 12:59:41 -07:00
major clean-up pass over unwinding/module-info abstraction, + usage in the debug engine. simplified / cleaned up DWARF helpers for unwind info & expressions. decoupling unwinding / DWARF evaluation from memory read callbacks. light module info now prepared by demon layer - debug engine no longer duplicates per-backend parsing. unwind abstraction layer now does thin abstraction over unwinding backends, debug engine only calls abstraction. clean up demon to have fewer ad-hoc 'queries' on handles, and prefer sending info over debug events when possible / when it fits the usage pattern. move DWARF enum specifications to metacode, generate enums/xlists/tables/etc. decouple raddbg/radbin completely from old parsing helpers. replace portion of DWARF dumping; pull out some new parsing helpers from converter / dumper.
This commit is contained in:
1 parent
541d3afefa
commit
d73ce364b9
88 files changed
+9899
-4723
No files matched your search
@@ -58,6 +58,7 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
|
||||
cache->slots_count = Max(256, params->slots_count);
|
||||
cache->slots = push_array(cache_stripe->arena, AC_Slot, cache->slots_count);
|
||||
cache->stripes = stripe_array_alloc(cache_stripe->arena);
|
||||
cache->stripe_free_node_ptrs = push_array(cache_stripe->arena, AC_NodePtr *, cache->stripes.count);
|
||||
}
|
||||
}
|
||||
if(cache != 0)
|
||||
@@ -73,6 +74,9 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
|
||||
AC_Slot *slot = &cache->slots[slot_idx];
|
||||
Stripe *stripe = stripe_from_slot_idx(&cache->stripes, slot_idx);
|
||||
|
||||
//- rjf: unpack thread context
|
||||
B32 is_node_work_active = (ac_tctx != 0);
|
||||
|
||||
//- rjf: cache * key -> existing artifact
|
||||
B32 artifact_is_stale = 1;
|
||||
B32 got_artifact = 0;
|
||||
@@ -92,11 +96,16 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
|
||||
artifact_is_stale = is_stale;
|
||||
artifact = n->val;
|
||||
access_touch(access, &n->access_pt, stripe->cv);
|
||||
ins_atomic_u64_eval_assign(&n->last_touched_ac_request_gen, ins_atomic_u64_eval(&ac_shared->request_gen));
|
||||
}
|
||||
if(is_stale)
|
||||
{
|
||||
B32 got_task = (ins_atomic_u64_eval_cond_assign(&n->working_count, 1, 0) == 0);
|
||||
need_request = got_task;
|
||||
if(is_node_work_active)
|
||||
{
|
||||
ins_atomic_u32_eval_assign(&n->other_nodes_depend_on_me, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -140,6 +149,10 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
|
||||
node->key = str8_copy(stripe->arena, key);
|
||||
node->working_count = 1;
|
||||
node->evict_threshold_us = params->evict_threshold_us;
|
||||
if(is_node_work_active)
|
||||
{
|
||||
node->other_nodes_depend_on_me = 1;
|
||||
}
|
||||
}
|
||||
node->access_pt.last_time_touched_us = now_time_us();
|
||||
node->access_pt.last_update_idx_touched = update_tick_idx();
|
||||
@@ -181,6 +194,7 @@ ac_artifact_from_key_(Access *access, String8 key, AC_ArtifactParams *params, U6
|
||||
artifact_is_stale = (node->last_completed_gen == params->gen);
|
||||
artifact = node->val;
|
||||
access_touch(access, &node->access_pt, stripe->cv);
|
||||
ins_atomic_u64_eval_assign(&node->last_touched_ac_request_gen, ins_atomic_u64_eval(&ac_shared->request_gen));
|
||||
}
|
||||
|
||||
// rjf: abort if needed
|
||||
@@ -243,7 +257,9 @@ ac_async_tick(void)
|
||||
for(AC_Node *n = slot->first, *next = 0; n != 0; n = next)
|
||||
{
|
||||
next = n->next;
|
||||
if(access_pt_is_expired(&n->access_pt, .time = n->evict_threshold_us) && ins_atomic_u64_eval(&n->working_count) == 0)
|
||||
if(access_pt_is_expired(&n->access_pt, .time = n->evict_threshold_us) &&
|
||||
ins_atomic_u64_eval(&n->working_count) == 0 &&
|
||||
(ins_atomic_u32_eval(&n->other_nodes_depend_on_me) == 0 || ac_shared->request_gen > n->last_touched_ac_request_gen))
|
||||
{
|
||||
slot_has_work = 1;
|
||||
if(!write_mode)
|
||||
@@ -327,6 +343,11 @@ ac_async_tick(void)
|
||||
lane_sync_u64(&tasks_count, 0);
|
||||
lane_sync();
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: set up artifact cache thread context
|
||||
//
|
||||
ac_tctx = push_array(scratch.arena, AC_TCTX, 1);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: do all requests
|
||||
//
|
||||
@@ -610,6 +631,30 @@ ac_async_tick(void)
|
||||
}
|
||||
lane_sync();
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: increment the request gen, only if all requests are empty
|
||||
//
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
B32 have_live_requests = 0;
|
||||
for EachElement(idx, ac_shared->req_batches)
|
||||
{
|
||||
MutexScope(ac_shared->req_batches[idx].mutex)
|
||||
{
|
||||
have_live_requests = (ac_shared->req_batches[idx].wide_count != 0 || ac_shared->req_batches[idx].thin_count != 0);
|
||||
}
|
||||
}
|
||||
if(!have_live_requests)
|
||||
{
|
||||
ac_shared->request_gen += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: reset thread context
|
||||
//
|
||||
ac_tctx = 0;
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: disable cancellation scanning
|
||||
//
|
||||
|
||||
@@ -59,6 +59,13 @@ struct AC_RequestNode
|
||||
AC_Request v;
|
||||
};
|
||||
|
||||
typedef struct AC_NodePtr AC_NodePtr;
|
||||
struct AC_NodePtr
|
||||
{
|
||||
AC_NodePtr *next;
|
||||
struct AC_Node *node;
|
||||
};
|
||||
|
||||
typedef struct AC_Node AC_Node;
|
||||
struct AC_Node
|
||||
{
|
||||
@@ -76,8 +83,9 @@ struct AC_Node
|
||||
U64 working_count;
|
||||
U64 completion_count;
|
||||
U64 evict_threshold_us;
|
||||
U64 last_touched_ac_request_gen;
|
||||
B32 cancelled;
|
||||
U64 _unused_;
|
||||
B32 other_nodes_depend_on_me;
|
||||
};
|
||||
|
||||
typedef struct AC_Slot AC_Slot;
|
||||
@@ -99,6 +107,7 @@ struct AC_Cache
|
||||
U64 slots_count;
|
||||
AC_Slot *slots;
|
||||
StripeArray stripes;
|
||||
AC_NodePtr **stripe_free_node_ptrs;
|
||||
};
|
||||
|
||||
typedef struct AC_RequestBatch AC_RequestBatch;
|
||||
@@ -114,10 +123,17 @@ struct AC_RequestBatch
|
||||
U64 thin_count;
|
||||
};
|
||||
|
||||
typedef struct AC_TCTX AC_TCTX;
|
||||
struct AC_TCTX
|
||||
{
|
||||
U64 _unused_;
|
||||
};
|
||||
|
||||
typedef struct AC_Shared AC_Shared;
|
||||
struct AC_Shared
|
||||
{
|
||||
Arena *arena;
|
||||
U64 request_gen;
|
||||
|
||||
// rjf: cache cache
|
||||
U64 cache_slots_count;
|
||||
@@ -136,6 +152,7 @@ struct AC_Shared
|
||||
//~ rjf: Globals
|
||||
|
||||
global AC_Shared *ac_shared = 0;
|
||||
thread_static AC_TCTX *ac_tctx = 0;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Layer Initialization
|
||||
|
||||
Reference in new issue
Block a user