mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 22:08:41 +00:00
more eval scratch work
This commit is contained in:
+24
-2
@@ -382,11 +382,33 @@ typedef S64 B64;
|
|||||||
typedef float F32;
|
typedef float F32;
|
||||||
typedef double F64;
|
typedef double F64;
|
||||||
typedef void VoidProc(void);
|
typedef void VoidProc(void);
|
||||||
typedef struct U128 U128;
|
typedef union U128 U128;
|
||||||
struct U128
|
union U128
|
||||||
{
|
{
|
||||||
|
U8 u8[16];
|
||||||
|
U16 u16[8];
|
||||||
|
U32 u32[4];
|
||||||
U64 u64[2];
|
U64 u64[2];
|
||||||
};
|
};
|
||||||
|
typedef union U256 U256;
|
||||||
|
union U256
|
||||||
|
{
|
||||||
|
U8 u8[32];
|
||||||
|
U16 u16[16];
|
||||||
|
U32 u32[8];
|
||||||
|
U64 u64[4];
|
||||||
|
U128 u128[2];
|
||||||
|
};
|
||||||
|
typedef union U512 U512;
|
||||||
|
union U512
|
||||||
|
{
|
||||||
|
U8 u8[64];
|
||||||
|
U16 u16[32];
|
||||||
|
U32 u32[16];
|
||||||
|
U64 u64[8];
|
||||||
|
U128 u128[4];
|
||||||
|
U256 u256[2];
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Basic Types & Spaces
|
//~ rjf: Basic Types & Spaces
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ struct E_MsgList
|
|||||||
typedef union E_Value E_Value;
|
typedef union E_Value E_Value;
|
||||||
union E_Value
|
union E_Value
|
||||||
{
|
{
|
||||||
U64 u512[8];
|
U512 u512;
|
||||||
U64 u256[4];
|
U256 u256;
|
||||||
U128 u128;
|
U128 u128;
|
||||||
U64 u64;
|
U64 u64;
|
||||||
U32 u32;
|
U32 u32;
|
||||||
|
|||||||
@@ -572,13 +572,13 @@ e_interpret(String8 bytecode)
|
|||||||
|
|
||||||
case RDI_EvalOp_EqEq:
|
case RDI_EvalOp_EqEq:
|
||||||
{
|
{
|
||||||
B32 result = MemoryMatchArray(svals[0].u512, svals[1].u512);
|
B32 result = MemoryMatchArray(svals[0].u512.u64, svals[1].u512.u64);
|
||||||
nval.u64 = !!result;
|
nval.u64 = !!result;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case RDI_EvalOp_NtEq:
|
case RDI_EvalOp_NtEq:
|
||||||
{
|
{
|
||||||
B32 result = MemoryMatchArray(svals[0].u512, svals[1].u512);
|
B32 result = MemoryMatchArray(svals[0].u512.u64, svals[1].u512.u64);
|
||||||
nval.u64 = !result;
|
nval.u64 = !result;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
@@ -813,7 +813,7 @@ e_interpret(String8 bytecode)
|
|||||||
if(offset + bytes_to_read <= sizeof(E_Value))
|
if(offset + bytes_to_read <= sizeof(E_Value))
|
||||||
{
|
{
|
||||||
E_Value src_val = svals[1];
|
E_Value src_val = svals[1];
|
||||||
MemoryCopy(&nval.u512[0], (U8 *)(&src_val.u512[0]) + offset, bytes_to_read);
|
MemoryCopy(&nval.u512.u64[0], (U8 *)(&src_val.u512.u64[0]) + offset, bytes_to_read);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
|||||||
@@ -633,6 +633,10 @@ e_select_parse_ctx(E_ParseCtx *ctx)
|
|||||||
e_parse_state->arena_eval_start_pos = arena_pos(arena);
|
e_parse_state->arena_eval_start_pos = arena_pos(arena);
|
||||||
}
|
}
|
||||||
arena_pop_to(e_parse_state->arena, e_parse_state->arena_eval_start_pos);
|
arena_pop_to(e_parse_state->arena, e_parse_state->arena_eval_start_pos);
|
||||||
|
if(ctx->regs_map == 0) { ctx->regs_map = &e_string2num_map_nil; }
|
||||||
|
if(ctx->reg_alias_map == 0) { ctx->reg_alias_map = &e_string2num_map_nil; }
|
||||||
|
if(ctx->locals_map == 0) { ctx->locals_map = &e_string2num_map_nil; }
|
||||||
|
if(ctx->member_map == 0) { ctx->member_map = &e_string2num_map_nil; }
|
||||||
e_parse_state->ctx = ctx;
|
e_parse_state->ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1498,6 +1502,8 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
|||||||
arch = module->arch;
|
arch = module->arch;
|
||||||
U64 all_location_data_size = 0;
|
U64 all_location_data_size = 0;
|
||||||
U8 *all_location_data = rdi_table_from_name(rdi, LocationData, &all_location_data_size);
|
U8 *all_location_data = rdi_table_from_name(rdi, LocationData, &all_location_data_size);
|
||||||
|
if(block->location_data_off + sizeof(RDI_LocationKind) <= all_location_data_size)
|
||||||
|
{
|
||||||
loc_kind = *((RDI_LocationKind *)(all_location_data + block->location_data_off));
|
loc_kind = *((RDI_LocationKind *)(all_location_data + block->location_data_off));
|
||||||
switch(loc_kind)
|
switch(loc_kind)
|
||||||
{
|
{
|
||||||
@@ -1540,6 +1546,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//- rjf: try registers
|
//- rjf: try registers
|
||||||
if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("reg"), 0))) ProfScope("try to map name as register")
|
if(mapped_identifier == 0 && (resolution_qualifier.size == 0 || str8_match(resolution_qualifier, str8_lit("reg"), 0))) ProfScope("try to map name as register")
|
||||||
|
|||||||
@@ -834,4 +834,3 @@ rdi_size_from_bytecode_stream(RDI_U8 *ptr, RDI_U8 *opl)
|
|||||||
}
|
}
|
||||||
return bytecode_size;
|
return bytecode_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ entry_point(CmdLine *cmdline)
|
|||||||
String8 exprs[] =
|
String8 exprs[] =
|
||||||
{
|
{
|
||||||
str8_lit("123"),
|
str8_lit("123"),
|
||||||
|
str8_lit("1 + 2"),
|
||||||
|
str8_lit("foo"),
|
||||||
};
|
};
|
||||||
for EachElement(idx, exprs)
|
for EachElement(idx, exprs)
|
||||||
{
|
{
|
||||||
@@ -72,7 +74,7 @@ entry_point(CmdLine *cmdline)
|
|||||||
for(Task *t = first_task; t != 0; t = t->next)
|
for(Task *t = first_task; t != 0; t = t->next)
|
||||||
{
|
{
|
||||||
E_Expr *expr = t->expr;
|
E_Expr *expr = t->expr;
|
||||||
raddbg_log("%.*s%S", (int)t->indent*2, indent_spaces, e_expr_kind_strings[expr->kind]);
|
raddbg_log("%.*s%S", (int)t->indent*4, indent_spaces, e_expr_kind_strings[expr->kind]);
|
||||||
switch(expr->kind)
|
switch(expr->kind)
|
||||||
{
|
{
|
||||||
default:{}break;
|
default:{}break;
|
||||||
@@ -82,13 +84,15 @@ entry_point(CmdLine *cmdline)
|
|||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
raddbg_log("\n");
|
raddbg_log("\n");
|
||||||
|
Task *last_task = t;
|
||||||
for(E_Expr *child = expr->first; child != &e_expr_nil; child = child->next)
|
for(E_Expr *child = expr->first; child != &e_expr_nil; child = child->next)
|
||||||
{
|
{
|
||||||
Task *task = push_array(arena, Task, 1);
|
Task *task = push_array(arena, Task, 1);
|
||||||
task->next = t->next;
|
task->next = last_task->next;
|
||||||
t->next = task;
|
last_task->next = task;
|
||||||
task->expr = child;
|
task->expr = child;
|
||||||
task->indent = t->indent+1;
|
task->indent = t->indent+1;
|
||||||
|
last_task = task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +108,7 @@ entry_point(CmdLine *cmdline)
|
|||||||
indent += 1)
|
indent += 1)
|
||||||
{
|
{
|
||||||
E_Type *type = e_type_from_key(arena, type_key);
|
E_Type *type = e_type_from_key(arena, type_key);
|
||||||
raddbg_log("%.*s%S\n", (int)indent*2, indent_spaces, e_kind_basic_string_table[type->kind]);
|
raddbg_log("%.*s%S\n", (int)indent*4, indent_spaces, e_kind_basic_string_table[type->kind]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,11 +127,11 @@ entry_point(CmdLine *cmdline)
|
|||||||
for(Task *t = first_task; t != 0; t = t->next)
|
for(Task *t = first_task; t != 0; t = t->next)
|
||||||
{
|
{
|
||||||
E_IRNode *irnode = t->irnode;
|
E_IRNode *irnode = t->irnode;
|
||||||
raddbg_log("%.*s", (int)t->indent*2, indent_spaces);
|
raddbg_log("%.*s", (int)t->indent*4, indent_spaces);
|
||||||
switch(irnode->op)
|
switch(irnode->op)
|
||||||
{
|
{
|
||||||
default:{}break;
|
default:{}break;
|
||||||
#define X(name) case RDI_EvalOp_##name:{raddbg_log(" " #name);}break;
|
#define X(name) case RDI_EvalOp_##name:{raddbg_log(#name);}break;
|
||||||
RDI_EvalOp_XList
|
RDI_EvalOp_XList
|
||||||
#undef X
|
#undef X
|
||||||
}
|
}
|
||||||
@@ -136,13 +140,15 @@ entry_point(CmdLine *cmdline)
|
|||||||
raddbg_log(" (%I64u)", irnode->value.u64);
|
raddbg_log(" (%I64u)", irnode->value.u64);
|
||||||
}
|
}
|
||||||
raddbg_log("\n");
|
raddbg_log("\n");
|
||||||
|
Task *last_task = t;
|
||||||
for(E_IRNode *child = irnode->first; child != &e_irnode_nil; child = child->next)
|
for(E_IRNode *child = irnode->first; child != &e_irnode_nil; child = child->next)
|
||||||
{
|
{
|
||||||
Task *task = push_array(arena, Task, 1);
|
Task *task = push_array(arena, Task, 1);
|
||||||
task->next = t->next;
|
task->next = last_task->next;
|
||||||
t->next = task;
|
last_task->next = task;
|
||||||
task->irnode = child;
|
task->irnode = child;
|
||||||
task->indent = t->indent+1;
|
task->indent = t->indent+1;
|
||||||
|
last_task = task;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user