diff --git a/core/runtime/core.odin b/core/runtime/core.odin index 23b462c79..bfe28aafa 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -196,7 +196,6 @@ Context :: struct { user_data: any, user_index: int, - parent: ^Context, derived: any, // May be used for derived data types } @@ -734,7 +733,7 @@ __get_map_key :: proc "contextless" (key: $K) -> Map_Key { } -__default_hash :: proc(data: []byte) -> u64 { +default_hash :: proc(data: []byte) -> u64 { fnv64a :: proc(data: []byte) -> u64 { h: u64 = 0xcbf29ce484222325; for b in data { @@ -744,7 +743,8 @@ __default_hash :: proc(data: []byte) -> u64 { } return fnv64a(data); } -__default_hash_string :: proc(s: string) -> u64 do return __default_hash(([]byte)(s)); +default_hash_string :: proc(s: string) -> u64 do return default_hash(([]byte)(s)); + __slice_resize :: proc(array_: ^$T/[]$E, new_count: int, allocator: mem.Allocator, loc := #caller_location) -> bool { array := (^mem.Raw_Slice)(array_); diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 4f825b32f..78f200a21 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -2069,7 +2069,7 @@ void check_binary_expr(CheckerContext *c, Operand *x, Ast *node, bool use_lhs_as Type *yt = base_type(y->type); check_assignment(c, x, yt->Map.key, str_lit("map 'in'")); - add_package_dependency(c, "runtime", "dynamic_map_get"); + add_package_dependency(c, "runtime", "__dynamic_map_get"); } else if (is_type_bit_set(y->type)) { Type *yt = base_type(y->type); check_assignment(c, x, yt->BitSet.elem, str_lit("bit_set 'in'")); @@ -5517,8 +5517,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type context_name = str_lit("dynamic array literal"); is_constant = false; - add_package_dependency(c, "runtime", "dynamic_array_reserve"); - add_package_dependency(c, "runtime", "dynamic_array_append"); + add_package_dependency(c, "runtime", "__dynamic_array_reserve"); + add_package_dependency(c, "runtime", "__dynamic_array_append"); } else { GB_PANIC("unreachable"); } @@ -5677,8 +5677,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type } } - add_package_dependency(c, "runtime", "dynamic_map_reserve"); - add_package_dependency(c, "runtime", "dynamic_map_set"); + add_package_dependency(c, "runtime", "__dynamic_map_reserve"); + add_package_dependency(c, "runtime", "__dynamic_map_set"); break; } @@ -5959,8 +5959,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type o->type = t->Map.value; o->expr = node; - add_package_dependency(c, "runtime", "dynamic_map_get"); - add_package_dependency(c, "runtime", "dynamic_map_set"); + add_package_dependency(c, "runtime", "__dynamic_map_get"); + add_package_dependency(c, "runtime", "__dynamic_map_set"); return Expr_Expr; } diff --git a/src/check_type.cpp b/src/check_type.cpp index 993db6ff1..63c05ee7c 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2199,7 +2199,7 @@ void check_map_type(CheckerContext *ctx, Type *type, Ast *node) { type->Map.value = value; if (is_type_string(key)) { - add_package_dependency(ctx, "runtime", "__default_hash_string"); + add_package_dependency(ctx, "runtime", "default_hash_string"); } diff --git a/src/ir.cpp b/src/ir.cpp index dbde6242f..8aca9fbfa 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -2090,17 +2090,9 @@ void ir_addr_store(irProcedure *proc, irAddr const &addr, irValue *value) { } else if (addr.kind == irAddr_Context) { irValue *new_context = ir_emit_conv(proc, value, ir_addr_type(addr)); - irValue *prev = ir_find_or_generate_context_ptr(proc); - GB_ASSERT(addr.addr == prev); - irValue *next = ir_add_local_generated(proc, t_context); ir_emit_store(proc, next, new_context); - Selection sel = lookup_field(t_context, str_lit("parent"), false); - GB_ASSERT(sel.entity != nullptr); - irValue *parent_ptr = ir_emit_deep_field_gep(proc, next, sel); - ir_emit_store(proc, parent_ptr, prev); - ir_push_context_onto_stack(proc, next); return; diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 6d3084de9..5796845fb 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -959,6 +959,11 @@ void ir_print_calling_convention(irFileBuffer *f, irModule *m, ProcCallingConven } } +void ir_print_context_parameter_prefix(irFileBuffer *f, irModule *m) { + ir_print_type(f, m, t_context_ptr); + ir_write_str_lit(f, " noalias nonnull nocapture inreg "); +} + void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { GB_ASSERT(value->kind == irValue_Instr); irInstr *instr = &value->Instr; @@ -1469,8 +1474,7 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { if (proc_type->Proc.calling_convention == ProcCC_Odin) { if (param_index > 0) ir_write_str_lit(f, ", "); - ir_print_type(f, m, t_context_ptr); - ir_write_str_lit(f, " noalias nonnull "); + ir_print_context_parameter_prefix(f, m); ir_print_value(f, m, call->context_ptr, t_context_ptr); } ir_write_str_lit(f, ")"); @@ -1611,8 +1615,8 @@ void ir_print_proc(irFileBuffer *f, irModule *m, irProcedure *proc) { if (proc_type->calling_convention == ProcCC_Odin) { if (param_index > 0) ir_write_str_lit(f, ", "); - ir_print_type(f, m, t_context_ptr); - ir_write_str_lit(f, " noalias nonnull %__.context_ptr"); + ir_print_context_parameter_prefix(f, m); + ir_write_str_lit(f, "%__.context_ptr"); } ir_write_str_lit(f, ") ");