Skip to content

Commit 5b82fc2

Browse files
committed
eliminate member-filtering hack for cfg views; eliminate deref-space-ptr hack
1 parent 68966ba commit 5b82fc2

File tree

6 files changed

+5
-111
lines changed

6 files changed

+5
-111
lines changed

src/eval/eval_interpret.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ e_interpret(String8 bytecode)
7575
else switch(op)
7676
{
7777
case E_IRExtKind_SetSpace: {ctrlbits = RDI_EVAL_CTRLBITS(32, 0, 0);}break;
78-
case E_IRExtKind_DerefSpacePtr:{ctrlbits = RDI_EVAL_CTRLBITS(0, 1, 1);}break;
7978
default:
8079
{
8180
result.code = E_InterpretationCode_BadOp;
@@ -125,27 +124,6 @@ e_interpret(String8 bytecode)
125124
MemoryCopy(&selected_space, &imm, sizeof(selected_space));
126125
}break;
127126

128-
case E_IRExtKind_DerefSpacePtr:
129-
{
130-
U64 addr = svals[0].u64;
131-
U64 size = sizeof(E_Space) + sizeof(U64);
132-
typedef struct SpacePtrRead SpacePtrRead;
133-
struct SpacePtrRead
134-
{
135-
E_Space space;
136-
U64 off;
137-
};
138-
SpacePtrRead space_ptr_read = {0};
139-
B32 good_read = e_space_read(selected_space, &space_ptr_read, r1u64(addr, addr+size));
140-
if(!good_read)
141-
{
142-
result.code = E_InterpretationCode_BadMemRead;
143-
goto done;
144-
}
145-
MemoryCopyStruct(&selected_space, &space_ptr_read.space);
146-
nval.u64 = space_ptr_read.off;
147-
}break;
148-
149127
case RDI_EvalOp_Stop:
150128
{
151129
goto done;

src/eval/eval_ir.c

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -464,16 +464,6 @@ e_oplist_push_set_space(Arena *arena, E_OpList *list, E_Space space)
464464
list->encoded_size += 1 + sizeof(space);
465465
}
466466

467-
internal void
468-
e_oplist_push_deref_space_ptr(Arena *arena, E_OpList *list)
469-
{
470-
E_Op *node = push_array_no_zero(arena, E_Op, 1);
471-
node->opcode = E_IRExtKind_DerefSpacePtr;
472-
SLLQueuePush(list->first, list->last, node);
473-
list->op_count += 1;
474-
list->encoded_size += 1;
475-
}
476-
477467
internal void
478468
e_oplist_push_string_literal(Arena *arena, E_OpList *list, String8 string)
479469
{
@@ -602,14 +592,6 @@ e_irtree_set_space(Arena *arena, E_Space space, E_IRNode *c)
602592
return root;
603593
}
604594

605-
internal E_IRNode *
606-
e_irtree_deref_space_ptr(Arena *arena, E_IRNode *c)
607-
{
608-
E_IRNode *root = e_push_irnode(arena, E_IRExtKind_DerefSpacePtr);
609-
e_irnode_push_child(root, c);
610-
return root;
611-
}
612-
613595
internal E_IRNode *
614596
e_irtree_mem_read_type(Arena *arena, E_IRNode *c, E_TypeKey type_key)
615597
{
@@ -1484,14 +1466,6 @@ e_irtree_and_type_from_expr__space(Arena *arena, E_Space *current_space, E_Expr
14841466
}break;
14851467
}
14861468

1487-
//- rjf: evaluating a space pointer -> generate a dynamic set-space & resolve to the offset
1488-
if(e_type_kind_from_key(result.type_key) == E_TypeKind_SpacePtr)
1489-
{
1490-
result.root = e_irtree_deref_space_ptr(arena, result.root);
1491-
result.type_key = e_type_direct_from_key(result.type_key);
1492-
result.mode = E_Mode_Offset;
1493-
}
1494-
14951469
//- rjf: if the expression's space does not match the current, then push a set-space node
14961470
// before returning
14971471
E_Space zero_space = zero_struct;
@@ -1545,17 +1519,6 @@ e_append_oplist_from_irtree(Arena *arena, E_IRNode *root, E_OpList *out)
15451519
}
15461520
}break;
15471521

1548-
case E_IRExtKind_DerefSpacePtr:
1549-
{
1550-
for(E_IRNode *child = root->first;
1551-
child != &e_irnode_nil;
1552-
child = child->next)
1553-
{
1554-
e_append_oplist_from_irtree(arena, child, out);
1555-
}
1556-
e_oplist_push_deref_space_ptr(arena, out);
1557-
}break;
1558-
15591522
case RDI_EvalOp_Cond:
15601523
{
15611524
// rjf: generate oplists for each child
@@ -1697,12 +1660,6 @@ e_bytecode_from_oplist(Arena *arena, E_OpList *oplist)
16971660
// rjf: advance
16981661
ptr = next_ptr;
16991662
}break;
1700-
1701-
case E_IRExtKind_DerefSpacePtr:
1702-
{
1703-
ptr[0] = opcode;
1704-
ptr += 1;
1705-
}break;
17061663
}
17071664
}
17081665

src/eval/eval_ir.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ enum
1111
{
1212
E_IRExtKind_Bytecode = RDI_EvalOp_COUNT,
1313
E_IRExtKind_SetSpace,
14-
E_IRExtKind_DerefSpacePtr,
1514
E_IRExtKind_COUNT
1615
};
1716

@@ -169,7 +168,6 @@ internal void e_oplist_push_uconst(Arena *arena, E_OpList *list, U64 x);
169168
internal void e_oplist_push_sconst(Arena *arena, E_OpList *list, S64 x);
170169
internal void e_oplist_push_bytecode(Arena *arena, E_OpList *list, String8 bytecode);
171170
internal void e_oplist_push_set_space(Arena *arena, E_OpList *list, E_Space space);
172-
internal void e_oplist_push_deref_space_ptr(Arena *arena, E_OpList *list);
173171
internal void e_oplist_push_string_literal(Arena *arena, E_OpList *list, String8 string);
174172
internal void e_oplist_concat_in_place(E_OpList *dst, E_OpList *to_push);
175173

@@ -186,7 +184,6 @@ internal E_IRNode *e_irtree_conditional(Arena *arena, E_IRNode *c, E_IRNode *l,
186184
internal E_IRNode *e_irtree_bytecode_no_copy(Arena *arena, String8 bytecode);
187185
internal E_IRNode *e_irtree_string_literal(Arena *arena, String8 string);
188186
internal E_IRNode *e_irtree_set_space(Arena *arena, E_Space space, E_IRNode *c);
189-
internal E_IRNode *e_irtree_deref_space_ptr(Arena *arena, E_IRNode *c);
190187
internal E_IRNode *e_irtree_mem_read_type(Arena *arena, E_IRNode *c, E_TypeKey type_key);
191188
internal E_IRNode *e_irtree_convert_lo(Arena *arena, E_IRNode *c, RDI_EvalTypeGroup out, RDI_EvalTypeGroup in);
192189
internal E_IRNode *e_irtree_trunc(Arena *arena, E_IRNode *c, E_TypeKey type_key);

src/raddbg/raddbg_core.c

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,38 +2846,6 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
28462846
}
28472847
}
28482848
}break;
2849-
2850-
//- rjf: meta collections
2851-
case RD_EvalSpaceKind_MetaCollection:
2852-
{
2853-
typedef struct SpacePtr SpacePtr;
2854-
struct SpacePtr
2855-
{
2856-
E_Space space;
2857-
U64 off;
2858-
};
2859-
RD_CfgArray cfgs_array = {0};
2860-
if(space.u64s[0] < rd_state->eval_collection_cfg_names->count)
2861-
{
2862-
cfgs_array = rd_state->eval_collection_cfgs[space.u64s[0]];
2863-
}
2864-
U64 space_ptr_size = sizeof(SpacePtr);
2865-
Rng1U64 idx_range = r1u64(range.min/space_ptr_size, range.max/space_ptr_size);
2866-
U64 out_off = 0;
2867-
U64 out_opl = dim_1u64(range);
2868-
for(U64 src_idx = idx_range.min; src_idx < idx_range.max && out_off+space_ptr_size <= out_opl; src_idx += 1)
2869-
{
2870-
RD_Cfg *cfg = &rd_nil_cfg;
2871-
if(src_idx < cfgs_array.count)
2872-
{
2873-
cfg = cfgs_array.v[src_idx];
2874-
}
2875-
SpacePtr space_ptr = {rd_eval_space_from_cfg(cfg), 0};
2876-
MemoryCopy((U8 *)out + out_off, &space_ptr, space_ptr_size);
2877-
out_off += sizeof(space_ptr);
2878-
}
2879-
result = 1;
2880-
}break;
28812849
}
28822850
scratch_end(scratch);
28832851
return result;
@@ -13197,7 +13165,6 @@ rd_frame(void)
1319713165
for EachElement(idx, rd_collection_name_table)
1319813166
{
1319913167
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
13200-
expr->space = e_space_make(RD_EvalSpaceKind_MetaCollection);
1320113168
expr->mode = E_Mode_Null;
1320213169
expr->type_key = collection_type_keys[idx];
1320313170
e_string2expr_map_insert(scratch.arena, ctx->macro_map, rd_collection_name_table[idx], expr);
@@ -13393,17 +13360,13 @@ rd_frame(void)
1339313360
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name, E_LOOKUP_INFO_FUNCTION_NAME(watch_group), E_LOOKUP_FUNCTION_NAME(watch_group));
1339413361
}
1339513362

13396-
//- rjf: add macros for collections (new @cfg)
13363+
//- rjf: add macros for all cfg collections (new @cfg)
1339713364
for EachElement(cfg_name_idx, evallable_cfg_names)
1339813365
{
1339913366
String8 cfg_name = evallable_cfg_names[cfg_name_idx];
1340013367
String8 collection_name = rd_plural_from_code_name(cfg_name);
1340113368
E_TypeKey collection_type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name);
1340213369
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
13403-
E_Space space = e_space_make(RD_EvalSpaceKind_MetaCollection);
13404-
space.u64s[0] = cfg_name_idx;
13405-
expr->space = space;
13406-
expr->mode = E_Mode_Offset;
1340713370
expr->type_key = collection_type_key;
1340813371
e_string2expr_map_insert(scratch.arena, ctx->macro_map, collection_name, expr);
1340913372
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name, E_LOOKUP_INFO_FUNCTION_NAME(top_level_cfg), E_LOOKUP_FUNCTION_NAME(top_level_cfg));

src/raddbg/raddbg_core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ enum
9797
RD_EvalSpaceKind_MetaCfg,
9898
RD_EvalSpaceKind_MetaEntity,
9999
RD_EvalSpaceKind_MetaCtrlEntity,
100-
RD_EvalSpaceKind_MetaCollection,
101100
};
102101

103102
////////////////////////////////

src/raddbg/raddbg_views.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4142,7 +4142,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(file_path_map)
41424142
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
41434143
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1, .is_non_code = 0);
41444144
}
4145-
rd_watch_view_build(wv, str8_lit("collection:file_path_maps"), str8_lit("only: source_path destination_path str"), 1, 10, rect);
4145+
rd_watch_view_build(wv, str8_lit("collection:file_path_maps"), str8_zero(), 1, 10, rect);
41464146
ProfEnd();
41474147
}
41484148

@@ -4159,7 +4159,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(auto_view_rules)
41594159
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
41604160
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1, .is_non_code = 0);
41614161
}
4162-
rd_watch_view_build(wv, str8_lit("collection:auto_view_rules"), str8_lit("only: type view_rule str"), 1, 10, rect);
4162+
rd_watch_view_build(wv, str8_lit("collection:auto_view_rules"), str8_zero(), 1, 10, rect);
41634163
ProfEnd();
41644164
}
41654165

@@ -4176,7 +4176,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(breakpoints)
41764176
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
41774177
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1);
41784178
}
4179-
rd_watch_view_build(wv, str8_lit("collection:breakpoints"), str8_lit("only: label condition str hit_count source_location address_location function_location"), 0, 10, rect);
4179+
rd_watch_view_build(wv, str8_lit("collection:breakpoints"), str8_zero(), 0, 10, rect);
41804180
ProfEnd();
41814181
}
41824182

@@ -4193,7 +4193,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(watch_pins)
41934193
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Expr, 0.25f);
41944194
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1);
41954195
}
4196-
rd_watch_view_build(wv, str8_lit("collection:watch_pins"), str8_lit("only: label source_location address_location str"), 0, 10, rect);
4196+
rd_watch_view_build(wv, str8_lit("collection:watch_pins"), str8_zero(), 0, 10, rect);
41974197
ProfEnd();
41984198
}
41994199

0 commit comments

Comments
 (0)