mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-07 14:28:40 +00:00
parameterize irtree generation path with identifier resolution rules; in most cases, we want the usual order: implicit accesses -> locals -> registers -> globals/tlocals/types/procedures -> macros; but if we are specifically evaluating a call expression tree, we want to prefer callables - in this case, macros should be prioritized.
This commit is contained in:
+3
-6
@@ -46,7 +46,7 @@ load_paths =
|
||||
commands =
|
||||
{
|
||||
//- rjf: [raddbg]
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
//- rjf: [textperf]
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta telemetry textperf && raddbg_stable --ipc bring_to_front && raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
@@ -54,13 +54,10 @@ commands =
|
||||
//- rjf: [tester]
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta tester", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
//- rjf: [ryan_scratch]
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
//- rjf: running target
|
||||
// .f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
// .f3 = { .win = "C:/devel/raddebugger/build/raddbg.exe --capture --user:C:/devel/raddebugger/build/local_dev.raddbg_user --project:C:/devel/raddebugger/build/local_dev.raddbg_project", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f3 = { .win = "wsl_launch /mnt/c/devel/raddebugger/build/raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
// .f3 = { .win = "wsl_launch /mnt/c/devel/raddebugger/build/raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
//- rjf: local target builds
|
||||
.build_raddbg = { .win = "build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
@@ -849,7 +849,7 @@ e_irtree_from_bundle(E_CacheBundle *bundle)
|
||||
bundle->flags |= E_CacheBundleFlag_IRTree;
|
||||
E_IRTreeAndType parent = e_irtree_from_key(bundle->parent_key);
|
||||
E_Parse parse = e_parse_from_bundle(bundle);
|
||||
bundle->irtree = e_push_irtree_and_type_from_expr(e_cache->arena, &parent, 0, 0, parse.expr);
|
||||
bundle->irtree = e_push_irtree_and_type_from_expr(e_cache->arena, &parent, &e_default_identifier_resolution_rule, 0, 0, parse.expr);
|
||||
E_MsgList msgs_copy = e_msg_list_copy(e_cache->arena, &bundle->irtree.msgs);
|
||||
e_msg_list_concat_in_place(&bundle->msgs, &msgs_copy);
|
||||
}
|
||||
@@ -1243,8 +1243,12 @@ e_range_size_from_eval(E_Eval eval)
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 element_size = e_type_byte_size_from_key(e_type_key_unwrap(type_core, E_TypeUnwrapFlag_All));
|
||||
E_TypeExpandInfo expand_info = expand_rule->info(scratch.arena, eval, str8_zero());
|
||||
result = expand_info.expr_count * element_size;
|
||||
got_size = 1;
|
||||
U64 new_result_maybe = expand_info.expr_count * element_size;
|
||||
if(new_result_maybe != 0)
|
||||
{
|
||||
result = new_result_maybe;
|
||||
got_size = 1;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
@@ -1332,7 +1336,7 @@ e_debug_log_from_expr_string(Arena *arena, String8 string)
|
||||
}
|
||||
|
||||
//- rjf: type
|
||||
E_IRTreeAndType irtree = e_push_irtree_and_type_from_expr(scratch.arena, 0, 0, 0, parse.expr);
|
||||
E_IRTreeAndType irtree = e_push_irtree_and_type_from_expr(scratch.arena, 0, &e_default_identifier_resolution_rule, 0, 0, parse.expr);
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &strings, " type:\n");
|
||||
S32 indent = 2;
|
||||
|
||||
+456
-425
File diff suppressed because it is too large
Load Diff
+73
-1
@@ -4,6 +4,33 @@
|
||||
#ifndef EVAL_IR_H
|
||||
#define EVAL_IR_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Identifier Resolution Rule Types
|
||||
|
||||
typedef enum E_IdentifierResolutionPath
|
||||
{
|
||||
E_IdentifierResolutionPath_ParentExpr,
|
||||
E_IdentifierResolutionPath_ParentExprMember,
|
||||
E_IdentifierResolutionPath_ImplicitThisMember,
|
||||
E_IdentifierResolutionPath_Local,
|
||||
E_IdentifierResolutionPath_Globals,
|
||||
E_IdentifierResolutionPath_ThreadLocals,
|
||||
E_IdentifierResolutionPath_Procedures,
|
||||
E_IdentifierResolutionPath_Types,
|
||||
E_IdentifierResolutionPath_Registers,
|
||||
E_IdentifierResolutionPath_RegisterAliases,
|
||||
E_IdentifierResolutionPath_Constants,
|
||||
E_IdentifierResolutionPath_Macros,
|
||||
}
|
||||
E_IdentifierResolutionPath;
|
||||
|
||||
typedef struct E_IdentifierResolutionRule E_IdentifierResolutionRule;
|
||||
struct E_IdentifierResolutionRule
|
||||
{
|
||||
E_IdentifierResolutionPath *paths;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: IR State
|
||||
|
||||
@@ -49,6 +76,51 @@ struct E_IRState
|
||||
E_IRCacheSlot *ir_cache_slots;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Globals
|
||||
|
||||
E_IdentifierResolutionPath e_default_identifier_resolution_paths[] =
|
||||
{
|
||||
E_IdentifierResolutionPath_ParentExpr,
|
||||
E_IdentifierResolutionPath_ParentExprMember,
|
||||
E_IdentifierResolutionPath_ImplicitThisMember,
|
||||
E_IdentifierResolutionPath_Local,
|
||||
E_IdentifierResolutionPath_Globals,
|
||||
E_IdentifierResolutionPath_ThreadLocals,
|
||||
E_IdentifierResolutionPath_Procedures,
|
||||
E_IdentifierResolutionPath_Types,
|
||||
E_IdentifierResolutionPath_Registers,
|
||||
E_IdentifierResolutionPath_RegisterAliases,
|
||||
E_IdentifierResolutionPath_Constants,
|
||||
E_IdentifierResolutionPath_Macros,
|
||||
};
|
||||
E_IdentifierResolutionRule e_default_identifier_resolution_rule =
|
||||
{
|
||||
e_default_identifier_resolution_paths,
|
||||
ArrayCount(e_default_identifier_resolution_paths),
|
||||
};
|
||||
|
||||
E_IdentifierResolutionPath e_callable_identifier_resolution_paths[] =
|
||||
{
|
||||
E_IdentifierResolutionPath_Macros,
|
||||
E_IdentifierResolutionPath_ParentExpr,
|
||||
E_IdentifierResolutionPath_ParentExprMember,
|
||||
E_IdentifierResolutionPath_ImplicitThisMember,
|
||||
E_IdentifierResolutionPath_Local,
|
||||
E_IdentifierResolutionPath_Globals,
|
||||
E_IdentifierResolutionPath_ThreadLocals,
|
||||
E_IdentifierResolutionPath_Procedures,
|
||||
E_IdentifierResolutionPath_Types,
|
||||
E_IdentifierResolutionPath_Registers,
|
||||
E_IdentifierResolutionPath_RegisterAliases,
|
||||
E_IdentifierResolutionPath_Constants,
|
||||
};
|
||||
E_IdentifierResolutionRule e_callable_identifier_resolution_rule =
|
||||
{
|
||||
e_callable_identifier_resolution_paths,
|
||||
ArrayCount(e_callable_identifier_resolution_paths),
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: IR-ization Functions
|
||||
|
||||
@@ -88,7 +160,7 @@ internal void e_expr_unpoison(E_Expr *expr);
|
||||
|
||||
//- rjf: top-level irtree/type extraction
|
||||
E_TYPE_ACCESS_FUNCTION_DEF(default);
|
||||
internal E_IRTreeAndType e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, B32 disallow_autohooks, B32 disallow_chained_fastpaths, E_Expr *root_expr);
|
||||
internal E_IRTreeAndType e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_IdentifierResolutionRule *identifier_resolution_rule, B32 disallow_autohooks, B32 disallow_chained_fastpaths, E_Expr *root_expr);
|
||||
|
||||
//- rjf: irtree -> linear ops/bytecode
|
||||
internal void e_append_oplist_from_irtree(Arena *arena, E_IRNode *root, E_Space *current_space, E_OpList *out);
|
||||
|
||||
@@ -2661,7 +2661,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(slice)
|
||||
E_IRNode *idxed_base_tree = &e_irnode_nil;
|
||||
if(base_ptr_tree != &e_irnode_nil)
|
||||
{
|
||||
E_IRTreeAndType idx_irtree = e_push_irtree_and_type_from_expr(arena, 0, 0, 1, expr->first->next);
|
||||
E_IRTreeAndType idx_irtree = e_push_irtree_and_type_from_expr(arena, 0, &e_default_identifier_resolution_rule, 0, 1, expr->first->next);
|
||||
E_IRNode *idx_root = e_irtree_resolve_to_value(arena, idx_irtree.mode, idx_irtree.root, idx_irtree.type_key);
|
||||
E_IRNode *off_root = e_irtree_binary_op_u(arena, RDI_EvalOp_Mul, idx_root, e_irtree_const_u(arena, e_type_byte_size_from_key(e_type_key_unwrap(ext->base_ptr_member->type_key, E_TypeUnwrapFlag_All))));
|
||||
idxed_base_tree = e_irtree_binary_op_u(arena, RDI_EvalOp_Add, base_ptr_tree, off_root);
|
||||
|
||||
@@ -1952,6 +1952,12 @@ fancy_viz_eval_tests(void)
|
||||
Bitmap foo = {(unsigned char *)&pixels[0], 18, 18};
|
||||
raddbg_pin(foo);
|
||||
|
||||
//- rjf: name collisions with debugger rules
|
||||
Function_Few_Params_Type *raw = 0;
|
||||
char *text = "some_important_text_here\n";
|
||||
Bitmap bitmap = foo;
|
||||
int x3 = 0;
|
||||
|
||||
//- rjf: 3D geometry
|
||||
float vertex_data[] = // pos.x, pos.y, pos.z, nor.x, nor.y, nor.z, tex.u, tex.v, col.r, col.g, col.b, ...
|
||||
{
|
||||
@@ -2143,7 +2149,7 @@ fancy_viz_eval_tests(void)
|
||||
float *vtx = vertex_data;
|
||||
int vtx_size = sizeof vertex_data;
|
||||
raddbg_pin(geo3d(index_data, count = count, vtx = vtx, vtx_size = vtx_size));
|
||||
int x3 = 0;
|
||||
int x4 = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user