aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-01-31 18:27:08 +0000
committergingerBill <bill@gingerbill.org>2018-01-31 18:27:08 +0000
commit028d628e9f4bef24b9a70f2b5ae7bcf0260d5a65 (patch)
treeb4cb8d145959c563f5db02c2ed45cc2741b7840e
parent5e4b62acfe658606f140fc5516958df9e30e471b (diff)
Add extra zero init for IR
-rw-r--r--core/_preload.odin10
-rw-r--r--core/fmt.odin3
-rw-r--r--src/ir.cpp8
3 files changed, 10 insertions, 11 deletions
diff --git a/core/_preload.odin b/core/_preload.odin
index 234c064fd..7d39172db 100644
--- a/core/_preload.odin
+++ b/core/_preload.odin
@@ -639,8 +639,7 @@ __print_type :: proc(fd: os.Handle, ti: ^Type_Info) {
case uint: os.write_string(fd, "uint");
case uintptr: os.write_string(fd, "uintptr");
case:
- if info.signed do os.write_byte(fd, 'i');
- else do os.write_byte(fd, 'u');
+ os.write_byte(fd, info.signed ? 'i' : 'u');
__print_u64(fd, u64(8*ti.size));
}
case Type_Info_Rune:
@@ -785,8 +784,8 @@ assert :: proc "contextless" (condition: bool, message := "", using loc := #call
if len(message) > 0 {
os.write_string(fd, ": ");
os.write_string(fd, message);
- os.write_byte(fd, '\n');
}
+ os.write_byte(fd, '\n');
__debug_trap();
}
return condition;
@@ -799,8 +798,8 @@ panic :: proc "contextless" (message := "", using loc := #caller_location) {
if len(message) > 0 {
os.write_string(fd, ": ");
os.write_string(fd, message);
- os.write_byte(fd, '\n');
}
+ os.write_byte(fd, '\n');
__debug_trap();
}
@@ -1230,7 +1229,8 @@ __dynamic_map_set :: proc(h: __Map_Header, key: __Map_Key, value: rawptr, loc :=
__dynamic_map_grow :: proc(using h: __Map_Header, loc := #caller_location) {
- new_count := max(2*m.entries.cap + 8, __INITIAL_MAP_CAP);
+ // TODO(bill): Determine an efficient growing rate
+ new_count := max(4*m.entries.cap + 7, __INITIAL_MAP_CAP);
__dynamic_map_rehash(h, new_count, loc);
}
diff --git a/core/fmt.odin b/core/fmt.odin
index 3d6ce70ee..9c9c8d374 100644
--- a/core/fmt.odin
+++ b/core/fmt.odin
@@ -165,8 +165,7 @@ write_type :: proc(buf: ^String_Buffer, ti: ^Type_Info) {
case uint: write_string(buf, "uint");
case uintptr: write_string(buf, "uintptr");
case:
- if info.signed do write_byte(buf, 'i');
- else do write_byte(buf, 'u');
+ write_byte(buf, info.signed ? 'i' : 'u');
write_i64(buf, i64(8*ti.size), 10);
}
case Type_Info_Rune:
diff --git a/src/ir.cpp b/src/ir.cpp
index d68cae587..854f7f521 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -778,7 +778,7 @@ Array<irValue *> *ir_value_referrers(irValue *v) {
////////////////////////////////////////////////////////////////
void ir_module_add_value (irModule *m, Entity *e, irValue *v);
-irValue *ir_emit_zero_init (irProcedure *p, irValue *address, AstNode *expr);
+void ir_emit_zero_init (irProcedure *p, irValue *address, AstNode *expr);
irValue *ir_emit_comment (irProcedure *p, String text);
irValue *ir_emit_store (irProcedure *p, irValue *address, irValue *value);
irValue *ir_emit_load (irProcedure *p, irValue *address);
@@ -1595,14 +1595,14 @@ void ir_add_debug_location_to_value(irProcedure *proc, irValue *v, AstNode *e) {
}
}
-irValue *ir_emit_zero_init(irProcedure *p, irValue *address, AstNode *expr) {
+void ir_emit_zero_init(irProcedure *p, irValue *address, AstNode *expr) {
gbAllocator a = p->module->allocator;
Type *t = type_deref(ir_type(address));
irValue **args = gb_alloc_array(a, irValue *, 2);
args[0] = ir_emit_conv(p, address, t_rawptr);
args[1] = ir_const_int(a, type_size_of(a, t));
- return ir_emit_global_call(p, "__mem_zero", args, 2, expr);
- // return ir_emit(p, ir_instr_zero_init(p, address));
+ ir_emit(p, ir_instr_zero_init(p, address));
+ ir_emit_global_call(p, "__mem_zero", args, 2, expr);
}
irValue *ir_emit_comment(irProcedure *p, String text) {