aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-12-31 12:15:19 +0000
committergingerBill <bill@gingerbill.org>2019-12-31 12:15:19 +0000
commitab52f8d795ca836925162b8ba92d0a77ea7db50a (patch)
tree467d59e7ebb3f71523b6fc2041409654cd9cdcde /src/ir.cpp
parent7e271310ff7a844270a981bb8fc1f961bb45f319 (diff)
Move definition of mem.Allocator and log.Logger to `package runtime`, to reduce import cycle magic
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index dd9ba73cc..b0d43d7f4 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -3006,11 +3006,13 @@ void ir_emit_zero_init(irProcedure *p, irValue *address, Ast *expr) {
auto args = array_make<irValue *>(a, 2);
args[0] = ir_emit_conv(p, address, t_rawptr);
args[1] = ir_const_int(type_size_of(t));
- AstPackage *pkg = get_core_package(p->module->info, str_lit("mem"));
- if (p->entity != nullptr && p->entity->token.string != "zero" && p->entity->pkg != pkg) {
- ir_emit_comment(p, str_lit("ZeroInit"));
- irValue *v = ir_emit_package_call(p, "mem", "zero", args, expr);
- return;
+ AstPackage *pkg_runtime = get_core_package(p->module->info, str_lit("runtime"));
+ if (p->entity != nullptr) {
+ if (p->entity->pkg != pkg_runtime && p->entity->token.string != "mem_zero") {
+ ir_emit_comment(p, str_lit("ZeroInit"));
+ irValue *v = ir_emit_package_call(p, "runtime", "mem_zero", args, expr);
+ return;
+ }
}
}
ir_emit(p, ir_instr_zero_init(p, address));
@@ -3254,7 +3256,7 @@ irValue *ir_emit_package_call(irProcedure *proc, char const *package_name_, char
AstPackage *p = get_core_package(proc->module->info, package_name);
Entity *e = scope_lookup_current(p->scope, name);
irValue **found = map_get(&proc->module->values, hash_entity(e));
- GB_ASSERT_MSG(found != nullptr, "%.*s", LIT(name));
+ GB_ASSERT_MSG(found != nullptr, "%s.%.*s", package_name_, LIT(name));
irValue *gp = *found;
irValue *call = ir_emit_call(proc, gp, args, inlining);
return call;