fix cross-module global evaluation with new multi-module-capable eval system

This commit is contained in:
Ryan Fleury
2024-10-13 19:25:42 -07:00
parent b45462c740
commit ba0e4ea0c5
3 changed files with 12 additions and 4 deletions
+2 -2
View File
@@ -1483,7 +1483,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
U32 match_idx = matches[matches_count-1];
RDI_GlobalVariable *global_var = rdi_element_from_name_idx(rdi, GlobalVariables, match_idx);
E_OpList oplist = {0};
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ModuleOff, e_value_u64(global_var->voff));
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU64, e_value_u64(module->vaddr_range.min + global_var->voff));
loc_kind = RDI_LocationKind_AddrBytecodeStream;
loc_bytecode = e_bytecode_from_oplist(arena, &oplist);
U32 type_idx = global_var->type_idx;
@@ -1565,7 +1565,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, procedure->root_scope_idx);
U64 voff = *rdi_element_from_name_idx(rdi, ScopeVOffData, scope->voff_range_first);
E_OpList oplist = {0};
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ModuleOff, e_value_u64(voff));
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU64, e_value_u64(module->vaddr_range.min + voff));
loc_kind = RDI_LocationKind_ValBytecodeStream;
loc_bytecode = e_bytecode_from_oplist(arena, &oplist);
U32 type_idx = procedure->type_idx;
+8
View File
@@ -31,6 +31,11 @@ struct Basics
int d;
};
static OnlyInModule only_in_module_global =
{
1, 2, 3, "foobar",
};
thread_var float tls_a = 1.015625f;
thread_var int tls_b = -100;
@@ -39,6 +44,9 @@ dll_tls_eval_test(void)
{
tls_a *= 1.5f;
tls_b *= -2;
only_in_module_global.x += 1;
only_in_module_global.y += 2;
only_in_module_global.z += 3;
}
export_function void
+2 -2
View File
@@ -9102,7 +9102,7 @@ rd_ev_view_rule_expr_expand_range_info__debug_info_tables(Arena *arena, EV_View
RDI_Scope *scope = rdi_element_from_name_idx(module->rdi, Scopes, procedure->root_scope_idx);
U64 voff = *rdi_element_from_name_idx(module->rdi, ScopeVOffData, scope->voff_range_first);
E_OpList oplist = {0};
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ModuleOff, e_value_u64(voff));
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU64, e_value_u64(module->vaddr_range.min + voff));
String8 bytecode = e_bytecode_from_oplist(arena, &oplist);
U32 type_idx = procedure->type_idx;
RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, type_idx);
@@ -9119,7 +9119,7 @@ rd_ev_view_rule_expr_expand_range_info__debug_info_tables(Arena *arena, EV_View
RDI_GlobalVariable *gvar = rdi_element_from_name_idx(module->rdi, GlobalVariables, element_idx);
U64 voff = gvar->voff;
E_OpList oplist = {0};
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ModuleOff, e_value_u64(voff));
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU64, e_value_u64(module->vaddr_range.min + voff));
String8 bytecode = e_bytecode_from_oplist(arena, &oplist);
U32 type_idx = gvar->type_idx;
RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, type_idx);