mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-18 18:12:23 -07:00
eliminate old eval viz code in engine
This commit is contained in:
@@ -4151,10 +4151,6 @@ d_init(void)
|
||||
d_state->member_caches[idx].arena = arena_alloc();
|
||||
}
|
||||
|
||||
// rjf: set up eval view cache
|
||||
d_state->eval_view_cache.slots_count = 4096;
|
||||
d_state->eval_view_cache.slots = push_array(arena, D_EvalViewSlot, d_state->eval_view_cache.slots_count);
|
||||
|
||||
// rjf: set up run state
|
||||
d_state->ctrl_last_run_arena = arena_alloc();
|
||||
}
|
||||
|
||||
@@ -478,218 +478,6 @@ struct D_RegsNode
|
||||
D_Regs v;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Visualization Types
|
||||
|
||||
//- rjf: expansion key -> view rule table
|
||||
|
||||
typedef struct D_EvalViewRuleCacheNode D_EvalViewRuleCacheNode;
|
||||
struct D_EvalViewRuleCacheNode
|
||||
{
|
||||
D_EvalViewRuleCacheNode *hash_next;
|
||||
D_EvalViewRuleCacheNode *hash_prev;
|
||||
D_ExpandKey key;
|
||||
U8 *buffer;
|
||||
U64 buffer_cap;
|
||||
U64 buffer_string_size;
|
||||
};
|
||||
|
||||
typedef struct D_EvalViewRuleCacheSlot D_EvalViewRuleCacheSlot;
|
||||
struct D_EvalViewRuleCacheSlot
|
||||
{
|
||||
D_EvalViewRuleCacheNode *first;
|
||||
D_EvalViewRuleCacheNode *last;
|
||||
};
|
||||
|
||||
typedef struct D_EvalViewRuleCacheTable D_EvalViewRuleCacheTable;
|
||||
struct D_EvalViewRuleCacheTable
|
||||
{
|
||||
U64 slot_count;
|
||||
D_EvalViewRuleCacheSlot *slots;
|
||||
};
|
||||
|
||||
//- rjf: 'eval view' entities for sparse-state expandable tree view cache for evaluation visualization
|
||||
|
||||
typedef struct D_EvalViewKey D_EvalViewKey;
|
||||
struct D_EvalViewKey
|
||||
{
|
||||
U64 u64[2];
|
||||
};
|
||||
|
||||
typedef struct D_EvalView D_EvalView;
|
||||
struct D_EvalView
|
||||
{
|
||||
// rjf: links
|
||||
D_EvalView *hash_next;
|
||||
D_EvalView *hash_prev;
|
||||
|
||||
// rjf: key
|
||||
D_EvalViewKey key;
|
||||
|
||||
// rjf: arena
|
||||
Arena *arena;
|
||||
|
||||
// rjf: expansion state
|
||||
D_ExpandTreeTable expand_tree_table;
|
||||
|
||||
// rjf: key -> view rule cache
|
||||
D_EvalViewRuleCacheTable view_rule_table;
|
||||
};
|
||||
|
||||
typedef struct D_EvalViewSlot D_EvalViewSlot;
|
||||
struct D_EvalViewSlot
|
||||
{
|
||||
D_EvalView *first;
|
||||
D_EvalView *last;
|
||||
};
|
||||
|
||||
typedef struct D_EvalViewCache D_EvalViewCache;
|
||||
struct D_EvalViewCache
|
||||
{
|
||||
D_EvalViewSlot *slots;
|
||||
U64 slots_count;
|
||||
};
|
||||
|
||||
//- rjf: eval view visualization building
|
||||
|
||||
typedef struct D_EvalLinkBase D_EvalLinkBase;
|
||||
struct D_EvalLinkBase
|
||||
{
|
||||
U64 offset;
|
||||
};
|
||||
|
||||
typedef struct D_EvalLinkBaseChunkNode D_EvalLinkBaseChunkNode;
|
||||
struct D_EvalLinkBaseChunkNode
|
||||
{
|
||||
D_EvalLinkBaseChunkNode *next;
|
||||
D_EvalLinkBase b[64];
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct D_EvalLinkBaseChunkList D_EvalLinkBaseChunkList;
|
||||
struct D_EvalLinkBaseChunkList
|
||||
{
|
||||
D_EvalLinkBaseChunkNode *first;
|
||||
D_EvalLinkBaseChunkNode *last;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct D_EvalLinkBaseArray D_EvalLinkBaseArray;
|
||||
struct D_EvalLinkBaseArray
|
||||
{
|
||||
D_EvalLinkBase *v;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef enum D_EvalVizBlockKind
|
||||
{
|
||||
D_EvalVizBlockKind_Null, // empty
|
||||
D_EvalVizBlockKind_Root, // root of tree or subtree; possibly-expandable expression.
|
||||
D_EvalVizBlockKind_Members, // members of struct, class, union
|
||||
D_EvalVizBlockKind_EnumMembers, // members of enum
|
||||
D_EvalVizBlockKind_Elements, // elements of array
|
||||
D_EvalVizBlockKind_Canvas, // escape hatch for arbitrary UI
|
||||
D_EvalVizBlockKind_DebugInfoTable, // block of filtered debug info table elements
|
||||
D_EvalVizBlockKind_COUNT,
|
||||
}
|
||||
D_EvalVizBlockKind;
|
||||
|
||||
typedef struct D_EvalVizBlock D_EvalVizBlock;
|
||||
struct D_EvalVizBlock
|
||||
{
|
||||
// rjf: kind & keys
|
||||
D_EvalVizBlockKind kind;
|
||||
D_ExpandKey parent_key;
|
||||
D_ExpandKey key;
|
||||
S32 depth;
|
||||
|
||||
// rjf: evaluation info
|
||||
String8 string;
|
||||
E_Expr *expr;
|
||||
|
||||
// rjf: info about ranges that this block spans
|
||||
Rng1U64 visual_idx_range;
|
||||
Rng1U64 semantic_idx_range;
|
||||
|
||||
// rjf: visualization config extensions
|
||||
D_CfgTable *cfg_table;
|
||||
D_EvalLinkBaseChunkList *link_bases;
|
||||
E_MemberArray members;
|
||||
E_EnumValArray enum_vals;
|
||||
RDI_SectionKind fzy_target;
|
||||
FZY_ItemArray fzy_backing_items;
|
||||
};
|
||||
|
||||
typedef struct D_EvalVizBlockNode D_EvalVizBlockNode;
|
||||
struct D_EvalVizBlockNode
|
||||
{
|
||||
D_EvalVizBlockNode *next;
|
||||
D_EvalVizBlock v;
|
||||
};
|
||||
|
||||
typedef struct D_EvalVizBlockList D_EvalVizBlockList;
|
||||
struct D_EvalVizBlockList
|
||||
{
|
||||
D_EvalVizBlockNode *first;
|
||||
D_EvalVizBlockNode *last;
|
||||
U64 count;
|
||||
U64 total_visual_row_count;
|
||||
U64 total_semantic_row_count;
|
||||
};
|
||||
|
||||
typedef struct D_EvalVizBlockArray D_EvalVizBlockArray;
|
||||
struct D_EvalVizBlockArray
|
||||
{
|
||||
D_EvalVizBlock *v;
|
||||
U64 count;
|
||||
U64 total_visual_row_count;
|
||||
U64 total_semantic_row_count;
|
||||
};
|
||||
|
||||
typedef U32 D_EvalVizStringFlags;
|
||||
enum
|
||||
{
|
||||
D_EvalVizStringFlag_ReadOnlyDisplayRules = (1<<0),
|
||||
};
|
||||
|
||||
typedef struct D_EvalVizRow D_EvalVizRow;
|
||||
struct D_EvalVizRow
|
||||
{
|
||||
D_EvalVizRow *next;
|
||||
|
||||
// rjf: block hierarchy info
|
||||
S32 depth;
|
||||
D_ExpandKey parent_key;
|
||||
D_ExpandKey key;
|
||||
|
||||
// rjf: row size/scroll info
|
||||
U64 size_in_rows;
|
||||
U64 skipped_size_in_rows;
|
||||
U64 chopped_size_in_rows;
|
||||
|
||||
// rjf: evaluation expression
|
||||
String8 string;
|
||||
E_Member *member;
|
||||
E_Expr *expr;
|
||||
|
||||
// rjf: view rule attachments
|
||||
D_CfgTable *cfg_table;
|
||||
struct DF_ViewRuleSpec *expand_ui_rule_spec;
|
||||
MD_Node *expand_ui_rule_params;
|
||||
struct DF_ViewRuleSpec *value_ui_rule_spec;
|
||||
MD_Node *value_ui_rule_params;
|
||||
};
|
||||
|
||||
typedef struct D_EvalVizWindowedRowList D_EvalVizWindowedRowList;
|
||||
struct D_EvalVizWindowedRowList
|
||||
{
|
||||
D_EvalVizRow *first;
|
||||
D_EvalVizRow *last;
|
||||
U64 count;
|
||||
U64 count_before_visual;
|
||||
U64 count_before_semantic;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Command Specification Types
|
||||
|
||||
@@ -958,9 +746,6 @@ struct D_State
|
||||
D_RunLocalsCache member_caches[2];
|
||||
U64 member_cache_gen;
|
||||
|
||||
// rjf: eval view cache
|
||||
D_EvalViewCache eval_view_cache;
|
||||
|
||||
// rjf: command specification table
|
||||
U64 total_registrar_count;
|
||||
U64 cmd_spec_table_size;
|
||||
@@ -1013,7 +798,6 @@ read_only global D_Entity d_nil_entity =
|
||||
&d_nil_entity,
|
||||
&d_nil_entity,
|
||||
};
|
||||
read_only global D_EvalView d_nil_eval_view = {&d_nil_eval_view, &d_nil_eval_view};
|
||||
|
||||
global D_State *d_state = 0;
|
||||
|
||||
|
||||
@@ -3978,7 +3978,7 @@ df_window_frame(DF_Window *ws)
|
||||
EV_Row *row = viz_rows.first;
|
||||
E_Eval row_eval = e_eval_from_expr(scratch.arena, row->expr);
|
||||
String8 row_expr_string = ev_expr_string_from_row(scratch.arena, row);
|
||||
String8 row_display_value = df_value_string_from_eval(scratch.arena, D_EvalVizStringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), 500.f, row_eval, row->member, row->view_rules);
|
||||
String8 row_display_value = df_value_string_from_eval(scratch.arena, EV_StringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), 500.f, row_eval, row->member, row->view_rules);
|
||||
expr_column_width_px = fnt_dim_from_tag_size_string(ui_top_font(), ui_top_font_size(), 0, 0, row_expr_string).x + ui_top_font_size()*5.f;
|
||||
value_column_width_px = fnt_dim_from_tag_size_string(ui_top_font(), ui_top_font_size(), 0, 0, row_display_value).x + ui_top_font_size()*5.f;
|
||||
F32 total_dim_px = (expr_column_width_px + value_column_width_px);
|
||||
@@ -4027,7 +4027,7 @@ df_window_frame(DF_Window *ws)
|
||||
E_Eval row_eval = e_eval_from_expr(scratch.arena, row->expr);
|
||||
String8 row_expr_string = ev_expr_string_from_row(scratch.arena, row);
|
||||
String8 row_edit_value = df_value_string_from_eval(scratch.arena, 0, default_radix, ui_top_font(), ui_top_font_size(), 500.f, row_eval, row->member, row->view_rules);
|
||||
String8 row_display_value = df_value_string_from_eval(scratch.arena, D_EvalVizStringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), 500.f, row_eval, row->member, row->view_rules);
|
||||
String8 row_display_value = df_value_string_from_eval(scratch.arena, EV_StringFlag_ReadOnlyDisplayRules, default_radix, ui_top_font(), ui_top_font_size(), 500.f, row_eval, row->member, row->view_rules);
|
||||
B32 row_is_editable = ev_row_is_editable(row);
|
||||
B32 row_is_expandable = ev_row_is_expandable(row);
|
||||
|
||||
@@ -6006,7 +6006,7 @@ df_ev_view_from_key(U64 key)
|
||||
}
|
||||
|
||||
internal F32
|
||||
df_append_value_strings_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, S32 depth, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules, String8List *out)
|
||||
df_append_value_strings_from_eval(Arena *arena, EV_StringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, S32 depth, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules, String8List *out)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
@@ -6126,7 +6126,7 @@ df_append_value_strings_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32
|
||||
if(!did_content && symbol_name.size == 0 &&
|
||||
((type_kind == E_TypeKind_Ptr && direct_type_kind == E_TypeKind_Function) ||
|
||||
(type_kind == E_TypeKind_Function)) &&
|
||||
(flags & D_EvalVizStringFlag_ReadOnlyDisplayRules))
|
||||
(flags & EV_StringFlag_ReadOnlyDisplayRules))
|
||||
{
|
||||
did_content = 1;
|
||||
String8 string = str8_lit("???");
|
||||
@@ -6135,7 +6135,7 @@ df_append_value_strings_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32
|
||||
}
|
||||
|
||||
// rjf: descend for all other cases
|
||||
if(!did_content && ptee_has_content && (flags & D_EvalVizStringFlag_ReadOnlyDisplayRules))
|
||||
if(!did_content && ptee_has_content && (flags & EV_StringFlag_ReadOnlyDisplayRules))
|
||||
{
|
||||
did_content = 1;
|
||||
if(depth < 4)
|
||||
@@ -6154,7 +6154,7 @@ df_append_value_strings_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32
|
||||
|
||||
// rjf: push pointer value
|
||||
B32 did_ptr_value = 0;
|
||||
if((!no_addr || !did_content) && ((flags & D_EvalVizStringFlag_ReadOnlyDisplayRules) || !did_string))
|
||||
if((!no_addr || !did_content) && ((flags & EV_StringFlag_ReadOnlyDisplayRules) || !did_string))
|
||||
{
|
||||
did_ptr_value = 1;
|
||||
if(did_content)
|
||||
@@ -6233,7 +6233,7 @@ df_append_value_strings_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32
|
||||
}
|
||||
|
||||
// rjf: descend in all other cases
|
||||
if(!did_content && (flags & D_EvalVizStringFlag_ReadOnlyDisplayRules))
|
||||
if(!did_content && (flags & EV_StringFlag_ReadOnlyDisplayRules))
|
||||
{
|
||||
did_content = 1;
|
||||
|
||||
@@ -6343,7 +6343,7 @@ df_append_value_strings_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32
|
||||
}
|
||||
|
||||
internal String8
|
||||
df_value_string_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules)
|
||||
df_value_string_from_eval(Arena *arena, EV_StringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List strs = {0};
|
||||
|
||||
@@ -954,8 +954,8 @@ internal void df_window_frame(DF_Window *ws);
|
||||
//~ rjf: Eval Visualization
|
||||
|
||||
internal EV_View *df_ev_view_from_key(U64 key);
|
||||
internal F32 df_append_value_strings_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, S32 depth, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules, String8List *out);
|
||||
internal String8 df_value_string_from_eval(Arena *arena, D_EvalVizStringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules);
|
||||
internal F32 df_append_value_strings_from_eval(Arena *arena, EV_StringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, S32 depth, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules, String8List *out);
|
||||
internal String8 df_value_string_from_eval(Arena *arena, EV_StringFlags flags, U32 default_radix, FNT_Tag font, F32 font_size, F32 max_size, E_Eval eval, E_Member *member, EV_ViewRuleList *view_rules);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Hover Eval
|
||||
|
||||
@@ -818,7 +818,7 @@ df_string_from_eval_viz_row_column(Arena *arena, EV_View *ev, EV_Row *row, DF_Wa
|
||||
case DF_WatchViewColumnKind_Value:
|
||||
{
|
||||
E_Eval eval = e_eval_from_expr(arena, row->expr);
|
||||
result = df_value_string_from_eval(arena, !editable * D_EvalVizStringFlag_ReadOnlyDisplayRules, default_radix, font, font_size, max_size_px, eval, row->member, row->view_rules);
|
||||
result = df_value_string_from_eval(arena, !editable * EV_StringFlag_ReadOnlyDisplayRules, default_radix, font, font_size, max_size_px, eval, row->member, row->view_rules);
|
||||
}break;
|
||||
case DF_WatchViewColumnKind_Type:
|
||||
{
|
||||
@@ -842,7 +842,7 @@ df_string_from_eval_viz_row_column(Arena *arena, EV_View *ev, EV_Row *row, DF_Wa
|
||||
{
|
||||
E_Expr *expr = e_expr_ref_member_access(arena, row->expr, str8(col->string_buffer, col->string_size));
|
||||
E_Eval eval = e_eval_from_expr(arena, expr);
|
||||
result = df_value_string_from_eval(arena, !editable * D_EvalVizStringFlag_ReadOnlyDisplayRules, default_radix, font, font_size, max_size_px, eval, row->member, row->view_rules);
|
||||
result = df_value_string_from_eval(arena, !editable * EV_StringFlag_ReadOnlyDisplayRules, default_radix, font, font_size, max_size_px, eval, row->member, row->view_rules);
|
||||
}break;
|
||||
}
|
||||
if(col->dequote_string &&
|
||||
|
||||
@@ -1658,7 +1658,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
if(!e_type_key_match(e_type_key_zero(), eval.type_key))
|
||||
{
|
||||
EV_ViewRuleList view_rules = {0};
|
||||
eval_string = df_value_string_from_eval(scratch.arena, D_EvalVizStringFlag_ReadOnlyDisplayRules, 10, params->font, params->font_size, params->font_size*60.f, eval, 0, &view_rules);
|
||||
eval_string = df_value_string_from_eval(scratch.arena, EV_StringFlag_ReadOnlyDisplayRules, 10, params->font, params->font_size, params->font_size*60.f, eval, 0, &view_rules);
|
||||
}
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
|
||||
Reference in New Issue
Block a user