aboutsummaryrefslogtreecommitdiff
path: root/core/runtime
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-07-08 11:03:56 +0100
committergingerBill <bill@gingerbill.org>2018-07-08 11:03:56 +0100
commit0e91298fd1d16de9bc0c11b9ccf0dcd7e43603a2 (patch)
tree453c6f5960ee3eb2dc52a01524f0de8251b0acee /core/runtime
parente515220694c79f44f0ee2783287667dc4ab5e5fe (diff)
Rename `free` to `delete` for non pointer types
Diffstat (limited to 'core/runtime')
-rw-r--r--core/runtime/core.odin43
-rw-r--r--core/runtime/internal.odin8
2 files changed, 22 insertions, 29 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin
index 7546d6648..d1f9994c0 100644
--- a/core/runtime/core.odin
+++ b/core/runtime/core.odin
@@ -254,10 +254,10 @@ foreign {
assume :: proc(cond: bool) ---;
@(link_name="llvm.debugtrap")
- __debug_trap :: proc() ---;
+ debug_trap :: proc() ---;
@(link_name="llvm.trap")
- __trap :: proc() ---;
+ trap :: proc() ---;
@(link_name="llvm.readcyclecounter")
read_cycle_counter :: proc() -> u64 ---;
@@ -309,29 +309,22 @@ reserve :: proc[reserve_dynamic_array, reserve_map];
@(builtin)
-new :: inline proc(T: type, loc := #caller_location) -> ^T {
- ptr := (^T)(mem.alloc(size_of(T), align_of(T), loc));
- ptr^ = T{};
- return ptr;
-}
+new :: proc[mem.new];
@(builtin)
-new_clone :: inline proc(data: $T, loc := #caller_location) -> ^T {
- ptr := (^T)(mem.alloc(size_of(T), align_of(T), loc));
- ptr^ = data;
- return ptr;
-}
+new_clone :: proc[mem.new_clone];
@(builtin)
-free :: proc[
- mem.free_ptr,
- mem.free_string,
- mem.free_cstring,
- mem.free_dynamic_array,
- mem.free_slice,
- mem.free_map,
-];
+free :: proc[mem.free];
+@(builtin)
+delete :: proc[
+ mem.delete_string,
+ mem.delete_cstring,
+ mem.delete_dynamic_array,
+ mem.delete_slice,
+ mem.delete_map,
+];
@@ -351,8 +344,8 @@ reserve_map :: proc(m: ^$T/map[$K]$V, capacity: int) {
}
@(builtin)
-delete :: proc(m: ^$T/map[$K]$V, key: K) {
- if m != nil do __dynamic_map_delete(__get_map_header(m), __get_map_key(key));
+delete_key :: proc(m: ^$T/map[$K]$V, key: K) {
+ if m != nil do __dynamic_map_delete_key(__get_map_header(m), __get_map_key(key));
}
@@ -436,7 +429,7 @@ assert :: proc "contextless" (condition: bool, message := "", using loc := #call
os.write_string(fd, message);
}
os.write_byte(fd, '\n');
- __debug_trap();
+ debug_trap();
}
return condition;
}
@@ -451,7 +444,7 @@ panic :: proc "contextless" (message := "", using loc := #caller_location) {
os.write_string(fd, message);
}
os.write_byte(fd, '\n');
- __debug_trap();
+ debug_trap();
}
@@ -742,7 +735,7 @@ __dynamic_map_add_entry :: proc(using h: Map_Header, key: Map_Key, loc := #calle
return prev;
}
-__dynamic_map_delete :: proc(using h: Map_Header, key: Map_Key) {
+__dynamic_map_delete_key :: proc(using h: Map_Header, key: Map_Key) {
fr := __dynamic_map_find(h, key);
if fr.entry_index >= 0 {
__dynamic_map_erase(h, fr);
diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin
index 7f38bb7ce..9ef0277db 100644
--- a/core/runtime/internal.odin
+++ b/core/runtime/internal.odin
@@ -259,7 +259,7 @@ bounds_check_error :: proc "contextless" (file: string, line, column: int, index
os.write_string(fd, " is out of bounds range 0..");
__print_i64(fd, i64(count));
os.write_byte(fd, '\n');
- __debug_trap();
+ debug_trap();
}
slice_expr_error :: proc "contextless" (file: string, line, column: int, lo, hi: int, len: int) {
@@ -275,7 +275,7 @@ slice_expr_error :: proc "contextless" (file: string, line, column: int, lo, hi:
os.write_string(fd, "..");
__print_i64(fd, i64(len));
os.write_byte(fd, '\n');
- __debug_trap();
+ debug_trap();
}
dynamic_array_expr_error :: proc "contextless" (file: string, line, column: int, low, high, max: int) {
@@ -290,7 +290,7 @@ dynamic_array_expr_error :: proc "contextless" (file: string, line, column: int,
os.write_string(fd, "..");
__print_i64(fd, i64(max));
os.write_byte(fd, '\n');
- __debug_trap();
+ debug_trap();
}
type_assertion_check :: proc "contextless" (ok: bool, file: string, line, column: int, from, to: typeid) {
@@ -303,7 +303,7 @@ type_assertion_check :: proc "contextless" (ok: bool, file: string, line, column
os.write_string(fd, " to ");
__print_typeid(fd, to);
os.write_byte(fd, '\n');
- __debug_trap();
+ debug_trap();
}
__string_decode_rune :: inline proc "contextless" (s: string) -> (rune, int) {