mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-12 23:31:38 -07:00
eval stability tests in tester; tear out last pass' view rule extensions
This commit is contained in:
@@ -51,6 +51,9 @@ commands =
|
||||
//- rjf: [eval_scratch]
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta eval_scratch && raddbg_stable --ipc bring_to_front && raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
//- 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: running target
|
||||
.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, },
|
||||
|
||||
+2
-1
@@ -71,7 +71,8 @@ E_TypeKindTable:
|
||||
{IncompleteEnum "enum" 0 }
|
||||
{Bitfield "bitfield" 0 }
|
||||
{Variadic "variadic" 0 }
|
||||
{Stub "stub" 0 }
|
||||
{Set "set" 0 }
|
||||
{Lens "lens" 0 }
|
||||
}
|
||||
|
||||
@table(name op_kind precedence op_pre op_sep op_pos)
|
||||
|
||||
+131
-3
@@ -17,7 +17,6 @@ e_eval_from_exprs(Arena *arena, E_ExprChain exprs)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, exprs.last);
|
||||
E_LookupRuleTagPair lookup = e_lookup_rule_tag_pair_from_expr_irtree(exprs.last, &irtree);
|
||||
E_OpList oplist = e_oplist_from_irtree(arena, irtree.root);
|
||||
String8 bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
E_Interpretation interp = e_interpret(bytecode);
|
||||
@@ -28,7 +27,6 @@ e_eval_from_exprs(Arena *arena, E_ExprChain exprs)
|
||||
.exprs = exprs,
|
||||
.irtree = irtree,
|
||||
.bytecode = bytecode,
|
||||
.lookup_rule_tag = lookup,
|
||||
.code = interp.code,
|
||||
};
|
||||
e_msg_list_concat_in_place(&eval.msgs, &irtree.msgs);
|
||||
@@ -254,4 +252,134 @@ e_value_from_expr(E_Expr *expr)
|
||||
E_Value result = value_eval.value;
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Logging Functions
|
||||
|
||||
internal String8
|
||||
e_debug_log_from_expr_string(Arena *arena, String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
char *indent_spaces = " ";
|
||||
String8List strings = {0};
|
||||
|
||||
//- rjf: begin expression
|
||||
String8 expr_text = string;
|
||||
str8_list_pushf(scratch.arena, &strings, "`%S`\n", expr_text);
|
||||
|
||||
//- rjf: tokenize
|
||||
E_TokenArray tokens = e_token_array_from_text(scratch.arena, expr_text);
|
||||
str8_list_pushf(scratch.arena, &strings, " tokens:\n");
|
||||
for EachIndex(idx, tokens.count)
|
||||
{
|
||||
E_Token token = tokens.v[idx];
|
||||
String8 token_string = str8_substr(expr_text, token.range);
|
||||
str8_list_pushf(scratch.arena, &strings, " %S: `%S`\n", e_token_kind_strings[token.kind], token_string);
|
||||
}
|
||||
|
||||
//- rjf: parse
|
||||
E_Parse parse = e_parse_expr_from_text_tokens(scratch.arena, expr_text, tokens);
|
||||
{
|
||||
typedef struct Task Task;
|
||||
struct Task
|
||||
{
|
||||
Task *next;
|
||||
E_Expr *expr;
|
||||
S32 indent;
|
||||
};
|
||||
str8_list_pushf(scratch.arena, &strings, " expr:\n");
|
||||
Task start_task = {0, parse.exprs.first, 2};
|
||||
Task *first_task = &start_task;
|
||||
for(Task *t = first_task; t != 0; t = t->next)
|
||||
{
|
||||
E_Expr *expr = t->expr;
|
||||
str8_list_pushf(scratch.arena, &strings, "%.*s%S", (int)t->indent*4, indent_spaces, e_expr_kind_strings[expr->kind]);
|
||||
switch(expr->kind)
|
||||
{
|
||||
default:{}break;
|
||||
case E_ExprKind_LeafU64:
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &strings, " (%I64u)", expr->value.u64);
|
||||
}break;
|
||||
case E_ExprKind_LeafIdentifier:
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &strings, " (`%S`)", expr->string);
|
||||
}break;
|
||||
}
|
||||
str8_list_pushf(scratch.arena, &strings, "\n");
|
||||
Task *last_task = t;
|
||||
for(E_Expr *child = expr->first; child != &e_expr_nil; child = child->next)
|
||||
{
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
task->next = last_task->next;
|
||||
last_task->next = task;
|
||||
task->expr = child;
|
||||
task->indent = t->indent+1;
|
||||
last_task = task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: type
|
||||
E_IRTreeAndType irtree = e_irtree_and_type_from_expr(scratch.arena, parse.exprs.first);
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &strings, " type:\n");
|
||||
S32 indent = 2;
|
||||
for(E_TypeKey type_key = irtree.type_key;
|
||||
!e_type_key_match(e_type_key_zero(), type_key);
|
||||
type_key = e_type_direct_from_key(type_key),
|
||||
indent += 1)
|
||||
{
|
||||
E_Type *type = e_type_from_key(scratch.arena, type_key);
|
||||
str8_list_pushf(scratch.arena, &strings, "%.*s%S\n", (int)indent*4, indent_spaces, e_type_kind_basic_string_table[type->kind]);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: irtree
|
||||
{
|
||||
typedef struct Task Task;
|
||||
struct Task
|
||||
{
|
||||
Task *next;
|
||||
E_IRNode *irnode;
|
||||
S32 indent;
|
||||
};
|
||||
str8_list_pushf(scratch.arena, &strings, " ir_tree:\n");
|
||||
Task start_task = {0, irtree.root, 2};
|
||||
Task *first_task = &start_task;
|
||||
for(Task *t = first_task; t != 0; t = t->next)
|
||||
{
|
||||
E_IRNode *irnode = t->irnode;
|
||||
str8_list_pushf(scratch.arena, &strings, "%.*s", (int)t->indent*4, indent_spaces);
|
||||
switch(irnode->op)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name) case RDI_EvalOp_##name:{str8_list_pushf(scratch.arena, &strings, #name);}break;
|
||||
RDI_EvalOp_XList
|
||||
#undef X
|
||||
}
|
||||
if(irnode->value.u64 != 0)
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &strings, " (%I64u)", irnode->value.u64);
|
||||
}
|
||||
str8_list_pushf(scratch.arena, &strings, "\n");
|
||||
Task *last_task = t;
|
||||
for(E_IRNode *child = irnode->first; child != &e_irnode_nil; child = child->next)
|
||||
{
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
task->next = last_task->next;
|
||||
last_task->next = task;
|
||||
task->irnode = child;
|
||||
task->indent = t->indent+1;
|
||||
last_task = task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
str8_list_pushf(scratch.arena, &strings, "\n");
|
||||
|
||||
String8 result = str8_list_join(arena, &strings, 0);
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ struct E_Eval
|
||||
E_ExprChain exprs;
|
||||
E_IRTreeAndType irtree;
|
||||
String8 bytecode;
|
||||
E_LookupRuleTagPair lookup_rule_tag;
|
||||
E_InterpretationCode code;
|
||||
E_MsgList msgs;
|
||||
};
|
||||
@@ -34,4 +33,9 @@ internal E_Value e_value_from_string(String8 string);
|
||||
internal E_Value e_value_from_stringf(char *fmt, ...);
|
||||
internal E_Value e_value_from_expr(E_Expr *expr);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Logging Functions
|
||||
|
||||
internal String8 e_debug_log_from_expr_string(Arena *arena, String8 string);
|
||||
|
||||
#endif // EVAL_BUNDLES_H
|
||||
|
||||
+16
-45
@@ -69,6 +69,7 @@ e_select_ir_ctx(E_IRCtx *ctx)
|
||||
e_ir_state->arena_eval_start_pos = arena_pos(arena);
|
||||
}
|
||||
arena_pop_to(e_ir_state->arena, e_ir_state->arena_eval_start_pos);
|
||||
if(ctx->modules == 0) { ctx->modules = &e_module_nil; }
|
||||
if(ctx->primary_module == 0) { ctx->primary_module = &e_module_nil; }
|
||||
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; }
|
||||
@@ -97,8 +98,7 @@ e_select_ir_ctx(E_IRCtx *ctx)
|
||||
for EachElement(idx, builtin_view_rule_names)
|
||||
{
|
||||
E_Expr *expr = e_push_expr(e_ir_state->arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = str8_lit("view_rule"));
|
||||
expr->value.u64 = e_id_from_string(builtin_view_rule_names[idx]);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Lens, .name = builtin_view_rule_names[idx]);
|
||||
e_string2expr_map_insert(e_ir_state->arena, ctx->macro_map, builtin_view_rule_names[idx], expr);
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ E_LOOKUP_RANGE_FUNCTION_DEF(folder)
|
||||
String8 folder_name = accel->folders.v[idx - 0];
|
||||
String8 folder_path = push_str8f(scratch.arena, "%S%s%S", accel->folder_path, accel->folder_path.size != 0 ? "/" : "", folder_name);
|
||||
expr = e_push_expr(arena, E_ExprKind_LeafValue, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = str8_lit("folder"));
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = str8_lit("folder"));
|
||||
expr->space = e_space_make(E_SpaceKind_FileSystem);
|
||||
expr->value.u64 = e_id_from_string(folder_path);
|
||||
expr_string = push_str8f(arena, "\"%S\"", escaped_from_raw_str8(scratch.arena, folder_name));
|
||||
@@ -202,7 +202,7 @@ E_LOOKUP_RANGE_FUNCTION_DEF(folder)
|
||||
String8 file_name = accel->files.v[idx - accel->folders.count];
|
||||
String8 file_path = push_str8f(scratch.arena, "%S%s%S", accel->folder_path, accel->folder_path.size != 0 ? "/" : "", file_name);
|
||||
expr = e_push_expr(arena, E_ExprKind_LeafValue, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = str8_lit("file"));
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = str8_lit("file"));
|
||||
expr->space = e_space_make(E_SpaceKind_FileSystem);
|
||||
expr->value.u64 = e_id_from_string(file_path);
|
||||
expr_string = push_str8f(arena, "\"%S\"", escaped_from_raw_str8(scratch.arena, file_name));
|
||||
@@ -879,7 +879,7 @@ E_LOOKUP_RANGE_FUNCTION_DEF(default)
|
||||
enum_type_key = lhs_type_key;
|
||||
do_enum_range = 1;
|
||||
}
|
||||
else if(lhs_type_kind == E_TypeKind_Stub)
|
||||
else if(lhs_type_kind == E_TypeKind_Set)
|
||||
{
|
||||
do_index_range = 1;
|
||||
}
|
||||
@@ -1818,14 +1818,12 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
E_Expr *lhs = expr->first;
|
||||
E_Expr *rhs = lhs->next;
|
||||
E_IRTreeAndType lhs_irtree = e_irtree_and_type_from_expr(scratch.arena, lhs);
|
||||
E_LookupRule *lookup_rule = e_lookup_rule_from_irtree(&lhs_irtree);
|
||||
ProfScope("lookup via rule '%.*s'", str8_varg(lhs_lookup_rule->name))
|
||||
E_LookupRule *lookup_rule = &e_lookup_rule__default;
|
||||
ProfScope("lookup via rule '%.*s'", str8_varg(lookup_rule->name))
|
||||
{
|
||||
e_expr_poison(lhs_lookup_rule_and_tag.tag);
|
||||
E_LookupInfo lookup_info = lhs_lookup_rule_and_tag.rule->info(arena, &lhs_irtree, lhs_lookup_rule_and_tag.tag, str8_zero());
|
||||
E_LookupAccess lookup_access = lhs_lookup_rule_and_tag.rule->access(arena, expr->kind, lhs, rhs, lhs_lookup_rule_and_tag.tag, lookup_info.user_data);
|
||||
E_LookupInfo lookup_info = lookup_rule->info(arena, &lhs_irtree, &e_expr_nil, str8_zero());
|
||||
E_LookupAccess lookup_access = lookup_rule->access(arena, expr->kind, lhs, rhs, &e_expr_nil, lookup_info.user_data);
|
||||
result = lookup_access.irtree_and_type;
|
||||
e_expr_unpoison(lhs_lookup_rule_and_tag.tag);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
@@ -2429,18 +2427,13 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
// rjf: map callee -> ir-generation rule
|
||||
E_IRGenRule *irgen_rule = &e_irgen_rule__default;
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
E_TypeKey type_key = lhs_irtree.type_key;
|
||||
E_Type *type = e_type_from_key__cached(type_key);
|
||||
if(type->kind == E_TypeKind_Stub)
|
||||
if(type->kind == E_TypeKind_Lens)
|
||||
{
|
||||
E_OpList oplist = e_oplist_from_irtree(scratch.arena, lhs_irtree.root);
|
||||
String8 bytecode = e_bytecode_from_oplist(scratch.arena, &oplist);
|
||||
E_Interpretation interp = e_interpret(bytecode);
|
||||
String8 name = e_string_from_id(interp.value.u64);
|
||||
String8 name = type->name;
|
||||
irgen_rule = e_irgen_rule_from_string(name);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
// rjf: if we have a non-default ir-generation rule, then we can use that
|
||||
@@ -2451,7 +2444,7 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
}
|
||||
else
|
||||
{
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_InterpretationError, expr->location, "Calling this type is not currently supported.");
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_InterpretationError, expr->location, "Calling this type is not supported.");
|
||||
}
|
||||
}break;
|
||||
|
||||
@@ -2967,7 +2960,7 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
{
|
||||
E_Space space = e_space_make(E_SpaceKind_FileSystem);
|
||||
result.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, e_id_from_string(file_path)));
|
||||
result.type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = str8_lit("file"));
|
||||
result.type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = str8_lit("file"));
|
||||
result.mode = E_Mode_Value;
|
||||
}
|
||||
else
|
||||
@@ -2978,7 +2971,7 @@ E_IRGEN_FUNCTION_DEF(default)
|
||||
{
|
||||
E_Space space = e_space_make(E_SpaceKind_FileSystem);
|
||||
result.root = e_irtree_set_space(arena, space, e_irtree_const_u(arena, e_id_from_string(folder_path)));
|
||||
result.type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = str8_lit("folder"));
|
||||
result.type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = str8_lit("folder"));
|
||||
result.mode = E_Mode_Value;
|
||||
}
|
||||
}
|
||||
@@ -3346,30 +3339,7 @@ e_expr_irext_cast(Arena *arena, E_Expr *rhs, E_IRTreeAndType *rhs_irtree, E_Type
|
||||
////////////////////////////////
|
||||
//~ rjf: Expression & IR-Tree => Rules
|
||||
|
||||
internal E_LookupRule *
|
||||
e_lookup_rule_from_irtree(E_IRTreeAndType *irtree)
|
||||
{
|
||||
E_LookupRule *rule = &e_lookup_rule__default;
|
||||
E_TypeKey type_key = irtree->type_key;
|
||||
E_Type *type = e_type_from_key__cached(type_key);
|
||||
|
||||
// rjf: first try implicit stub name -> rule mapping
|
||||
if(rule == &e_lookup_rule__default && type->kind == E_TypeKind_Stub)
|
||||
{
|
||||
String8 name = type->name;
|
||||
rule = e_lookup_rule_from_string(name);
|
||||
}
|
||||
|
||||
// rjf: try auto hook map
|
||||
if(rule == &e_lookup_rule__default)
|
||||
{
|
||||
E_ExprList tags = e_auto_hook_exprs_from_type_key__cached(irtree->type_key);
|
||||
|
||||
}
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
||||
#if 0 // TODO(rjf): @eval
|
||||
internal E_LookupRuleTagPair
|
||||
e_lookup_rule_tag_pair_from_expr_irtree(E_Expr *expr, E_IRTreeAndType *irtree)
|
||||
{
|
||||
@@ -3432,3 +3402,4 @@ e_lookup_rule_tag_pair_from_expr_irtree(E_Expr *expr, E_IRTreeAndType *irtree)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
+2
-1
@@ -288,7 +288,8 @@ internal E_Expr *e_expr_irext_cast(Arena *arena, E_Expr *rhs, E_IRTreeAndType *r
|
||||
////////////////////////////////
|
||||
//~ rjf: Expression & IR-Tree => Rules
|
||||
|
||||
internal E_LookupRule *e_lookup_rule_from_irtree(E_IRTreeAndType *irtree);
|
||||
#if 0 // TODO(rjf): @eval
|
||||
internal E_LookupRuleTagPair e_lookup_rule_tag_pair_from_expr_irtree(E_Expr *expr, E_IRTreeAndType *irtree);
|
||||
#endif
|
||||
|
||||
#endif // EVAL_IR_H
|
||||
|
||||
+2
-22
@@ -315,7 +315,8 @@ e_select_parse_ctx(E_ParseCtx *ctx)
|
||||
e_parse_state->arena_eval_start_pos = arena_pos(arena);
|
||||
}
|
||||
arena_pop_to(e_parse_state->arena, e_parse_state->arena_eval_start_pos);
|
||||
if(ctx->primary_module == 0){ ctx->primary_module = &e_module_nil; }
|
||||
if(ctx->modules == 0) { ctx->modules = &e_module_nil; }
|
||||
if(ctx->primary_module == 0) { ctx->primary_module = &e_module_nil; }
|
||||
e_parse_state->ctx = ctx;
|
||||
}
|
||||
|
||||
@@ -408,7 +409,6 @@ e_expr_copy(Arena *arena, E_Expr *src)
|
||||
E_Expr *dst_parent;
|
||||
E_Expr *src;
|
||||
B32 is_ref;
|
||||
B32 is_tag;
|
||||
};
|
||||
Task start_task = {0, &e_expr_nil, src};
|
||||
Task *first_task = &start_task;
|
||||
@@ -431,10 +431,6 @@ e_expr_copy(Arena *arena, E_Expr *src)
|
||||
{
|
||||
t->dst_parent->ref = dst;
|
||||
}
|
||||
else if(t->is_tag)
|
||||
{
|
||||
e_expr_push_tag(t->dst_parent, dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
e_expr_push_child(t->dst_parent, dst);
|
||||
@@ -1484,22 +1480,6 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray tok
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: parse tags
|
||||
{
|
||||
if(token.kind == E_TokenKind_Symbol && str8_match(token_string, str8_lit("=>"), 0))
|
||||
{
|
||||
it += 1;
|
||||
E_Parse tags_parse = e_parse_expr_from_text_tokens__prec(arena, text, e_token_array_make_first_opl(it, it_opl), e_max_precedence, max_U64);
|
||||
e_msg_list_concat_in_place(&result.msgs, &tags_parse.msgs);
|
||||
it = tags_parse.last_token;
|
||||
for(E_Expr *tag = tags_parse.exprs.first, *next = &e_expr_nil; tag != &e_expr_nil; tag = next)
|
||||
{
|
||||
next = tag->next;
|
||||
e_expr_push_tag(atom, tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: if we parsed nothing successfully, we're done
|
||||
if(it == start_it)
|
||||
{
|
||||
|
||||
@@ -235,7 +235,8 @@ e_select_type_ctx(E_TypeCtx *ctx)
|
||||
e_type_state->arena = arena;
|
||||
e_type_state->arena_eval_start_pos = arena_pos(e_type_state->arena);
|
||||
}
|
||||
if(ctx->primary_module == 0) {ctx->primary_module = &e_module_nil;}
|
||||
if(ctx->modules == 0) { ctx->modules = &e_module_nil; }
|
||||
if(ctx->primary_module == 0) { ctx->primary_module = &e_module_nil; }
|
||||
arena_pop_to(e_type_state->arena, e_type_state->arena_eval_start_pos);
|
||||
e_type_state->ctx = ctx;
|
||||
e_type_state->cons_id_gen = 0;
|
||||
|
||||
@@ -14,7 +14,7 @@ str8_lit_comp("CharLiteral"),
|
||||
str8_lit_comp("Symbol"),
|
||||
};
|
||||
|
||||
String8 e_type_kind_basic_string_table[56] =
|
||||
String8 e_type_kind_basic_string_table[57] =
|
||||
{
|
||||
str8_lit_comp(""),
|
||||
str8_lit_comp("void"),
|
||||
@@ -71,10 +71,11 @@ str8_lit_comp("class"),
|
||||
str8_lit_comp("enum"),
|
||||
str8_lit_comp("bitfield"),
|
||||
str8_lit_comp("variadic"),
|
||||
str8_lit_comp("stub"),
|
||||
str8_lit_comp("set"),
|
||||
str8_lit_comp("lens"),
|
||||
};
|
||||
|
||||
U8 e_type_kind_basic_byte_size_table[56] =
|
||||
U8 e_type_kind_basic_byte_size_table[57] =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
@@ -132,6 +133,7 @@ U8 e_type_kind_basic_byte_size_table[56] =
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
String8 e_expr_kind_strings[48] =
|
||||
|
||||
@@ -74,7 +74,8 @@ E_TypeKind_IncompleteClass,
|
||||
E_TypeKind_IncompleteEnum,
|
||||
E_TypeKind_Bitfield,
|
||||
E_TypeKind_Variadic,
|
||||
E_TypeKind_Stub,
|
||||
E_TypeKind_Set,
|
||||
E_TypeKind_Lens,
|
||||
E_TypeKind_COUNT,
|
||||
E_TypeKind_FirstBasic = E_TypeKind_Void,
|
||||
E_TypeKind_LastBasic = E_TypeKind_ComplexF128,
|
||||
@@ -160,8 +161,8 @@ E_InterpretationCode_COUNT,
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 e_token_kind_strings[6];
|
||||
extern String8 e_type_kind_basic_string_table[56];
|
||||
extern U8 e_type_kind_basic_byte_size_table[56];
|
||||
extern String8 e_type_kind_basic_string_table[57];
|
||||
extern U8 e_type_kind_basic_byte_size_table[57];
|
||||
extern String8 e_expr_kind_strings[48];
|
||||
extern E_OpInfo e_expr_kind_op_info_table[48];
|
||||
extern String8 e_interpretation_code_display_strings[11];
|
||||
|
||||
@@ -94,7 +94,7 @@ ev_type_key_and_mode_is_expandable(E_TypeKey type_key, E_Mode mode)
|
||||
kind == E_TypeKind_Union ||
|
||||
kind == E_TypeKind_Class ||
|
||||
kind == E_TypeKind_Array ||
|
||||
kind == E_TypeKind_Stub ||
|
||||
kind == E_TypeKind_Set ||
|
||||
(kind == E_TypeKind_Enum && mode == E_Mode_Null))
|
||||
{
|
||||
result = 1;
|
||||
@@ -474,6 +474,7 @@ ev_resolved_from_expr(Arena *arena, E_Expr *expr)
|
||||
////////////////////////////////
|
||||
//~ rjf: Upgrading Expressions w/ Tags From All Sources
|
||||
|
||||
#if 0 // TODO(rjf): @eval
|
||||
internal void
|
||||
ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *block, EV_Key key, E_Expr *expr)
|
||||
{
|
||||
@@ -528,6 +529,7 @@ ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *block, EV_Key key
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Block Building
|
||||
@@ -544,7 +546,9 @@ ev_block_tree_from_exprs(Arena *arena, EV_View *view, String8 filter, E_ExprChai
|
||||
EV_Key root_key = ev_key_root();
|
||||
EV_Key root_row_key = ev_key_make(ev_hash_from_key(root_key), 1);
|
||||
E_Expr *root_expr = e_expr_copy(arena, exprs.last);
|
||||
#if 0 // TODO(rjf): @eval
|
||||
ev_keyed_expr_push_tags(arena, view, &ev_nil_block, root_row_key, root_expr);
|
||||
#endif
|
||||
|
||||
//- rjf: generate root block
|
||||
tree.root = push_array(arena, EV_Block, 1);
|
||||
@@ -593,9 +597,9 @@ ev_block_tree_from_exprs(Arena *arena, EV_View *view, String8 filter, E_ExprChai
|
||||
E_IRTreeAndType expr_irtree = e_irtree_and_type_from_expr(scratch.arena, t->expr);
|
||||
|
||||
// rjf: get expr's expansion rule
|
||||
EV_ExpandRuleTagPair expand_rule_and_tag = ev_expand_rule_tag_pair_from_expr_irtree(t->expr, &expr_irtree);
|
||||
EV_ExpandRule *expand_rule = expand_rule_and_tag.rule;
|
||||
E_Expr *expand_rule_tag = expand_rule_and_tag.tag;
|
||||
// TODO(rjf): @eval EV_ExpandRuleTagPair expand_rule_and_tag = ev_expand_rule_tag_pair_from_expr_irtree(t->expr, &expr_irtree);
|
||||
EV_ExpandRule *expand_rule = &ev_nil_expand_rule;
|
||||
E_Expr *expand_rule_tag = &e_expr_nil;
|
||||
|
||||
// rjf: skip if no expansion rule, & type info disallows expansion
|
||||
if(expand_rule == &ev_nil_expand_rule && !ev_type_key_and_mode_is_expandable(expr_irtree.type_key, expr_irtree.mode))
|
||||
@@ -604,12 +608,12 @@ ev_block_tree_from_exprs(Arena *arena, EV_View *view, String8 filter, E_ExprChai
|
||||
}
|
||||
|
||||
// rjf: get expr's lookup rule
|
||||
E_LookupRuleTagPair lookup_rule_and_tag = e_lookup_rule_tag_pair_from_expr_irtree(t->expr, &expr_irtree);
|
||||
E_LookupRule *lookup_rule = lookup_rule_and_tag.rule;
|
||||
E_Expr *lookup_rule_tag = lookup_rule_and_tag.tag;
|
||||
// TODO(rjf): @eval E_LookupRuleTagPair lookup_rule_and_tag = &e_lookup_rule_tag_pair_from_expr_irtree(t->expr, &expr_irtree);
|
||||
E_LookupRule *lookup_rule = &e_lookup_rule__default;
|
||||
E_Expr *lookup_rule_tag = &e_expr_nil;
|
||||
|
||||
// rjf: get top-level lookup/expansion info
|
||||
E_LookupInfo lookup_info = lookup_rule->info(arena, &expr_irtree, lookup_rule_and_tag.tag, filter);
|
||||
E_LookupInfo lookup_info = lookup_rule->info(arena, &expr_irtree, lookup_rule_tag, filter);
|
||||
EV_ExpandInfo expand_info = expand_rule->info(arena, view, filter, t->expr, expand_rule_tag);
|
||||
|
||||
// rjf: determine expansion info
|
||||
@@ -733,7 +737,9 @@ ev_block_tree_from_exprs(Arena *arena, EV_View *view, String8 filter, E_ExprChai
|
||||
if(child_expr != &e_expr_nil)
|
||||
{
|
||||
EV_Key child_key = child_keys[idx];
|
||||
#if 0 // TODO(rjf): @eval
|
||||
ev_keyed_expr_push_tags(arena, view, expansion_block, child_key, child_expr);
|
||||
#endif
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
SLLQueuePush(first_task, last_task, task);
|
||||
task->parent_block = expansion_block;
|
||||
@@ -1046,7 +1052,9 @@ ev_windowed_row_list_from_block_range_list(Arena *arena, EV_View *view, String8
|
||||
U64 child_id = n->v.block->lookup_rule->id_from_num(child_num, n->v.block->lookup_rule_user_data);
|
||||
EV_Key row_key = ev_key_make(ev_hash_from_key(n->v.block->key), child_id);
|
||||
E_Expr *row_expr = range_exprs[idx];
|
||||
#if 0 // TODO(rjf): @eval
|
||||
ev_keyed_expr_push_tags(arena, view, n->v.block, row_key, row_expr);
|
||||
#endif
|
||||
EV_WindowedRowNode *row_node = push_array(arena, EV_WindowedRowNode, 1);
|
||||
SLLQueuePush(rows.first, rows.last, row_node);
|
||||
rows.count += 1;
|
||||
@@ -1142,11 +1150,13 @@ ev_row_is_expandable(EV_Row *row)
|
||||
// rjf: determine if view rules force expandability
|
||||
if(!result)
|
||||
{
|
||||
#if 0 // TODO(rjf): @eval
|
||||
EV_ExpandRuleTagPair expand_rule_and_tag = ev_expand_rule_tag_pair_from_expr_irtree(row->expr, &irtree);
|
||||
if(expand_rule_and_tag.rule != &ev_nil_expand_rule)
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// rjf: determine if type info force expandability
|
||||
@@ -1573,6 +1583,7 @@ ev_escaped_from_raw_string(Arena *arena, String8 raw)
|
||||
////////////////////////////////
|
||||
//~ rjf: Expression & IR-Tree => Expand Rule
|
||||
|
||||
#if 0 // TODO(rjf): @eval
|
||||
internal EV_ExpandRuleTagPair
|
||||
ev_expand_rule_tag_pair_from_expr_irtree(E_Expr *expr, E_IRTreeAndType *irtree)
|
||||
{
|
||||
@@ -1611,3 +1622,4 @@ ev_expand_rule_tag_pair_from_expr_irtree(E_Expr *expr, E_IRTreeAndType *irtree)
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -304,7 +304,9 @@ internal E_Expr *ev_resolved_from_expr(Arena *arena, E_Expr *expr);
|
||||
////////////////////////////////
|
||||
//~ rjf: Upgrading Expressions w/ Tags From All Sources
|
||||
|
||||
#if 0 // TODO(rjf): @eval
|
||||
internal void ev_keyed_expr_push_tags(Arena *arena, EV_View *view, EV_Block *block, EV_Key key, E_Expr *expr);
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Block Building
|
||||
@@ -345,6 +347,8 @@ internal String8 ev_escaped_from_raw_string(Arena *arena, String8 raw);
|
||||
////////////////////////////////
|
||||
//~ rjf: Expression & IR-Tree => Expand Rule
|
||||
|
||||
#if 0 // TODO(rjf): @eval
|
||||
internal EV_ExpandRuleTagPair ev_expand_rule_tag_pair_from_expr_irtree(E_Expr *expr, E_IRTreeAndType *irtree);
|
||||
#endif
|
||||
|
||||
#endif // EVAL_VISUALIZATION_CORE_H
|
||||
|
||||
+26
-15
@@ -107,7 +107,7 @@ E_LOOKUP_INFO_FUNCTION_DEF(watches)
|
||||
{
|
||||
E_Eval eval = e_eval_from_string(scratch.arena, expr);
|
||||
E_Type *type = e_type_from_key__cached(eval.irtree.type_key);
|
||||
if(type->kind != E_TypeKind_Stub)
|
||||
if(type->kind != E_TypeKind_Set)
|
||||
{
|
||||
passes_filter = 0;
|
||||
FuzzyMatchRangeList matches = fuzzy_match_find(scratch.arena, filter, expr);
|
||||
@@ -441,7 +441,7 @@ E_LOOKUP_ACCESS_FUNCTION_DEF(schema)
|
||||
}
|
||||
else if(str8_match(child_schema->first->string, str8_lit("query"), 0))
|
||||
{
|
||||
child_type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = child_schema->string);
|
||||
child_type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = child_schema->string);
|
||||
}
|
||||
|
||||
//- rjf: evaluate
|
||||
@@ -4706,7 +4706,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
E_IRTreeAndType block_irtree = e_irtree_and_type_from_expr(scratch.arena, selection_block->expr);
|
||||
E_TypeKey block_type_key = block_irtree.type_key;
|
||||
E_TypeKind block_type_kind = e_type_kind_from_key(block_type_key);
|
||||
if(block_type_kind == E_TypeKind_Stub)
|
||||
if(block_type_kind == E_TypeKind_Set)
|
||||
{
|
||||
E_Type *block_type = e_type_from_key__cached(block_type_key);
|
||||
group_cfg_name = rd_singular_from_code_name_plural(block_type->name);
|
||||
@@ -7514,8 +7514,10 @@ rd_window_frame(void)
|
||||
if(build_hover_eval)
|
||||
{
|
||||
// rjf: determine if we have a top-level visualizer
|
||||
#if 0 // TODO(rjf): @eval
|
||||
EV_ExpandRuleTagPair expand_rule_tag = ev_expand_rule_tag_pair_from_expr_irtree(hover_eval.exprs.last, &hover_eval.irtree);
|
||||
RD_ViewUIRule *view_ui_rule = rd_view_ui_rule_from_string(expand_rule_tag.rule->string);
|
||||
#endif
|
||||
RD_ViewUIRule *view_ui_rule = &rd_nil_view_ui_rule; // TODO(rjf): @eval rd_view_ui_rule_from_string(expand_rule_tag.rule->string);
|
||||
|
||||
// rjf: determine view name
|
||||
String8 view_name = str8_lit("watch");
|
||||
@@ -10418,6 +10420,7 @@ rd_append_value_strings_from_eval(Arena *arena, String8 filter, EV_StringFlags f
|
||||
B32 no_addr = 0;
|
||||
B32 no_string = 0;
|
||||
B32 has_array = 0;
|
||||
#if 0 // TODO(rjf): @eval
|
||||
for(E_Expr *tag = root_eval.exprs.last->first_tag; tag != &e_expr_nil; tag = tag->next)
|
||||
{
|
||||
if(0){}
|
||||
@@ -10436,6 +10439,7 @@ rd_append_value_strings_from_eval(Arena *arena, String8 filter, EV_StringFlags f
|
||||
min_digits = (U32)num_value_eval.value.u64;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity ||
|
||||
eval.space.kind == RD_EvalSpaceKind_MetaCfg)
|
||||
{
|
||||
@@ -10655,6 +10659,9 @@ rd_append_value_strings_from_eval(Arena *arena, String8 filter, EV_StringFlags f
|
||||
{
|
||||
// rjf: unpack
|
||||
E_IRTreeAndType irtree = eval.irtree;
|
||||
E_LookupRule *lookup_rule = &e_lookup_rule__default;
|
||||
E_Expr *lookup_rule_tag = &e_expr_nil;
|
||||
#if 0 // TODO(rjf): @eval
|
||||
E_LookupRule *lookup_rule = eval.lookup_rule_tag.rule;
|
||||
E_Expr *lookup_rule_tag = eval.lookup_rule_tag.tag;
|
||||
if(lookup_rule == &e_lookup_rule__default)
|
||||
@@ -10662,6 +10669,7 @@ rd_append_value_strings_from_eval(Arena *arena, String8 filter, EV_StringFlags f
|
||||
lookup_rule = root_eval.lookup_rule_tag.rule;
|
||||
lookup_rule_tag = root_eval.lookup_rule_tag.tag;
|
||||
}
|
||||
#endif
|
||||
E_LookupInfo lookup_info = lookup_rule->info(arena, &irtree, lookup_rule_tag, filter);
|
||||
U64 total_possible_child_count = Max(lookup_info.idxed_expr_count, lookup_info.named_expr_count);
|
||||
String8 opener_string = str8_lit("[");
|
||||
@@ -10788,11 +10796,14 @@ rd_append_value_strings_from_eval(Arena *arena, String8 filter, EV_StringFlags f
|
||||
case E_TypeKind_IncompleteStruct:
|
||||
case E_TypeKind_IncompleteUnion:
|
||||
case E_TypeKind_IncompleteClass:
|
||||
case E_TypeKind_Stub:
|
||||
case E_TypeKind_Set:
|
||||
arrays_and_sets_and_structs:
|
||||
{
|
||||
// rjf: unpack
|
||||
E_IRTreeAndType irtree = eval.irtree;
|
||||
E_LookupRule *lookup_rule = &e_lookup_rule__default;
|
||||
E_Expr *lookup_rule_tag = &e_expr_nil;
|
||||
#if 0 // TODO(rjf): @eval
|
||||
E_LookupRule *lookup_rule = eval.lookup_rule_tag.rule;
|
||||
E_Expr *lookup_rule_tag = eval.lookup_rule_tag.tag;
|
||||
if(lookup_rule == &e_lookup_rule__default)
|
||||
@@ -10800,6 +10811,7 @@ rd_append_value_strings_from_eval(Arena *arena, String8 filter, EV_StringFlags f
|
||||
lookup_rule = root_eval.lookup_rule_tag.rule;
|
||||
lookup_rule_tag = root_eval.lookup_rule_tag.tag;
|
||||
}
|
||||
#endif
|
||||
E_LookupInfo lookup_info = lookup_rule->info(arena, &irtree, lookup_rule_tag, filter);
|
||||
U64 total_possible_child_count = Max(lookup_info.idxed_expr_count, lookup_info.named_expr_count);
|
||||
String8 opener_string = str8_lit("{");
|
||||
@@ -13533,7 +13545,7 @@ rd_frame(void)
|
||||
for EachElement(idx, rd_name_schema_info_table)
|
||||
{
|
||||
String8 name = rd_name_schema_info_table[idx].name;
|
||||
E_TypeKey type_key = e_type_key_cons(.name = name, .kind = E_TypeKind_Stub);
|
||||
E_TypeKey type_key = e_type_key_cons(.name = name, .kind = E_TypeKind_Set);
|
||||
e_string2typekey_map_insert(rd_frame_arena(), rd_state->meta_name2type_map, name, type_key);
|
||||
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, name,
|
||||
.info = E_LOOKUP_INFO_FUNCTION_NAME(schema),
|
||||
@@ -13662,7 +13674,7 @@ rd_frame(void)
|
||||
{
|
||||
String8 collection_name = str8_lit("watches");
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = collection_name, .flags = E_TypeFlag_EditableChildren);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name, .flags = E_TypeFlag_EditableChildren);
|
||||
expr->space = e_space_make(RD_EvalSpaceKind_MetaQuery);
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, collection_name, expr);
|
||||
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name,
|
||||
@@ -13704,7 +13716,7 @@ rd_frame(void)
|
||||
{
|
||||
String8 collection_name = collection_infos[idx].name;
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = collection_name);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name);
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, collection_name, expr);
|
||||
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, collection_name,
|
||||
.info = collection_infos[idx].lookup_info,
|
||||
@@ -13724,7 +13736,7 @@ rd_frame(void)
|
||||
{
|
||||
String8 name = debug_info_table_collection_names[idx];
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = name);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = name);
|
||||
expr->space = e_space_make(RD_EvalSpaceKind_MetaQuery);
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, name, expr);
|
||||
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, name,
|
||||
@@ -13739,7 +13751,7 @@ rd_frame(void)
|
||||
{
|
||||
String8 cfg_name = evallable_cfg_names[cfg_name_idx];
|
||||
String8 collection_name = rd_plural_from_code_name(cfg_name);
|
||||
E_TypeKey collection_type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = collection_name);
|
||||
E_TypeKey collection_type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name);
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = collection_type_key;
|
||||
expr->space = e_space_make(RD_EvalSpaceKind_MetaQuery);
|
||||
@@ -13757,7 +13769,7 @@ rd_frame(void)
|
||||
{
|
||||
String8 kind_name = evallable_ctrl_names[ctrl_name_idx];
|
||||
String8 collection_name = rd_plural_from_code_name(kind_name);
|
||||
E_TypeKey collection_type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = collection_name);
|
||||
E_TypeKey collection_type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name);
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = collection_type_key;
|
||||
expr->space = e_space_make(RD_EvalSpaceKind_MetaQuery);
|
||||
@@ -13771,7 +13783,7 @@ rd_frame(void)
|
||||
//- rjf: add macro / lookup rules for unattached processes
|
||||
{
|
||||
String8 collection_name = str8_lit("unattached_processes");
|
||||
E_TypeKey collection_type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = collection_name);
|
||||
E_TypeKey collection_type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = collection_name);
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = collection_type_key;
|
||||
expr->space = e_space_make(RD_EvalSpaceKind_MetaCtrlEntity);
|
||||
@@ -13784,7 +13796,7 @@ rd_frame(void)
|
||||
//- rjf: add macro for commands
|
||||
{
|
||||
String8 name = str8_lit("commands");
|
||||
E_TypeKey type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = name);
|
||||
E_TypeKey type_key = e_type_key_cons(.kind = E_TypeKind_Set, .name = name);
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = type_key;
|
||||
expr->space = e_space_make(RD_EvalSpaceKind_MetaQuery);
|
||||
@@ -13912,8 +13924,7 @@ rd_frame(void)
|
||||
for EachElement(idx, view_ui_rule_table)
|
||||
{
|
||||
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, 0);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Stub, .name = str8_lit("view_rule"));
|
||||
expr->value.u64 = e_id_from_string(view_ui_rule_table[idx].name);
|
||||
expr->type_key = e_type_key_cons(.kind = E_TypeKind_Lens, .name = view_ui_rule_table[idx].name);
|
||||
e_string2expr_map_insert(scratch.arena, e_ir_state->ctx->macro_map, view_ui_rule_table[idx].name, expr);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -1002,21 +1002,21 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
}
|
||||
|
||||
// rjf: determine ctrl entity
|
||||
if(block_type_kind == E_TypeKind_Stub && (block_eval.space.kind == RD_EvalSpaceKind_MetaQuery ||
|
||||
block_eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity))
|
||||
if(block_type_kind == E_TypeKind_Set && (block_eval.space.kind == RD_EvalSpaceKind_MetaQuery ||
|
||||
block_eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity))
|
||||
{
|
||||
info.group_entity = rd_ctrl_entity_from_eval_space(info.eval.space);
|
||||
}
|
||||
|
||||
// rjf: determine cfg group name / parent
|
||||
if(block_type_kind == E_TypeKind_Stub && (block_eval.space.kind == RD_EvalSpaceKind_MetaQuery ||
|
||||
block_eval.space.kind == RD_EvalSpaceKind_MetaCfg))
|
||||
if(block_type_kind == E_TypeKind_Set && (block_eval.space.kind == RD_EvalSpaceKind_MetaQuery ||
|
||||
block_eval.space.kind == RD_EvalSpaceKind_MetaCfg))
|
||||
{
|
||||
info.group_cfg_parent = rd_cfg_from_eval_space(block_eval.space);
|
||||
}
|
||||
|
||||
// rjf: determine group cfg name
|
||||
if(block_type_kind == E_TypeKind_Stub)
|
||||
if(block_type_kind == E_TypeKind_Set)
|
||||
{
|
||||
String8 singular_name = rd_singular_from_code_name_plural(block_type->name);
|
||||
if(singular_name.size != 0)
|
||||
@@ -1070,7 +1070,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
else if(info.eval.space.kind == E_SpaceKind_FileSystem)
|
||||
{
|
||||
E_Type *type = e_type_from_key__cached(info.eval.irtree.type_key);
|
||||
if(type->kind == E_TypeKind_Stub)
|
||||
if(type->kind == E_TypeKind_Set)
|
||||
{
|
||||
String8 file_path = e_string_from_id(info.eval.value.u64);
|
||||
DR_FStrList fstrs = rd_title_fstrs_from_file_path(arena, file_path);
|
||||
@@ -1226,7 +1226,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
else if(info.eval.space.kind == RD_EvalSpaceKind_MetaCmd)
|
||||
{
|
||||
E_Type *type = e_type_from_key__cached(info.eval.irtree.type_key);
|
||||
if(type->kind == E_TypeKind_Stub)
|
||||
if(type->kind == E_TypeKind_Set)
|
||||
{
|
||||
rd_watch_cell_list_push_new(arena, &info.cells, RD_WatchCellKind_Expr, .flags = 0, .pct = 1.f);
|
||||
}
|
||||
@@ -1282,7 +1282,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row)
|
||||
}
|
||||
|
||||
// rjf: procedures collections get only expr/value/view-rule
|
||||
else if(block_type->kind == E_TypeKind_Stub && str8_match(block_type->name, str8_lit("procedures"), 0))
|
||||
else if(block_type->kind == E_TypeKind_Set && str8_match(block_type->name, str8_lit("procedures"), 0))
|
||||
{
|
||||
info.cell_style_key = str8_lit("expr_value_viewrule");
|
||||
RD_Cfg *view = rd_cfg_from_id(rd_regs()->view);
|
||||
@@ -1565,7 +1565,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
else if(result.eval.space.kind == E_SpaceKind_FileSystem)
|
||||
{
|
||||
E_Type *type = e_type_from_key__cached(result.eval.irtree.type_key);
|
||||
if(type->kind == E_TypeKind_Stub)
|
||||
if(type->kind == E_TypeKind_Set)
|
||||
{
|
||||
String8 file_path = e_string_from_id(result.eval.value.u64);
|
||||
result.fstrs = rd_title_fstrs_from_file_path(arena, file_path);
|
||||
@@ -1633,7 +1633,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla
|
||||
else if(result.eval.space.kind == E_SpaceKind_FileSystem)
|
||||
{
|
||||
E_Type *type = e_type_from_key__cached(result.eval.irtree.type_key);
|
||||
if(type->kind == E_TypeKind_Stub)
|
||||
if(type->kind == E_TypeKind_Set)
|
||||
{
|
||||
String8 file_path = e_string_from_id(result.eval.value.u64);
|
||||
result.fstrs = rd_title_fstrs_from_file_path(arena, file_path);
|
||||
|
||||
+3
-115
@@ -27,7 +27,6 @@ internal void
|
||||
entry_point(CmdLine *cmdline)
|
||||
{
|
||||
Arena *arena = arena_alloc();
|
||||
char *indent_spaces = " ";
|
||||
E_TypeCtx *type_ctx = push_array(arena, E_TypeCtx, 1);
|
||||
e_select_type_ctx(type_ctx);
|
||||
E_ParseCtx *parse_ctx = push_array(arena, E_ParseCtx, 1);
|
||||
@@ -42,122 +41,11 @@ entry_point(CmdLine *cmdline)
|
||||
str8_lit("1 + 2"),
|
||||
str8_lit("foo"),
|
||||
str8_lit("foo(bar)"),
|
||||
str8_lit("foo(bar(baz))"),
|
||||
};
|
||||
for EachElement(idx, exprs)
|
||||
{
|
||||
//- rjf: begin expression
|
||||
String8 expr_text = exprs[idx];
|
||||
raddbg_log("`%S`\n", expr_text);
|
||||
|
||||
//- rjf: tokenize
|
||||
E_TokenArray tokens = e_token_array_from_text(arena, expr_text);
|
||||
raddbg_log(" tokens:\n");
|
||||
for EachIndex(idx, tokens.count)
|
||||
{
|
||||
E_Token token = tokens.v[idx];
|
||||
String8 token_string = str8_substr(expr_text, token.range);
|
||||
raddbg_log(" %S: `%S`\n", e_token_kind_strings[token.kind], token_string);
|
||||
}
|
||||
|
||||
//- rjf: parse
|
||||
E_Parse parse = e_parse_expr_from_text_tokens(arena, expr_text, tokens);
|
||||
{
|
||||
typedef struct Task Task;
|
||||
struct Task
|
||||
{
|
||||
Task *next;
|
||||
E_Expr *expr;
|
||||
S32 indent;
|
||||
};
|
||||
raddbg_log(" expr:\n");
|
||||
Task start_task = {0, parse.exprs.first, 2};
|
||||
Task *first_task = &start_task;
|
||||
for(Task *t = first_task; t != 0; t = t->next)
|
||||
{
|
||||
E_Expr *expr = t->expr;
|
||||
raddbg_log("%.*s%S", (int)t->indent*4, indent_spaces, e_expr_kind_strings[expr->kind]);
|
||||
switch(expr->kind)
|
||||
{
|
||||
default:{}break;
|
||||
case E_ExprKind_LeafU64:
|
||||
{
|
||||
raddbg_log(" (%I64u)", expr->value.u64);
|
||||
}break;
|
||||
case E_ExprKind_LeafIdentifier:
|
||||
{
|
||||
raddbg_log(" (`%S`)", expr->string);
|
||||
}break;
|
||||
}
|
||||
raddbg_log("\n");
|
||||
Task *last_task = t;
|
||||
for(E_Expr *child = expr->first; child != &e_expr_nil; child = child->next)
|
||||
{
|
||||
Task *task = push_array(arena, Task, 1);
|
||||
task->next = last_task->next;
|
||||
last_task->next = task;
|
||||
task->expr = child;
|
||||
task->indent = t->indent+1;
|
||||
last_task = task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: type
|
||||
E_IRTreeAndType irtree = e_irtree_and_type_from_expr(arena, parse.exprs.first);
|
||||
{
|
||||
raddbg_log(" type:\n");
|
||||
S32 indent = 2;
|
||||
for(E_TypeKey type_key = irtree.type_key;
|
||||
!e_type_key_match(e_type_key_zero(), type_key);
|
||||
type_key = e_type_direct_from_key(type_key),
|
||||
indent += 1)
|
||||
{
|
||||
E_Type *type = e_type_from_key(arena, type_key);
|
||||
raddbg_log("%.*s%S\n", (int)indent*4, indent_spaces, e_type_kind_basic_string_table[type->kind]);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: irtree
|
||||
{
|
||||
typedef struct Task Task;
|
||||
struct Task
|
||||
{
|
||||
Task *next;
|
||||
E_IRNode *irnode;
|
||||
S32 indent;
|
||||
};
|
||||
raddbg_log(" ir_tree:\n");
|
||||
Task start_task = {0, irtree.root, 2};
|
||||
Task *first_task = &start_task;
|
||||
for(Task *t = first_task; t != 0; t = t->next)
|
||||
{
|
||||
E_IRNode *irnode = t->irnode;
|
||||
raddbg_log("%.*s", (int)t->indent*4, indent_spaces);
|
||||
switch(irnode->op)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name) case RDI_EvalOp_##name:{raddbg_log(#name);}break;
|
||||
RDI_EvalOp_XList
|
||||
#undef X
|
||||
}
|
||||
if(irnode->value.u64 != 0)
|
||||
{
|
||||
raddbg_log(" (%I64u)", irnode->value.u64);
|
||||
}
|
||||
raddbg_log("\n");
|
||||
Task *last_task = t;
|
||||
for(E_IRNode *child = irnode->first; child != &e_irnode_nil; child = child->next)
|
||||
{
|
||||
Task *task = push_array(arena, Task, 1);
|
||||
task->next = last_task->next;
|
||||
last_task->next = task;
|
||||
task->irnode = child;
|
||||
task->indent = t->indent+1;
|
||||
last_task = task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
raddbg_log("\n");
|
||||
String8 debug_string = e_debug_log_from_expr_string(arena, exprs[idx]);
|
||||
raddbg_log("%S", debug_string);
|
||||
}
|
||||
}
|
||||
|
||||
+89
-13
@@ -16,12 +16,20 @@
|
||||
#include "os/os_inc.h"
|
||||
#include "path/path.h"
|
||||
#include "hash_store/hash_store.h"
|
||||
#include "rdi_format/rdi_format_local.h"
|
||||
#include "regs/regs.h"
|
||||
#include "regs/rdi/regs_rdi.h"
|
||||
#include "eval/eval_inc.h"
|
||||
|
||||
//- rjf: [c]
|
||||
#include "base/base_inc.c"
|
||||
#include "os/os_inc.c"
|
||||
#include "path/path.c"
|
||||
#include "hash_store/hash_store.c"
|
||||
#include "rdi_format/rdi_format_local.c"
|
||||
#include "regs/regs.c"
|
||||
#include "regs/rdi/regs_rdi.c"
|
||||
#include "eval/eval_inc.c"
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Entry Points
|
||||
@@ -32,6 +40,14 @@ internal void
|
||||
entry_point(CmdLine *cmdline)
|
||||
{
|
||||
Arena *arena = arena_alloc();
|
||||
E_TypeCtx *type_ctx = push_array(arena, E_TypeCtx, 1);
|
||||
e_select_type_ctx(type_ctx);
|
||||
E_ParseCtx *parse_ctx = push_array(arena, E_ParseCtx, 1);
|
||||
e_select_parse_ctx(parse_ctx);
|
||||
E_IRCtx *ir_ctx = push_array(arena, E_IRCtx, 1);
|
||||
e_select_ir_ctx(ir_ctx);
|
||||
E_InterpretCtx *interpret_ctx = push_array(arena, E_InterpretCtx, 1);
|
||||
e_select_interpret_ctx(interpret_ctx, 0, 0);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack command line
|
||||
@@ -49,14 +65,31 @@ entry_point(CmdLine *cmdline)
|
||||
String8 artifacts_path = path_normalized_from_string(arena, str8_lit("./tester_artifacts"));
|
||||
os_make_directory(artifacts_path);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: set up list of test artifacts
|
||||
//
|
||||
typedef struct Test Test;
|
||||
struct Test
|
||||
{
|
||||
Test *next;
|
||||
String8 name;
|
||||
String8List out;
|
||||
B32 good;
|
||||
};
|
||||
Test *first_test = 0;
|
||||
Test *last_test = 0;
|
||||
#define Test(name_identifier) \
|
||||
Test *test_##name_identifier = push_array(arena, Test, 1);\
|
||||
test_##name_identifier->name = str8_lit(#name_identifier);\
|
||||
test_##name_identifier->good = 1;\
|
||||
SLLQueuePush(first_test, last_test, test_##name_identifier);\
|
||||
for(Test *test = test_##name_identifier; test != 0; test = 0)
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: PDB -> RDI determinism
|
||||
//
|
||||
String8 name = {0};
|
||||
B32 good = 1;
|
||||
String8List out = {0};
|
||||
Test(pdb2rdi_determinism)
|
||||
{
|
||||
name = str8_lit("pdb2rdi_determinism");
|
||||
U64 num_repeats_per_pdb = 32;
|
||||
String8 pdb_paths[] =
|
||||
{
|
||||
@@ -67,7 +100,7 @@ entry_point(CmdLine *cmdline)
|
||||
{
|
||||
// rjf: unpack paths, make output directory
|
||||
String8 pdb_path = path_normalized_from_string(arena, pdb_paths[pdb_idx]);
|
||||
String8 repeat_folder = push_str8f(arena, "%S/%S", artifacts_path, name);
|
||||
String8 repeat_folder = push_str8f(arena, "%S/%S", artifacts_path, test->name);
|
||||
os_make_directory(repeat_folder);
|
||||
|
||||
// rjf: generate all RDIs
|
||||
@@ -157,29 +190,72 @@ entry_point(CmdLine *cmdline)
|
||||
// rjf: output bad case info
|
||||
if(!matches)
|
||||
{
|
||||
good = 0;
|
||||
str8_list_pushf(arena, &out, " pdb[%I64u] \"%S\"\n", pdb_idx, pdb_path);
|
||||
test->good = 0;
|
||||
str8_list_pushf(arena, &test->out, " pdb[%I64u] \"%S\"\n", pdb_idx, pdb_path);
|
||||
for EachIndex(idx, rdi_hashes_count)
|
||||
{
|
||||
str8_list_pushf(arena, &out, " rdi[%I64u] \"%S\": 0x%I64x:%I64x\n", idx, rdi_paths_array[idx], rdi_hashes[idx].u64[0], rdi_hashes[idx].u64[1]);
|
||||
str8_list_pushf(arena, &test->out, " rdi[%I64u] \"%S\": 0x%I64x:%I64x\n", idx, rdi_paths_array[idx], rdi_hashes[idx].u64[0], rdi_hashes[idx].u64[1]);
|
||||
}
|
||||
for EachIndex(idx, dump_hashes_count)
|
||||
{
|
||||
str8_list_pushf(arena, &out, " dump[%I64u] \"%S\": 0x%I64x:%I64x\n", idx, dump_paths_array[idx], dump_hashes[idx].u64[0], dump_hashes[idx].u64[1]);
|
||||
str8_list_pushf(arena, &test->out, " dump[%I64u] \"%S\": 0x%I64x:%I64x\n", idx, dump_paths_array[idx], dump_hashes[idx].u64[0], dump_hashes[idx].u64[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: eval compiler basics
|
||||
//
|
||||
Test(eval_compiler_basics)
|
||||
{
|
||||
String8 exprs[] =
|
||||
{
|
||||
str8_lit("123"),
|
||||
str8_lit("1 + 2"),
|
||||
str8_lit("foo"),
|
||||
str8_lit("foo(bar)"),
|
||||
str8_lit("foo(bar(baz))"),
|
||||
};
|
||||
String8List logs = {0};
|
||||
for EachElement(idx, exprs)
|
||||
{
|
||||
String8 log = e_debug_log_from_expr_string(arena, exprs[idx]);
|
||||
str8_list_push(arena, &logs, log);
|
||||
}
|
||||
String8 log = str8_list_join(arena, &logs, 0);
|
||||
String8 test_artifacts_path = push_str8f(arena, "%S/%S", artifacts_path, test->name);
|
||||
os_make_directory(test_artifacts_path);
|
||||
String8 current_file_path = push_str8f(arena, "%S/current.txt", test_artifacts_path);
|
||||
String8 correct_file_path = push_str8f(arena, "%S/%S/correct.txt", test_data_folder_path, test->name);
|
||||
os_write_data_to_file_path(current_file_path, log);
|
||||
String8 current_file_data = log;
|
||||
String8 correct_file_data = os_data_from_file_path(arena, correct_file_path);
|
||||
test->good = str8_match(correct_file_data, current_file_data, 0);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump results
|
||||
//
|
||||
fprintf(stderr, "[%s] \"%.*s\"\n", good ? "." : "X", str8_varg(name));
|
||||
if(!good)
|
||||
B32 all_good = 1;
|
||||
for(Test *t = first_test; t != 0; t = t->next)
|
||||
{
|
||||
for(String8Node *n = out.first; n != 0; n = n->next)
|
||||
if(!t->good)
|
||||
{
|
||||
fprintf(stderr, "%.*s", str8_varg(n->string));
|
||||
all_good = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "[%s]\n", all_good ? "." : "X");
|
||||
for(Test *t = first_test; t != 0; t = t->next)
|
||||
{
|
||||
fprintf(stderr, " [%s] \"%.*s\"\n", t->good ? "." : "X", str8_varg(t->name));
|
||||
if(!t->good)
|
||||
{
|
||||
for(String8Node *n = t->out.first; n != 0; n = n->next)
|
||||
{
|
||||
fprintf(stderr, " %.*s", str8_varg(n->string));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user