diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2020-02-10 21:08:08 -0500 |
|---|---|---|
| committer | Michael Dusan <michael.dusan@gmail.com> | 2020-02-10 21:08:08 -0500 |
| commit | edb210905dcbe666fa5222bceacd2e5bdb16bb89 (patch) | |
| tree | 984aec0e5bad756daf426855c54bae3c42c73eca /src/glibc.cpp | |
| parent | 1cdefeb10b7496126bbb7d00709235abfee56a4a (diff) | |
| download | zig-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/glibc.cpp')
| -rw-r--r-- | src/glibc.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/glibc.cpp b/src/glibc.cpp index 08faf6fb60..ec45b6afa7 100644 --- a/src/glibc.cpp +++ b/src/glibc.cpp @@ -21,7 +21,7 @@ static const ZigGLibCLib glibc_libs[] = { Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbose) { Error err; - ZigGLibCAbi *glibc_abi = allocate<ZigGLibCAbi>(1); + ZigGLibCAbi *glibc_abi = heap::c_allocator.create<ZigGLibCAbi>(); glibc_abi->vers_txt_path = buf_sprintf("%s" OS_SEP "libc" OS_SEP "glibc" OS_SEP "vers.txt", buf_ptr(zig_lib_dir)); glibc_abi->fns_txt_path = buf_sprintf("%s" OS_SEP "libc" OS_SEP "glibc" OS_SEP "fns.txt", buf_ptr(zig_lib_dir)); glibc_abi->abi_txt_path = buf_sprintf("%s" OS_SEP "libc" OS_SEP "glibc" OS_SEP "abi.txt", buf_ptr(zig_lib_dir)); @@ -100,10 +100,10 @@ Error glibc_load_metadata(ZigGLibCAbi **out_result, Buf *zig_lib_dir, bool verbo Optional<Slice<uint8_t>> opt_line = SplitIterator_next_separate(&it); if (!opt_line.is_some) break; - ver_list_base = allocate<ZigGLibCVerList>(glibc_abi->all_functions.length); + ver_list_base = heap::c_allocator.allocate<ZigGLibCVerList>(glibc_abi->all_functions.length); SplitIterator line_it = memSplit(opt_line.value, str(" ")); for (;;) { - ZigTarget *target = allocate<ZigTarget>(1); + ZigTarget *target = heap::c_allocator.create<ZigTarget>(); Optional<Slice<uint8_t>> opt_target = SplitIterator_next(&line_it); if (!opt_target.is_some) break; @@ -174,7 +174,7 @@ Error glibc_build_dummies_and_maps(CodeGen *g, const ZigGLibCAbi *glibc_abi, con Error err; Buf *cache_dir = get_global_cache_dir(); - CacheHash *cache_hash = allocate<CacheHash>(1); + CacheHash *cache_hash = heap::c_allocator.create<CacheHash>(); Buf *manifest_dir = buf_sprintf("%s" OS_SEP CACHE_HASH_SUBDIR, buf_ptr(cache_dir)); cache_init(cache_hash, manifest_dir); |
