mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 22:08:41 +00:00
more dead code elimination
This commit is contained in:
@@ -465,81 +465,6 @@ ev_expand_rule_from_type_key(E_TypeKey type_key)
|
|||||||
return rule;
|
return rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//~ rjf: Expression Resolution (Dynamic Overrides, View Rule Application)
|
|
||||||
|
|
||||||
#if 0 // TODO(rjf): @cfg (dynamic type resolution)
|
|
||||||
internal E_Expr *
|
|
||||||
ev_resolved_from_expr(Arena *arena, E_Expr *expr)
|
|
||||||
{
|
|
||||||
ProfBeginFunction();
|
|
||||||
{
|
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
|
||||||
E_Eval eval = e_eval_from_expr(scratch.arena, expr);
|
|
||||||
E_TypeKey type_key = eval.type_key;
|
|
||||||
E_TypeKind type_kind = e_type_kind_from_key(type_key);
|
|
||||||
E_TypeKey ptee_type_key = e_type_unwrap(e_type_key_direct(e_type_unwrap(type_key)));
|
|
||||||
E_TypeKind ptee_type_kind = e_type_kind_from_key(ptee_type_key);
|
|
||||||
if(ptee_type_kind == E_TypeKind_Struct || ptee_type_kind == E_TypeKind_Class)
|
|
||||||
{
|
|
||||||
E_Type *ptee_type = e_type_from_key__cached(ptee_type_key);
|
|
||||||
B32 has_vtable = 0;
|
|
||||||
for(U64 idx = 0; idx < ptee_type->count; idx += 1)
|
|
||||||
{
|
|
||||||
if(ptee_type->members[idx].kind == E_MemberKind_VirtualMethod)
|
|
||||||
{
|
|
||||||
has_vtable = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(has_vtable)
|
|
||||||
{
|
|
||||||
U64 ptr_vaddr = eval.value.u64;
|
|
||||||
U64 addr_size = e_type_byte_size_from_key(e_type_unwrap(type_key));
|
|
||||||
U64 class_base_vaddr = 0;
|
|
||||||
U64 vtable_vaddr = 0;
|
|
||||||
if(e_space_read(eval.space, &class_base_vaddr, r1u64(ptr_vaddr, ptr_vaddr+addr_size)) &&
|
|
||||||
e_space_read(eval.space, &vtable_vaddr, r1u64(class_base_vaddr, class_base_vaddr+addr_size)))
|
|
||||||
{
|
|
||||||
Arch arch = e_base_ctx->primary_module->arch;
|
|
||||||
U32 rdi_idx = 0;
|
|
||||||
RDI_Parsed *rdi = 0;
|
|
||||||
U64 module_base = 0;
|
|
||||||
for(U64 idx = 0; idx < e_base_ctx->modules_count; idx += 1)
|
|
||||||
{
|
|
||||||
if(contains_1u64(e_base_ctx->modules[idx].vaddr_range, vtable_vaddr))
|
|
||||||
{
|
|
||||||
arch = e_base_ctx->modules[idx].arch;
|
|
||||||
rdi_idx = (U32)idx;
|
|
||||||
rdi = e_base_ctx->modules[idx].rdi;
|
|
||||||
module_base = e_base_ctx->modules[idx].vaddr_range.min;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(rdi != 0)
|
|
||||||
{
|
|
||||||
U64 vtable_voff = vtable_vaddr - module_base;
|
|
||||||
U64 global_idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_GlobalVMap, vtable_voff);
|
|
||||||
RDI_GlobalVariable *global_var = rdi_element_from_name_idx(rdi, GlobalVariables, global_idx);
|
|
||||||
if(global_var->link_flags & RDI_LinkFlag_TypeScoped)
|
|
||||||
{
|
|
||||||
RDI_UDT *udt = rdi_element_from_name_idx(rdi, UDTs, global_var->container_idx);
|
|
||||||
RDI_TypeNode *type = rdi_element_from_name_idx(rdi, TypeNodes, udt->self_type_idx);
|
|
||||||
E_TypeKey derived_type_key = e_type_key_ext(e_type_kind_from_rdi(type->kind), udt->self_type_idx, rdi_idx);
|
|
||||||
E_TypeKey ptr_to_derived_type_key = e_type_key_cons_ptr(arch, derived_type_key, 1, 0);
|
|
||||||
expr = e_expr_irext_cast(arena, ptr_to_derived_type_key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scratch_end(scratch);
|
|
||||||
}
|
|
||||||
ProfEnd();
|
|
||||||
return expr;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Block Building
|
//~ rjf: Block Building
|
||||||
|
|
||||||
|
|||||||
@@ -342,13 +342,6 @@ internal void ev_select_expand_rule_table(EV_ExpandRuleTable *table);
|
|||||||
internal EV_ExpandRule *ev_expand_rule_from_string(String8 string);
|
internal EV_ExpandRule *ev_expand_rule_from_string(String8 string);
|
||||||
internal EV_ExpandRule *ev_expand_rule_from_type_key(E_TypeKey type_key);
|
internal EV_ExpandRule *ev_expand_rule_from_type_key(E_TypeKey type_key);
|
||||||
|
|
||||||
////////////////////////////////
|
|
||||||
//~ rjf: Expression Resolution (Dynamic Overrides, View Rule Application)
|
|
||||||
|
|
||||||
#if 0 // TODO(rjf): @cfg (dynamic type resolution)
|
|
||||||
internal E_Expr *ev_resolved_from_expr(Arena *arena, E_Expr *expr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Block Building
|
//~ rjf: Block Building
|
||||||
|
|
||||||
|
|||||||
@@ -9671,40 +9671,6 @@ rd_lister_query_word_from_input_string_off(String8 input, U64 cursor_off)
|
|||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal String8
|
|
||||||
rd_lister_query_path_from_input_string_off(String8 input, U64 cursor_off)
|
|
||||||
{
|
|
||||||
// rjf: find start of path
|
|
||||||
U64 path_start_off = 0;
|
|
||||||
{
|
|
||||||
B32 single_quoted = 0;
|
|
||||||
B32 double_quoted = 0;
|
|
||||||
for(U64 off = 0; off < input.size && off < cursor_off; off += 1)
|
|
||||||
{
|
|
||||||
if(input.str[off] == '\'')
|
|
||||||
{
|
|
||||||
single_quoted ^= 1;
|
|
||||||
}
|
|
||||||
if(input.str[off] == '\"')
|
|
||||||
{
|
|
||||||
double_quoted ^= 1;
|
|
||||||
}
|
|
||||||
if(char_is_space(input.str[off]) && !single_quoted && !double_quoted)
|
|
||||||
{
|
|
||||||
path_start_off = off+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// rjf: form path
|
|
||||||
String8 path = str8_skip(str8_prefix(input, cursor_off), path_start_off);
|
|
||||||
if(path.size >= 1 && path.str[0] == '"') { path = str8_skip(path, 1); }
|
|
||||||
if(path.size >= 1 && path.str[0] == '\'') { path = str8_skip(path, 1); }
|
|
||||||
if(path.size >= 1 && path.str[path.size-1] == '"') { path = str8_chop(path, 1); }
|
|
||||||
if(path.size >= 1 && path.str[path.size-1] == '\'') { path = str8_chop(path, 1); }
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
rd_set_autocomp_regs_(RD_Regs *regs)
|
rd_set_autocomp_regs_(RD_Regs *regs)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -952,7 +952,6 @@ internal void rd_set_hover_eval(Vec2F32 pos, String8 string);
|
|||||||
//~ rjf: Autocompletion Lister
|
//~ rjf: Autocompletion Lister
|
||||||
|
|
||||||
internal String8 rd_lister_query_word_from_input_string_off(String8 input, U64 cursor_off);
|
internal String8 rd_lister_query_word_from_input_string_off(String8 input, U64 cursor_off);
|
||||||
internal String8 rd_lister_query_path_from_input_string_off(String8 input, U64 cursor_off);
|
|
||||||
internal void rd_set_autocomp_regs_(RD_Regs *regs);
|
internal void rd_set_autocomp_regs_(RD_Regs *regs);
|
||||||
#define rd_set_autocomp_regs(...) rd_set_autocomp_regs_(&(RD_Regs){rd_regs_lit_init_top __VA_ARGS__})
|
#define rd_set_autocomp_regs(...) rd_set_autocomp_regs_(&(RD_Regs){rd_regs_lit_init_top __VA_ARGS__})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user