mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-22 19:54:59 -07:00
eliminate old expand-key-based eval history - ctrl process memory cache offers much better comprehensive replacement. also eliminate per-row and per-block eval views, since we've collapsed all eval views to one per list-of-watch-trees
This commit is contained in:
@@ -4475,8 +4475,6 @@ df_eval_view_from_key(DF_EvalViewKey key)
|
||||
eval_view->key = key;
|
||||
eval_view->arena = arena_alloc();
|
||||
df_expand_tree_table_init(eval_view->arena, &eval_view->expand_tree_table, 256);
|
||||
eval_view->history_cache_table_size = 64;
|
||||
eval_view->history_cache_table = push_array(eval_view->arena, DF_EvalHistoryCacheSlot, eval_view->history_cache_table_size);
|
||||
eval_view->view_rule_table.slot_count = 64;
|
||||
eval_view->view_rule_table.slots = push_array(eval_view->arena, DF_EvalViewRuleCacheSlot, eval_view->view_rule_table.slot_count);
|
||||
}
|
||||
@@ -4484,83 +4482,6 @@ df_eval_view_from_key(DF_EvalViewKey key)
|
||||
return eval_view;
|
||||
}
|
||||
|
||||
//- rjf: key -> eval history
|
||||
|
||||
internal DF_EvalHistoryCacheNode *
|
||||
df_eval_history_cache_node_from_key(DF_EvalView *eval_view, DF_ExpandKey key)
|
||||
{
|
||||
//- rjf: key -> hash * slot idx * slot
|
||||
String8 key_string = str8_struct(&key);
|
||||
U64 hash = df_hash_from_string(key_string);
|
||||
U64 slot_idx = hash%eval_view->history_cache_table_size;
|
||||
DF_EvalHistoryCacheSlot *slot = &eval_view->history_cache_table[slot_idx];
|
||||
|
||||
//- rjf: slot idx -> existing node
|
||||
DF_EvalHistoryCacheNode *existing_node = 0;
|
||||
for(DF_EvalHistoryCacheNode *n = slot->first; n != 0; n = n->hash_next)
|
||||
{
|
||||
if(df_expand_key_match(n->key, key))
|
||||
{
|
||||
existing_node = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return existing_node;
|
||||
}
|
||||
|
||||
internal B32
|
||||
df_eval_view_record_history_val(DF_EvalView *eval_view, DF_ExpandKey key, DF_EvalHistoryVal val)
|
||||
{
|
||||
B32 change = 0;
|
||||
|
||||
//- rjf: key -> hash * slot idx * slot
|
||||
String8 key_string = str8_struct(&key);
|
||||
U64 hash = df_hash_from_string(key_string);
|
||||
U64 slot_idx = hash%eval_view->history_cache_table_size;
|
||||
DF_EvalHistoryCacheSlot *slot = &eval_view->history_cache_table[slot_idx];
|
||||
|
||||
//- rjf: slot idx -> existing node
|
||||
DF_EvalHistoryCacheNode *existing_node = 0;
|
||||
for(DF_EvalHistoryCacheNode *n = slot->first; n != 0; n = n->hash_next)
|
||||
{
|
||||
if(df_expand_key_match(n->key, key))
|
||||
{
|
||||
existing_node = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: grab existing node - if there is none, we need to allocate one
|
||||
DF_EvalHistoryCacheNode *node = existing_node;
|
||||
if(node == 0)
|
||||
{
|
||||
// TODO(rjf): check lru cache, allocate from there, prevent too much growth
|
||||
node = push_array(eval_view->arena, DF_EvalHistoryCacheNode, 1);
|
||||
DLLPushBack_NP(slot->first, slot->last, node, hash_next, hash_prev);
|
||||
node->key = key;
|
||||
node->first_run_idx = node->last_run_idx = df_ctrl_run_gen();
|
||||
}
|
||||
|
||||
//- rjf: record value
|
||||
if(node != 0)
|
||||
{
|
||||
DF_EvalHistoryVal *newest_val = &node->values[node->newest_val_idx];
|
||||
if(newest_val->mode != val.mode ||
|
||||
newest_val->imm_u128[0] != val.imm_u128[0] ||
|
||||
newest_val->imm_u128[1] != val.imm_u128[1] ||
|
||||
newest_val->offset != val.offset)
|
||||
{
|
||||
change = 1;
|
||||
node->newest_val_idx = (node->newest_val_idx + 1) % ArrayCount(node->values);
|
||||
node->values[node->newest_val_idx] = val;
|
||||
node->last_run_idx = df_ctrl_run_gen();
|
||||
}
|
||||
}
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
//- rjf: key -> view rules
|
||||
|
||||
internal void
|
||||
@@ -5108,7 +5029,6 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
|
||||
DF_EvalVizBlock *block = push_array(arena, DF_EvalVizBlock, 1);
|
||||
{
|
||||
block->kind = DF_EvalVizBlockKind_Root;
|
||||
block->eval_view = eval_view;
|
||||
block->eval = eval;
|
||||
block->cfg_table = *cfg_table;
|
||||
block->string = push_str8_copy(arena, string);
|
||||
@@ -5256,7 +5176,6 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
|
||||
DF_EvalVizBlock *memblock = push_array(arena, DF_EvalVizBlock, 1);
|
||||
{
|
||||
memblock->kind = DF_EvalVizBlockKind_Members;
|
||||
memblock->eval_view = eval_view;
|
||||
memblock->eval = udt_eval;
|
||||
memblock->cfg_table = *cfg_table;
|
||||
memblock->parent_key = key;
|
||||
@@ -5314,7 +5233,6 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
|
||||
{
|
||||
DF_EvalVizBlock *next_memblock = push_array(arena, DF_EvalVizBlock, 1);
|
||||
next_memblock->kind = DF_EvalVizBlockKind_Members;
|
||||
next_memblock->eval_view = eval_view;
|
||||
next_memblock->eval = udt_eval;
|
||||
next_memblock->cfg_table = *cfg_table;
|
||||
next_memblock->parent_key = key;
|
||||
@@ -5373,7 +5291,6 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
|
||||
DF_EvalVizBlock *linkblock = push_array(arena, DF_EvalVizBlock, 1);
|
||||
{
|
||||
linkblock->kind = DF_EvalVizBlockKind_Links;
|
||||
linkblock->eval_view = eval_view;
|
||||
linkblock->eval = udt_eval;
|
||||
linkblock->link_member_type_key = link_member->type_key;
|
||||
linkblock->link_member_off = link_member->off;
|
||||
@@ -5433,7 +5350,6 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
|
||||
{
|
||||
DF_EvalVizBlock *next_linkblock = push_array(arena, DF_EvalVizBlock, 1);
|
||||
next_linkblock->kind = DF_EvalVizBlockKind_Links;
|
||||
next_linkblock->eval_view = eval_view;
|
||||
next_linkblock->eval = udt_eval;
|
||||
next_linkblock->link_member_type_key = link_member->type_key;
|
||||
next_linkblock->link_member_off = link_member->off;
|
||||
@@ -5467,7 +5383,6 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
|
||||
DF_EvalVizBlock *elemblock = push_array(arena, DF_EvalVizBlock, 1);
|
||||
{
|
||||
elemblock->kind = DF_EvalVizBlockKind_Elements;
|
||||
elemblock->eval_view = eval_view;
|
||||
elemblock->eval = arr_eval;
|
||||
elemblock->cfg_table = *cfg_table;
|
||||
elemblock->parent_key = key;
|
||||
@@ -5522,7 +5437,6 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
|
||||
{
|
||||
DF_EvalVizBlock *next_elemblock = push_array(arena, DF_EvalVizBlock, 1);
|
||||
next_elemblock->kind = DF_EvalVizBlockKind_Elements;
|
||||
next_elemblock->eval_view = eval_view;
|
||||
next_elemblock->eval = arr_eval;
|
||||
next_elemblock->cfg_table = *cfg_table;
|
||||
next_elemblock->parent_key = key;
|
||||
|
||||
+1
-47
@@ -265,8 +265,6 @@ struct DF_Unwind
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Types
|
||||
|
||||
//- rjf: primary artifact from evaluation
|
||||
|
||||
typedef struct DF_Eval DF_Eval;
|
||||
struct DF_Eval
|
||||
{
|
||||
@@ -284,37 +282,6 @@ struct DF_Eval
|
||||
EVAL_ErrorList errors;
|
||||
};
|
||||
|
||||
//- rjf: value history types
|
||||
|
||||
typedef struct DF_EvalHistoryVal DF_EvalHistoryVal;
|
||||
struct DF_EvalHistoryVal
|
||||
{
|
||||
EVAL_EvalMode mode;
|
||||
U64 offset;
|
||||
U64 imm_u128[2];
|
||||
};
|
||||
|
||||
typedef struct DF_EvalHistoryCacheNode DF_EvalHistoryCacheNode;
|
||||
struct DF_EvalHistoryCacheNode
|
||||
{
|
||||
DF_EvalHistoryCacheNode *lru_next;
|
||||
DF_EvalHistoryCacheNode *lru_prev;
|
||||
DF_EvalHistoryCacheNode *hash_next;
|
||||
DF_EvalHistoryCacheNode *hash_prev;
|
||||
DF_ExpandKey key;
|
||||
U64 first_run_idx;
|
||||
U64 last_run_idx;
|
||||
U64 newest_val_idx;
|
||||
DF_EvalHistoryVal values[64];
|
||||
};
|
||||
|
||||
typedef struct DF_EvalHistoryCacheSlot DF_EvalHistoryCacheSlot;
|
||||
struct DF_EvalHistoryCacheSlot
|
||||
{
|
||||
DF_EvalHistoryCacheNode *first;
|
||||
DF_EvalHistoryCacheNode *last;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: View Rule Hook Types
|
||||
|
||||
@@ -674,13 +641,6 @@ struct DF_EvalView
|
||||
// rjf: expansion state
|
||||
DF_ExpandTreeTable expand_tree_table;
|
||||
|
||||
// rjf: key -> value history cache
|
||||
U64 history_cache_table_size;
|
||||
U64 history_cache_table_num_active_nodes;
|
||||
DF_EvalHistoryCacheSlot *history_cache_table;
|
||||
DF_EvalHistoryCacheNode *history_cache_lru_first;
|
||||
DF_EvalHistoryCacheNode *history_cache_lru_last;
|
||||
|
||||
// rjf: key -> view rule cache
|
||||
DF_EvalViewRuleCacheTable view_rule_table;
|
||||
};
|
||||
@@ -747,7 +707,6 @@ struct DF_EvalVizBlock
|
||||
{
|
||||
DF_EvalVizBlock *next;
|
||||
DF_EvalVizBlockKind kind;
|
||||
DF_EvalView *eval_view;
|
||||
DF_Eval eval;
|
||||
TG_Key link_member_type_key;
|
||||
U64 link_member_off;
|
||||
@@ -792,8 +751,7 @@ struct DF_EvalVizRow
|
||||
DF_EvalVizRow *next;
|
||||
DF_EvalVizRowFlags flags;
|
||||
|
||||
// rjf: eval & eval view state
|
||||
DF_EvalView *eval_view;
|
||||
// rjf: evaluation artifacts
|
||||
DF_Eval eval;
|
||||
|
||||
// rjf: basic visualization contents
|
||||
@@ -1574,10 +1532,6 @@ internal B32 df_eval_view_key_match(DF_EvalViewKey a, DF_EvalViewKey b);
|
||||
//- rjf: cache lookup
|
||||
internal DF_EvalView *df_eval_view_from_key(DF_EvalViewKey key);
|
||||
|
||||
//- rjf: key -> eval history
|
||||
internal DF_EvalHistoryCacheNode *df_eval_history_cache_node_from_key(DF_EvalView *eval_view, DF_ExpandKey key);
|
||||
internal B32 df_eval_view_record_history_val(DF_EvalView *eval_view, DF_ExpandKey key, DF_EvalHistoryVal val);
|
||||
|
||||
//- rjf: key -> view rules
|
||||
internal void df_eval_view_set_key_rule(DF_EvalView *eval_view, DF_ExpandKey key, String8 view_rule_string);
|
||||
internal String8 df_eval_view_rule_from_key(DF_EvalView *eval_view, DF_ExpandKey key);
|
||||
|
||||
Reference in New Issue
Block a user