aboutsummaryrefslogtreecommitdiff
path: root/src/list.hpp
diff options
context:
space:
mode:
authorMichael Dusan <michael.dusan@gmail.com>2020-02-10 21:08:08 -0500
committerMichael Dusan <michael.dusan@gmail.com>2020-02-10 21:08:08 -0500
commitedb210905dcbe666fa5222bceacd2e5bdb16bb89 (patch)
tree984aec0e5bad756daf426855c54bae3c42c73eca /src/list.hpp
parent1cdefeb10b7496126bbb7d00709235abfee56a4a (diff)
downloadzig-edb210905dcbe666fa5222bceacd2e5bdb16bb89.tar.gz
zig-edb210905dcbe666fa5222bceacd2e5bdb16bb89.zip
stage1: memory/report overhaul
- split util_base.hpp from util.hpp - new namespaces: `mem` and `heap` - new `mem::Allocator` interface - new `heap::CAllocator` impl with global `heap::c_allocator` - new `heap::ArenaAllocator` impl - new `mem::TypeInfo` extracts names without RTTI - name extraction is enabled w/ ZIG_ENABLE_MEM_PROFILE=1 - new `mem::List` takes explicit `Allocator&` parameter - new `mem::HashMap` takes explicit `Allocator&` parameter - add Codegen.pass1_arena and use for all `ZigValue` allocs - deinit Codegen.pass1_arena early in `zig_llvm_emit_output()`
Diffstat (limited to 'src/list.hpp')
-rw-r--r--src/list.hpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/list.hpp b/src/list.hpp
index 4b2833843b..2c6d90c855 100644
--- a/src/list.hpp
+++ b/src/list.hpp
@@ -13,7 +13,7 @@
template<typename T>
struct ZigList {
void deinit() {
- deallocate(items, capacity);
+ heap::c_allocator.deallocate(items, capacity);
}
void append(const T& item) {
ensure_capacity(length + 1);
@@ -70,7 +70,7 @@ struct ZigList {
better_capacity = better_capacity * 5 / 2 + 8;
} while (better_capacity < new_capacity);
- items = reallocate_nonzero(items, capacity, better_capacity);
+ items = heap::c_allocator.reallocate_nonzero(items, capacity, better_capacity);
capacity = better_capacity;
}
@@ -91,5 +91,3 @@ struct ZigList {
};
#endif
-
-