aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-09-15 10:46:46 +0100
committergingerBill <bill@gingerbill.org>2018-09-15 10:46:46 +0100
commit71d987bd2eece5a30f4c872f91f9b08a06efc873 (patch)
treebab662631fd0f723847bbc024e13ec827ad16788 /src
parent637899467c2329ad0f405ae5d4d6e76e1b091243 (diff)
Fix runtime proc names; Change calling convention of `context` parameter
Diffstat (limited to 'src')
-rw-r--r--src/check_expr.cpp14
-rw-r--r--src/check_type.cpp2
-rw-r--r--src/ir.cpp8
-rw-r--r--src/ir_print.cpp12
4 files changed, 16 insertions, 20 deletions
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, ") ");