diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2024-09-12 19:50:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-12 19:50:38 +0100 |
| commit | 0001f91e4e1e51cd64cdd5c0a21451c8bad67233 (patch) | |
| tree | 9c3efb262890fa76a9b1d02c694dadad11c316f4 /src | |
| parent | b95e0e09dcbe4ca948fd4098a8e3a4d90df9cb22 (diff) | |
| parent | 9271a89c65967ff0fed7011b4195abdd0f9195eb (diff) | |
| download | zig-0001f91e4e1e51cd64cdd5c0a21451c8bad67233.tar.gz zig-0001f91e4e1e51cd64cdd5c0a21451c8bad67233.zip | |
Merge pull request #21287 from linusg/deprecated-default-init
Replace deprecated default initializations with decl literals
Diffstat (limited to 'src')
70 files changed, 565 insertions, 547 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index bd93b2061b..0c1bbda65d 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -95,7 +95,7 @@ native_system_include_paths: []const []const u8, /// Corresponds to `-u <symbol>` for ELF/MachO and `/include:<symbol>` for COFF/PE. force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), -c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .{}, +c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .empty, win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct { pub fn keys(_: @This()) [0]void { return .{}; @@ -106,10 +106,10 @@ win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMa pub fn deinit(_: @This(), _: Allocator) void {} } = .{}, -link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .{}, +link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .empty, link_errors_mutex: std.Thread.Mutex = .{}, link_error_flags: link.File.ErrorFlags = .{}, -lld_errors: std.ArrayListUnmanaged(LldError) = .{}, +lld_errors: std.ArrayListUnmanaged(LldError) = .empty, work_queues: [ len: { @@ -154,7 +154,7 @@ embed_file_work_queue: std.fifo.LinearFifo(*Zcu.EmbedFile, .Dynamic), /// The ErrorMsg memory is owned by the `CObject`, using Compilation's general purpose allocator. /// This data is accessed by multiple threads and is protected by `mutex`. -failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .{}, +failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .empty, /// The ErrorBundle memory is owned by the `Win32Resource`, using Compilation's general purpose allocator. /// This data is accessed by multiple threads and is protected by `mutex`. @@ -166,7 +166,7 @@ failed_win32_resources: if (dev.env.supports(.win32_resource)) std.AutoArrayHash } = .{}, /// Miscellaneous things that can fail. -misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .{}, +misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .empty, /// When this is `true` it means invoking clang as a sub-process is expected to inherit /// stdin, stdout, stderr, and if it returns non success, to forward the exit code. @@ -248,7 +248,7 @@ wasi_emulated_libs: []const wasi_libc.CRTFile, /// For example `Scrt1.o` and `libc_nonshared.a`. These are populated after building libc from source, /// The set of needed CRT (C runtime) files differs depending on the target and compilation settings. /// The key is the basename, and the value is the absolute path to the completed build artifact. -crt_files: std.StringHashMapUnmanaged(CRTFile) = .{}, +crt_files: std.StringHashMapUnmanaged(CRTFile) = .empty, /// How many lines of reference trace should be included per compile error. /// Null means only show snippet on first error. @@ -527,8 +527,8 @@ pub const CObject = struct { } pub const Bundle = struct { - file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}, - category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}, + file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty, + category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty, diags: []Diag = &.{}, pub fn destroy(bundle: *Bundle, gpa: Allocator) void { @@ -561,8 +561,8 @@ pub const CObject = struct { category: u32 = 0, msg: []const u8 = &.{}, src_loc: SrcLoc = .{}, - src_ranges: std.ArrayListUnmanaged(SrcRange) = .{}, - sub_diags: std.ArrayListUnmanaged(Diag) = .{}, + src_ranges: std.ArrayListUnmanaged(SrcRange) = .empty, + sub_diags: std.ArrayListUnmanaged(Diag) = .empty, fn deinit(wip_diag: *@This(), allocator: Allocator) void { allocator.free(wip_diag.msg); @@ -580,19 +580,19 @@ pub const CObject = struct { var bc = BitcodeReader.init(gpa, .{ .reader = reader.any() }); defer bc.deinit(); - var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}; + var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty; errdefer { for (file_names.values()) |file_name| gpa.free(file_name); file_names.deinit(gpa); } - var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{}; + var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty; errdefer { for (category_names.values()) |category_name| gpa.free(category_name); category_names.deinit(gpa); } - var stack: std.ArrayListUnmanaged(WipDiag) = .{}; + var stack: std.ArrayListUnmanaged(WipDiag) = .empty; defer { for (stack.items) |*wip_diag| wip_diag.deinit(gpa); stack.deinit(gpa); @@ -1067,7 +1067,7 @@ pub const CreateOptions = struct { cache_mode: CacheMode = .incremental, lib_dirs: []const []const u8 = &[0][]const u8{}, rpath_list: []const []const u8 = &[0][]const u8{}, - symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{}, + symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty, c_source_files: []const CSourceFile = &.{}, rc_source_files: []const RcSourceFile = &.{}, manifest_file: ?[]const u8 = null, @@ -1155,7 +1155,7 @@ pub const CreateOptions = struct { skip_linker_dependencies: bool = false, hash_style: link.File.Elf.HashStyle = .both, entry: Entry = .default, - force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{}, + force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty, stack_size: ?u64 = null, image_base: ?u64 = null, version: ?std.SemanticVersion = null, @@ -1210,7 +1210,7 @@ fn addModuleTableToCacheHash( main_mod: *Package.Module, hash_type: union(enum) { path_bytes, files: *Cache.Manifest }, ) (error{OutOfMemory} || std.process.GetCwdError)!void { - var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .{}; + var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty; defer seen_table.deinit(gpa); // root_mod and main_mod may be the same pointer. In fact they usually are. @@ -3362,7 +3362,7 @@ pub fn addModuleErrorMsg( const file_path = try err_src_loc.file_scope.fullPath(gpa); defer gpa.free(file_path); - var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .{}; + var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .empty; defer ref_traces.deinit(gpa); if (module_err_msg.reference_trace_root.unwrap()) |rt_root| { @@ -3370,7 +3370,7 @@ pub fn addModuleErrorMsg( all_references.* = try mod.resolveReferences(); } - var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .{}; + var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .empty; defer seen.deinit(gpa); const max_references = mod.comp.reference_trace orelse Sema.default_reference_trace_len; @@ -3439,7 +3439,7 @@ pub fn addModuleErrorMsg( // De-duplicate error notes. The main use case in mind for this is // too many "note: called from here" notes when eval branch quota is reached. - var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .{}; + var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .empty; defer notes.deinit(gpa); for (module_err_msg.notes) |module_note| { @@ -3544,7 +3544,7 @@ fn performAllTheWorkInner( comp.job_queued_update_builtin_zig = false; if (comp.zcu == null) break :b; // TODO put all the modules in a flat array to make them easy to iterate. - var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .{}; + var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty; defer seen.deinit(comp.gpa); try seen.put(comp.gpa, comp.root_mod, {}); var i: usize = 0; @@ -4026,7 +4026,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { }; defer tar_file.close(); - var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .{}; + var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .empty; defer seen_table.deinit(comp.gpa); try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name); @@ -5221,7 +5221,7 @@ fn spawnZigRc( argv: []const []const u8, child_progress_node: std.Progress.Node, ) !void { - var node_name: std.ArrayListUnmanaged(u8) = .{}; + var node_name: std.ArrayListUnmanaged(u8) = .empty; defer node_name.deinit(arena); var child = std.process.Child.init(argv, arena); @@ -5540,7 +5540,7 @@ pub fn addCCArgs( } { - var san_arg: std.ArrayListUnmanaged(u8) = .{}; + var san_arg: std.ArrayListUnmanaged(u8) = .empty; const prefix = "-fsanitize="; if (mod.sanitize_c) { if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix); diff --git a/src/InternPool.zig b/src/InternPool.zig index fbfd29369f..6b20f79561 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -2,20 +2,20 @@ //! This data structure is self-contained. /// One item per thread, indexed by `tid`, which is dense and unique per thread. -locals: []Local = &.{}, +locals: []Local, /// Length must be a power of two and represents the number of simultaneous /// writers that can mutate any single sharded data structure. -shards: []Shard = &.{}, +shards: []Shard, /// Key is the error name, index is the error tag value. Index 0 has a length-0 string. -global_error_set: GlobalErrorSet = GlobalErrorSet.empty, +global_error_set: GlobalErrorSet, /// Cached number of active bits in a `tid`. -tid_width: if (single_threaded) u0 else std.math.Log2Int(u32) = 0, +tid_width: if (single_threaded) u0 else std.math.Log2Int(u32), /// Cached shift amount to put a `tid` in the top bits of a 30-bit value. -tid_shift_30: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31, +tid_shift_30: if (single_threaded) u0 else std.math.Log2Int(u32), /// Cached shift amount to put a `tid` in the top bits of a 31-bit value. -tid_shift_31: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31, +tid_shift_31: if (single_threaded) u0 else std.math.Log2Int(u32), /// Cached shift amount to put a `tid` in the top bits of a 32-bit value. -tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31, +tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32), /// Dependencies on the source code hash associated with a ZIR instruction. /// * For a `declaration`, this is the entire declaration body. @@ -23,36 +23,36 @@ tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_th /// * For a `func`, this is the source of the full function signature. /// These are also invalidated if tracking fails for this instruction. /// Value is index into `dep_entries` of the first dependency on this hash. -src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{}, +src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index), /// Dependencies on the value of a Nav. /// Value is index into `dep_entries` of the first dependency on this Nav value. -nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index) = .{}, +nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index), /// Dependencies on an interned value, either: /// * a runtime function (invalidated when its IES changes) /// * a container type requiring resolution (invalidated when the type must be recreated at a new index) /// Value is index into `dep_entries` of the first dependency on this interned value. -interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index) = .{}, +interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index), /// Dependencies on the full set of names in a ZIR namespace. /// Key refers to a `struct_decl`, `union_decl`, etc. /// Value is index into `dep_entries` of the first dependency on this namespace. -namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{}, +namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index), /// Dependencies on the (non-)existence of some name in a namespace. /// Value is index into `dep_entries` of the first dependency on this name. -namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index) = .{}, +namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index), /// Given a `Depender`, points to an entry in `dep_entries` whose `depender` /// matches. The `next_dependee` field can be used to iterate all such entries /// and remove them from the corresponding lists. -first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index) = .{}, +first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index), /// Stores dependency information. The hashmaps declared above are used to look /// up entries in this list as required. This is not stored in `extra` so that /// we can use `free_dep_entries` to track free indices, since dependencies are /// removed frequently. -dep_entries: std.ArrayListUnmanaged(DepEntry) = .{}, +dep_entries: std.ArrayListUnmanaged(DepEntry), /// Stores unused indices in `dep_entries` which can be reused without a full /// garbage collection pass. -free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index) = .{}, +free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index), /// Whether a multi-threaded intern pool is useful. /// Currently `false` until the intern pool is actually accessed @@ -62,6 +62,24 @@ const want_multi_threaded = true; /// Whether a single-threaded intern pool impl is in use. pub const single_threaded = builtin.single_threaded or !want_multi_threaded; +pub const empty: InternPool = .{ + .locals = &.{}, + .shards = &.{}, + .global_error_set = .empty, + .tid_width = 0, + .tid_shift_30 = if (single_threaded) 0 else 31, + .tid_shift_31 = if (single_threaded) 0 else 31, + .tid_shift_32 = if (single_threaded) 0 else 31, + .src_hash_deps = .empty, + .nav_val_deps = .empty, + .interned_deps = .empty, + .namespace_deps = .empty, + .namespace_name_deps = .empty, + .first_dependency = .empty, + .dep_entries = .empty, + .free_dep_entries = .empty, +}; + /// A `TrackedInst.Index` provides a single, unchanging reference to a ZIR instruction across a whole /// compilation. From this index, you can acquire a `TrackedInst`, which containss a reference to both /// the file which the instruction lives in, and the instruction index itself, which is updated on @@ -9858,7 +9876,7 @@ fn extraData(extra: Local.Extra, comptime T: type, index: u32) T { test "basic usage" { const gpa = std.testing.allocator; - var ip: InternPool = .{}; + var ip: InternPool = .empty; defer ip.deinit(gpa); const i32_type = try ip.get(gpa, .main, .{ .int_type = .{ @@ -10791,7 +10809,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator) var bw = std.io.bufferedWriter(std.io.getStdErr().writer()); const w = bw.writer(); - var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .{}; + var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .empty; for (ip.locals, 0..) |*local, tid| { const items = local.shared.items.view().slice(); const extra_list = local.shared.extra; diff --git a/src/Liveness.zig b/src/Liveness.zig index d90af6462a..abada07492 100644 --- a/src/Liveness.zig +++ b/src/Liveness.zig @@ -94,10 +94,10 @@ fn LivenessPassData(comptime pass: LivenessPass) type { /// body and which we are currently within. Also includes `loop`s which are the target /// of a `repeat` instruction, and `loop_switch_br`s which are the target of a /// `switch_dispatch` instruction. - breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, + breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty, /// The set of operands for which we have seen at least one usage but not their birth. - live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, + live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty, fn deinit(self: *@This(), gpa: Allocator) void { self.breaks.deinit(gpa); @@ -107,15 +107,15 @@ fn LivenessPassData(comptime pass: LivenessPass) type { .main_analysis => struct { /// Every `block` and `loop` currently under analysis. - block_scopes: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockScope) = .{}, + block_scopes: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockScope) = .empty, /// The set of instructions currently alive in the current control /// flow branch. - live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}, + live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty, /// The extra data initialized by the `loop_analysis` pass for this pass to consume. /// Owned by this struct during this pass. - old_extra: std.ArrayListUnmanaged(u32) = .{}, + old_extra: std.ArrayListUnmanaged(u32) = .empty, const BlockScope = struct { /// If this is a `block`, these instructions are alive upon a `br` to this block. @@ -1710,10 +1710,10 @@ fn analyzeInstCondBr( // Operands which are alive in one branch but not the other need to die at the start of // the peer branch. - var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{}; + var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty; defer then_mirrored_deaths.deinit(gpa); - var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{}; + var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty; defer else_mirrored_deaths.deinit(gpa); // Note: this invalidates `else_live`, but expands `then_live` to be their union @@ -1785,10 +1785,10 @@ fn analyzeInstSwitchBr( switch (pass) { .loop_analysis => { - var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}; + var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty; defer old_breaks.deinit(gpa); - var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{}; + var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty; defer old_live.deinit(gpa); if (is_dispatch_loop) { diff --git a/src/Liveness/Verify.zig b/src/Liveness/Verify.zig index 87ba6a3fc8..b6b7d40893 100644 --- a/src/Liveness/Verify.zig +++ b/src/Liveness/Verify.zig @@ -4,8 +4,8 @@ gpa: std.mem.Allocator, air: Air, liveness: Liveness, live: LiveMap = .{}, -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{}, -loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty, +loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty, intern_pool: *const InternPool, pub const Error = error{ LivenessInvalid, OutOfMemory }; diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig index 81f5cce819..05f724cda3 100644 --- a/src/Package/Fetch.zig +++ b/src/Package/Fetch.zig @@ -91,7 +91,7 @@ pub const JobQueue = struct { /// `table` may be missing some tasks such as ones that failed, so this /// field contains references to all of them. /// Protected by `mutex`. - all_fetches: std.ArrayListUnmanaged(*Fetch) = .{}, + all_fetches: std.ArrayListUnmanaged(*Fetch) = .empty, http_client: *std.http.Client, thread_pool: *ThreadPool, @@ -1439,7 +1439,7 @@ fn computeHash( // Track directories which had any files deleted from them so that empty directories // can be deleted. - var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .{}; + var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .empty; defer sus_dirs.deinit(gpa); var walker = try root_dir.walk(gpa); @@ -1710,7 +1710,7 @@ fn normalizePath(bytes: []u8) void { } const Filter = struct { - include_paths: std.StringArrayHashMapUnmanaged(void) = .{}, + include_paths: std.StringArrayHashMapUnmanaged(void) = .empty, /// sub_path is relative to the package root. pub fn includePath(self: Filter, sub_path: []const u8) bool { @@ -2309,7 +2309,7 @@ const TestFetchBuilder = struct { var package_dir = try self.packageDir(); defer package_dir.close(); - var actual_files: std.ArrayListUnmanaged([]u8) = .{}; + var actual_files: std.ArrayListUnmanaged([]u8) = .empty; defer actual_files.deinit(std.testing.allocator); defer for (actual_files.items) |file| std.testing.allocator.free(file); var walker = try package_dir.walk(std.testing.allocator); diff --git a/src/Package/Fetch/git.zig b/src/Package/Fetch/git.zig index a8c106412e..7c2fa21b54 100644 --- a/src/Package/Fetch/git.zig +++ b/src/Package/Fetch/git.zig @@ -38,7 +38,7 @@ test parseOid { pub const Diagnostics = struct { allocator: Allocator, - errors: std.ArrayListUnmanaged(Error) = .{}, + errors: std.ArrayListUnmanaged(Error) = .empty, pub const Error = union(enum) { unable_to_create_sym_link: struct { @@ -263,7 +263,7 @@ const Odb = struct { fn readObject(odb: *Odb) !Object { var base_offset = try odb.pack_file.getPos(); var base_header: EntryHeader = undefined; - var delta_offsets = std.ArrayListUnmanaged(u64){}; + var delta_offsets: std.ArrayListUnmanaged(u64) = .empty; defer delta_offsets.deinit(odb.allocator); const base_object = while (true) { if (odb.cache.get(base_offset)) |base_object| break base_object; @@ -361,7 +361,7 @@ const Object = struct { /// freed by the caller at any point after inserting it into the cache. Any /// objects remaining in the cache will be freed when the cache itself is freed. const ObjectCache = struct { - objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .{}, + objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .empty, lru_nodes: LruList = .{}, byte_size: usize = 0, @@ -660,7 +660,7 @@ pub const Session = struct { upload_pack_uri.query = null; upload_pack_uri.fragment = null; - var body = std.ArrayListUnmanaged(u8){}; + var body: std.ArrayListUnmanaged(u8) = .empty; defer body.deinit(allocator); const body_writer = body.writer(allocator); try Packet.write(.{ .data = "command=ls-refs\n" }, body_writer); @@ -767,7 +767,7 @@ pub const Session = struct { upload_pack_uri.query = null; upload_pack_uri.fragment = null; - var body = std.ArrayListUnmanaged(u8){}; + var body: std.ArrayListUnmanaged(u8) = .empty; defer body.deinit(allocator); const body_writer = body.writer(allocator); try Packet.write(.{ .data = "command=fetch\n" }, body_writer); @@ -1044,9 +1044,9 @@ const IndexEntry = struct { pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) !void { try pack.seekTo(0); - var index_entries = std.AutoHashMapUnmanaged(Oid, IndexEntry){}; + var index_entries: std.AutoHashMapUnmanaged(Oid, IndexEntry) = .empty; defer index_entries.deinit(allocator); - var pending_deltas = std.ArrayListUnmanaged(IndexEntry){}; + var pending_deltas: std.ArrayListUnmanaged(IndexEntry) = .empty; defer pending_deltas.deinit(allocator); const pack_checksum = try indexPackFirstPass(allocator, pack, &index_entries, &pending_deltas); @@ -1068,7 +1068,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) remaining_deltas = pending_deltas.items.len; } - var oids = std.ArrayListUnmanaged(Oid){}; + var oids: std.ArrayListUnmanaged(Oid) = .empty; defer oids.deinit(allocator); try oids.ensureTotalCapacityPrecise(allocator, index_entries.count()); var index_entries_iter = index_entries.iterator(); @@ -1109,7 +1109,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) try writer.writeInt(u32, index_entries.get(oid).?.crc32, .big); } - var big_offsets = std.ArrayListUnmanaged(u64){}; + var big_offsets: std.ArrayListUnmanaged(u64) = .empty; defer big_offsets.deinit(allocator); for (oids.items) |oid| { const offset = index_entries.get(oid).?.offset; @@ -1213,7 +1213,7 @@ fn indexPackHashDelta( // Figure out the chain of deltas to resolve var base_offset = delta.offset; var base_header: EntryHeader = undefined; - var delta_offsets = std.ArrayListUnmanaged(u64){}; + var delta_offsets: std.ArrayListUnmanaged(u64) = .empty; defer delta_offsets.deinit(allocator); const base_object = while (true) { if (cache.get(base_offset)) |base_object| break base_object; @@ -1447,7 +1447,7 @@ test "packfile indexing and checkout" { "file8", "file9", }; - var actual_files: std.ArrayListUnmanaged([]u8) = .{}; + var actual_files: std.ArrayListUnmanaged([]u8) = .empty; defer actual_files.deinit(testing.allocator); defer for (actual_files.items) |file| testing.allocator.free(file); var walker = try worktree.dir.walk(testing.allocator); diff --git a/src/Sema.zig b/src/Sema.zig index 7ab60adbf2..8f097bb35f 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -13,7 +13,7 @@ gpa: Allocator, arena: Allocator, code: Zir, air_instructions: std.MultiArrayList(Air.Inst) = .{}, -air_extra: std.ArrayListUnmanaged(u32) = .{}, +air_extra: std.ArrayListUnmanaged(u32) = .empty, /// Maps ZIR to AIR. inst_map: InstMap = .{}, /// The "owner" of a `Sema` represents the root "thing" that is being analyzed. @@ -65,7 +65,7 @@ generic_call_src: LazySrcLoc = LazySrcLoc.unneeded, /// They are created when an break_inline passes through a runtime condition, because /// Sema must convert comptime control flow to runtime control flow, which means /// breaking from a block. -post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .{}, +post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .empty, /// Populated with the last compile error created. err: ?*Zcu.ErrorMsg = null, /// Set to true when analyzing a func type instruction so that nested generic @@ -74,12 +74,12 @@ no_partial_func_ty: bool = false, /// The temporary arena is used for the memory of the `InferredAlloc` values /// here so the values can be dropped without any cleanup. -unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .{}, +unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .empty, /// Links every pointer derived from a base `alloc` back to that `alloc`. Used /// to detect comptime-known `const`s. /// TODO: ZIR liveness analysis would allow us to remove elements from this map. -base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{}, +base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .empty, /// Runtime `alloc`s are placed in this map to track all comptime-known writes /// before the corresponding `make_ptr_const` instruction. @@ -90,28 +90,28 @@ base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{}, /// is comptime-known, and all stores to the pointer must be applied at comptime /// to determine the comptime value. /// Backed by gpa. -maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .{}, +maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .empty, /// Comptime-mutable allocs, and any comptime allocs which reference it, are /// stored as elements of this array. /// Pointers to such memory are represented via an index into this array. /// Backed by gpa. -comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .{}, +comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .empty, /// A list of exports performed by this analysis. After this `Sema` terminates, /// these are flushed to `Zcu.single_exports` or `Zcu.multi_exports`. -exports: std.ArrayListUnmanaged(Zcu.Export) = .{}, +exports: std.ArrayListUnmanaged(Zcu.Export) = .empty, /// All references registered so far by this `Sema`. This is a temporary duplicate /// of data stored in `Zcu.all_references`. It exists to avoid adding references to /// a given `AnalUnit` multiple times. -references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, -type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}, +references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, +type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty, /// All dependencies registered so far by this `Sema`. This is a temporary duplicate /// of the main dependency data. It exists to avoid adding dependencies to a given /// `AnalUnit` multiple times. -dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .{}, +dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .empty, /// Whether memoization of this call is permitted. Operations with side effects global /// to the `Sema`, such as `@setEvalBranchQuota`, set this to `false`. It is observed @@ -208,7 +208,7 @@ pub const InferredErrorSet = struct { /// are returned from any dependent functions. errors: NameMap = .{}, /// Other inferred error sets which this inferred error set should include. - inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}, + inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty, /// The regular error set created by resolving this inferred error set. resolved: InternPool.Index = .none, @@ -508,9 +508,9 @@ pub const Block = struct { /// * for a `switch_block[_ref]`, this refers to dummy `br` instructions /// which correspond to `switch_continue` ZIR. The switch logic will /// rewrite these to appropriate AIR switch dispatches. - extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .{}, + extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .empty, /// Same indexes, capacity, length as `extra_insts`. - extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .{}, + extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .empty, pub fn deinit(merges: *@This(), allocator: Allocator) void { merges.results.deinit(allocator); @@ -871,7 +871,7 @@ const InferredAlloc = struct { /// is known. These should be rewritten to perform any required coercions /// when the type is resolved. /// Allocated from `sema.arena`. - prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .{}, + prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .empty, }; const NeededComptimeReason = struct { @@ -2908,7 +2908,7 @@ fn createTypeName( const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse return error.AnalysisFail); const zir_tags = sema.code.instructions.items(.tag); - var buf: std.ArrayListUnmanaged(u8) = .{}; + var buf: std.ArrayListUnmanaged(u8) = .empty; defer buf.deinit(gpa); const writer = buf.writer(gpa); @@ -6851,11 +6851,11 @@ fn lookupInNamespace( if (observe_usingnamespace and (namespace.pub_usingnamespace.items.len != 0 or namespace.priv_usingnamespace.items.len != 0)) { const gpa = sema.gpa; - var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .{}; + var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .empty; defer checked_namespaces.deinit(gpa); // Keep track of name conflicts for error notes. - var candidates: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{}; + var candidates: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty; defer candidates.deinit(gpa); try checked_namespaces.put(gpa, namespace, {}); @@ -22754,7 +22754,7 @@ fn reifyUnion( break :tag_ty .{ enum_tag_ty.toIntern(), true }; } else tag_ty: { // We must track field names and set up the tag type ourselves. - var field_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; + var field_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; try field_names.ensureTotalCapacity(sema.arena, fields_len); for (field_types, 0..) |*field_ty, field_idx| { @@ -37075,7 +37075,7 @@ fn unionFields( var int_tag_ty: Type = undefined; var enum_field_names: []InternPool.NullTerminatedString = &.{}; - var enum_field_vals: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}; + var enum_field_vals: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty; var explicit_tags_seen: []bool = &.{}; if (tag_type_ref != .none) { const tag_ty_src: LazySrcLoc = .{ @@ -37126,8 +37126,8 @@ fn unionFields( enum_field_names = try sema.arena.alloc(InternPool.NullTerminatedString, fields_len); } - var field_types: std.ArrayListUnmanaged(InternPool.Index) = .{}; - var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .{}; + var field_types: std.ArrayListUnmanaged(InternPool.Index) = .empty; + var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .empty; try field_types.ensureTotalCapacityPrecise(sema.arena, fields_len); if (small.any_aligned_fields) diff --git a/src/Zcu.zig b/src/Zcu.zig index 148570d85a..3b0d5d9d87 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -76,14 +76,14 @@ local_zir_cache: Compilation.Directory, /// This is where all `Export` values are stored. Not all values here are necessarily valid exports; /// to enumerate all exports, `single_exports` and `multi_exports` must be consulted. -all_exports: std.ArrayListUnmanaged(Export) = .{}, +all_exports: std.ArrayListUnmanaged(Export) = .empty, /// This is a list of free indices in `all_exports`. These indices may be reused by exports from /// future semantic analysis. -free_exports: std.ArrayListUnmanaged(u32) = .{}, +free_exports: std.ArrayListUnmanaged(u32) = .empty, /// Maps from an `AnalUnit` which performs a single export, to the index into `all_exports` of /// the export it performs. Note that the key is not the `Decl` being exported, but the `AnalUnit` /// whose analysis triggered the export. -single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, +single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, /// Like `single_exports`, but for `AnalUnit`s which perform multiple exports. /// The exports are `all_exports.items[index..][0..len]`. multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { @@ -104,29 +104,29 @@ multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { /// `Compilation.update` of the process for a given `Compilation`. /// /// Indexes correspond 1:1 to `files`. -import_table: std.StringArrayHashMapUnmanaged(File.Index) = .{}, +import_table: std.StringArrayHashMapUnmanaged(File.Index) = .empty, /// The set of all the files which have been loaded with `@embedFile` in the Module. /// We keep track of this in order to iterate over it and check which files have been /// modified on the file system when an update is requested, as well as to cache /// `@embedFile` results. /// Keys are fully resolved file paths. This table owns the keys and values. -embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .{}, +embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .empty, /// Stores all Type and Value objects. /// The idea is that this will be periodically garbage-collected, but such logic /// is not yet implemented. -intern_pool: InternPool = .{}, +intern_pool: InternPool = .empty, -analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, +analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. -failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .{}, +failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .empty, /// This `AnalUnit` failed semantic analysis because it required analysis of another `AnalUnit` which itself failed. -transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, +transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, /// This `Nav` succeeded analysis, but failed codegen. /// This may be a simple "value" `Nav`, or it may be a function. /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. -failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .{}, +failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .empty, /// Keep track of one `@compileLog` callsite per `AnalUnit`. /// The value is the source location of the `@compileLog` call, convertible to a `LazySrcLoc`. compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { @@ -141,14 +141,14 @@ compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { }) = .{}, /// Using a map here for consistency with the other fields here. /// The ErrorMsg memory is owned by the `File`, using Module's general purpose allocator. -failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .{}, +failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .empty, /// The ErrorMsg memory is owned by the `EmbedFile`, using Module's general purpose allocator. -failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .{}, +failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .empty, /// Key is index into `all_exports`. -failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .{}, +failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .empty, /// If analysis failed due to a cimport error, the corresponding Clang errors /// are stored here. -cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .{}, +cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .empty, /// Maximum amount of distinct error values, set by --error-limit error_limit: ErrorInt, @@ -156,19 +156,19 @@ error_limit: ErrorInt, /// Value is the number of PO dependencies of this AnalUnit. /// This value will decrease as we perform semantic analysis to learn what is outdated. /// If any of these PO deps is outdated, this value will be moved to `outdated`. -potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, +potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, /// Value is the number of PO dependencies of this AnalUnit. /// Once this value drops to 0, the AnalUnit is a candidate for re-analysis. -outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, +outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, /// This contains all `AnalUnit`s in `outdated` whose PO dependency count is 0. /// Such `AnalUnit`s are ready for immediate re-analysis. /// See `findOutdatedToAnalyze` for details. -outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{}, +outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, /// This contains a list of AnalUnit whose analysis or codegen failed, but the /// failure was something like running out of disk space, and trying again may /// succeed. On the next update, we will flush this list, marking all members of /// it as outdated. -retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .{}, +retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .empty, /// These are the modules which we initially queue for analysis in `Compilation.update`. /// `resolveReferences` will use these as the root of its reachability traversal. @@ -184,31 +184,31 @@ stage1_flags: packed struct { reserved: u2 = 0, } = .{}, -compile_log_text: std.ArrayListUnmanaged(u8) = .{}, +compile_log_text: std.ArrayListUnmanaged(u8) = .empty, -test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .{}, +test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty, -global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .{}, +global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .empty, /// Key is the `AnalUnit` *performing* the reference. This representation allows /// incremental updates to quickly delete references caused by a specific `AnalUnit`. /// Value is index into `all_references` of the first reference triggered by the unit. /// The `next` field on the `Reference` forms a linked list of all references /// triggered by the key `AnalUnit`. -reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, -all_references: std.ArrayListUnmanaged(Reference) = .{}, +reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, +all_references: std.ArrayListUnmanaged(Reference) = .empty, /// Freelist of indices in `all_references`. -free_references: std.ArrayListUnmanaged(u32) = .{}, +free_references: std.ArrayListUnmanaged(u32) = .empty, /// Key is the `AnalUnit` *performing* the reference. This representation allows /// incremental updates to quickly delete references caused by a specific `AnalUnit`. /// Value is index into `all_type_reference` of the first reference triggered by the unit. /// The `next` field on the `TypeReference` forms a linked list of all type references /// triggered by the key `AnalUnit`. -type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{}, -all_type_references: std.ArrayListUnmanaged(TypeReference) = .{}, +type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, +all_type_references: std.ArrayListUnmanaged(TypeReference) = .empty, /// Freelist of indices in `all_type_references`. -free_type_references: std.ArrayListUnmanaged(u32) = .{}, +free_type_references: std.ArrayListUnmanaged(u32) = .empty, panic_messages: [PanicId.len]InternPool.Nav.Index.Optional = .{.none} ** PanicId.len, /// The panic function body. @@ -338,16 +338,16 @@ pub const Namespace = struct { /// Will be a struct, enum, union, or opaque. owner_type: InternPool.Index, /// Members of the namespace which are marked `pub`. - pub_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .{}, + pub_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty, /// Members of the namespace which are *not* marked `pub`. - priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .{}, + priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty, /// All `usingnamespace` declarations in this namespace which are marked `pub`. - pub_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{}, + pub_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty, /// All `usingnamespace` declarations in this namespace which are *not* marked `pub`. - priv_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{}, + priv_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty, /// All `comptime` and `test` declarations in this namespace. We store these purely so that /// incremental compilation can re-use the existing `Cau`s when a namespace changes. - other_decls: std.ArrayListUnmanaged(InternPool.Cau.Index) = .{}, + other_decls: std.ArrayListUnmanaged(InternPool.Cau.Index) = .empty, pub const Index = InternPool.NamespaceIndex; pub const OptionalIndex = InternPool.OptionalNamespaceIndex; @@ -451,7 +451,7 @@ pub const File = struct { /// Whether this file is a part of multiple packages. This is an error condition which will be reported after AstGen. multi_pkg: bool = false, /// List of references to this file, used for multi-package errors. - references: std.ArrayListUnmanaged(File.Reference) = .{}, + references: std.ArrayListUnmanaged(File.Reference) = .empty, /// The most recent successful ZIR for this file, with no errors. /// This is only populated when a previously successful ZIR @@ -2551,13 +2551,13 @@ pub fn mapOldZirToNew( old_inst: Zir.Inst.Index, new_inst: Zir.Inst.Index, }; - var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .{}; + var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .empty; defer match_stack.deinit(gpa); // Used as temporary buffers for namespace declaration instructions - var old_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var old_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer old_decls.deinit(gpa); - var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer new_decls.deinit(gpa); // Map the main struct inst (and anything in its fields) @@ -2582,19 +2582,19 @@ pub fn mapOldZirToNew( try inst_map.put(gpa, match_item.old_inst, match_item.new_inst); // Maps decl name to `declaration` instruction. - var named_decls: std.StringHashMapUnmanaged(Zir.Inst.Index) = .{}; + var named_decls: std.StringHashMapUnmanaged(Zir.Inst.Index) = .empty; defer named_decls.deinit(gpa); // Maps test name to `declaration` instruction. - var named_tests: std.StringHashMapUnmanaged(Zir.Inst.Index) = .{}; + var named_tests: std.StringHashMapUnmanaged(Zir.Inst.Index) = .empty; defer named_tests.deinit(gpa); // All unnamed tests, in order, for a best-effort match. - var unnamed_tests: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var unnamed_tests: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer unnamed_tests.deinit(gpa); // All comptime declarations, in order, for a best-effort match. - var comptime_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var comptime_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer comptime_decls.deinit(gpa); // All usingnamespace declarations, in order, for a best-effort match. - var usingnamespace_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{}; + var usingnamespace_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty; defer usingnamespace_decls.deinit(gpa); { @@ -3154,12 +3154,12 @@ pub fn resolveReferences(zcu: *Zcu) !std.AutoHashMapUnmanaged(AnalUnit, ?Resolve const comp = zcu.comp; const ip = &zcu.intern_pool; - var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{}; + var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty; errdefer result.deinit(gpa); - var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{}; - var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .{}; - var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{}; + var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty; + var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .empty; + var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty; defer { checked_types.deinit(gpa); type_queue.deinit(gpa); diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index 17c5413b30..837895f783 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -320,7 +320,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { const gpa = zcu.gpa; // We need to visit every updated File for every TrackedInst in InternPool. - var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .{}; + var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .empty; defer cleanupUpdatedFiles(gpa, &updated_files); for (zcu.import_table.values()) |file_index| { const file = zcu.fileByIndex(file_index); @@ -399,7 +399,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { }; if (!has_namespace) continue; - var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; + var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; defer old_names.deinit(zcu.gpa); { var it = old_zir.declIterator(old_inst); @@ -1721,7 +1721,7 @@ pub fn scanNamespace( // For incremental updates, `scanDecl` wants to look up existing decls by their ZIR index rather // than their name. We'll build an efficient mapping now, then discard the current `decls`. // We map to the `Cau`, since not every declaration has a `Nav`. - var existing_by_inst: std.AutoHashMapUnmanaged(InternPool.TrackedInst.Index, InternPool.Cau.Index) = .{}; + var existing_by_inst: std.AutoHashMapUnmanaged(InternPool.TrackedInst.Index, InternPool.Cau.Index) = .empty; defer existing_by_inst.deinit(gpa); try existing_by_inst.ensureTotalCapacity(gpa, @intCast( @@ -1761,7 +1761,7 @@ pub fn scanNamespace( } } - var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; + var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; defer seen_decls.deinit(gpa); namespace.pub_decls.clearRetainingCapacity(); @@ -2293,8 +2293,8 @@ pub fn processExports(pt: Zcu.PerThread) !void { const gpa = zcu.gpa; // First, construct a mapping of every exported value and Nav to the indices of all its different exports. - var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .{}; - var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .{}; + var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .empty; + var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .empty; defer { for (nav_exports.values()) |*exports| { exports.deinit(gpa); diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index 463fdde844..649be16c06 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -62,7 +62,7 @@ stack_align: u32, /// MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// MIR extra data -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// Byte offset within the source file of the ending curly. end_di_line: u32, @@ -71,13 +71,13 @@ end_di_column: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, /// We postpone the creation of debug info for function args and locals /// until after all Mir instructions have been generated. Only then we /// will know saved_regs_stack_space which is necessary in order to /// calculate the right stack offsest with respect to the `.fp` register. -dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, +dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty, /// Whenever there is a runtime branch, we push a Branch onto this stack, /// and pop it off when the runtime branch joins. This provides an "overlay" @@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, branch_stack: *std.ArrayList(Branch), // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, /// Maps offset to what is stored there. -stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, +stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, /// Tracks the current instruction allocated to the compare flags compare_flags_inst: ?Air.Inst.Index = null, @@ -247,7 +247,7 @@ const DbgInfoReloc = struct { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, + inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, fn deinit(self: *Branch, gpa: Allocator) void { self.inst_table.deinit(gpa); diff --git a/src/arch/aarch64/Emit.zig b/src/arch/aarch64/Emit.zig index 860a264e72..f6b6564f58 100644 --- a/src/arch/aarch64/Emit.zig +++ b/src/arch/aarch64/Emit.zig @@ -33,18 +33,18 @@ prev_di_pc: usize, saved_regs_stack_space: u32, /// The branch type of every branch -branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, +branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, /// For every forward branch, maps the target instruction to a list of /// branches which branch to this target instruction -branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, +branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, /// For backward branches: stores the code offset of the target /// instruction /// /// For forward branches: stores the code offset of the branch /// instruction -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, /// The final stack frame size of the function (already aligned to the /// respective stack alignment). Does not include prologue stack space. @@ -346,7 +346,7 @@ fn lowerBranches(emit: *Emit) !void { if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { try origin_list.append(gpa, inst); } else { - var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; + var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; try origin_list.append(gpa, inst); try emit.branch_forward_origins.put(gpa, target_inst, origin_list); } diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig index a0b529b75e..48137d4413 100644 --- a/src/arch/arm/CodeGen.zig +++ b/src/arch/arm/CodeGen.zig @@ -62,7 +62,7 @@ stack_align: u32, /// MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// MIR extra data -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// Byte offset within the source file of the ending curly. end_di_line: u32, @@ -71,13 +71,13 @@ end_di_column: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, /// We postpone the creation of debug info for function args and locals /// until after all Mir instructions have been generated. Only then we /// will know saved_regs_stack_space which is necessary in order to /// calculate the right stack offsest with respect to the `.fp` register. -dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, +dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty, /// Whenever there is a runtime branch, we push a Branch onto this stack, /// and pop it off when the runtime branch joins. This provides an "overlay" @@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{}, branch_stack: *std.ArrayList(Branch), // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, /// Maps offset to what is stored there. -stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, +stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, /// Tracks the current instruction allocated to the compare flags cpsr_flags_inst: ?Air.Inst.Index = null, @@ -168,7 +168,7 @@ const MCValue = union(enum) { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, + inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, fn deinit(self: *Branch, gpa: Allocator) void { self.inst_table.deinit(gpa); diff --git a/src/arch/arm/Emit.zig b/src/arch/arm/Emit.zig index 9ccef5a299..03940dfc3c 100644 --- a/src/arch/arm/Emit.zig +++ b/src/arch/arm/Emit.zig @@ -40,16 +40,16 @@ saved_regs_stack_space: u32, stack_size: u32, /// The branch type of every branch -branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, +branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, /// For every forward branch, maps the target instruction to a list of /// branches which branch to this target instruction -branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, +branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, /// For backward branches: stores the code offset of the target /// instruction /// /// For forward branches: stores the code offset of the branch /// instruction -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, const InnerError = error{ OutOfMemory, @@ -264,7 +264,7 @@ fn lowerBranches(emit: *Emit) !void { if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { try origin_list.append(gpa, inst); } else { - var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; + var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; try origin_list.append(gpa, inst); try emit.branch_forward_origins.put(gpa, target_inst, origin_list); } diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig index 262dad6d24..f887c6cb13 100644 --- a/src/arch/riscv64/CodeGen.zig +++ b/src/arch/riscv64/CodeGen.zig @@ -81,7 +81,7 @@ scope_generation: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, /// Whenever there is a runtime branch, we push a Branch onto this stack, /// and pop it off when the runtime branch joins. This provides an "overlay" @@ -97,14 +97,14 @@ avl: ?u64, vtype: ?bits.VType, // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, const_tracking: ConstTrackingMap = .{}, inst_tracking: InstTrackingMap = .{}, frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, -free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{}, +free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty, frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { @@ -342,7 +342,7 @@ const MCValue = union(enum) { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, + inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, fn deinit(func: *Branch, gpa: Allocator) void { func.inst_table.deinit(gpa); @@ -621,7 +621,7 @@ const FrameAlloc = struct { }; const BlockData = struct { - relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, + relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, state: State, fn deinit(bd: *BlockData, gpa: Allocator) void { @@ -6193,7 +6193,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { const Label = struct { target: Mir.Inst.Index = undefined, - pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, + pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, const Kind = enum { definition, reference }; @@ -6217,7 +6217,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void { return name.len > 0; } }; - var labels: std.StringHashMapUnmanaged(Label) = .{}; + var labels: std.StringHashMapUnmanaged(Label) = .empty; defer { var label_it = labels.valueIterator(); while (label_it.next()) |label| label.pending_relocs.deinit(func.gpa); diff --git a/src/arch/riscv64/Emit.zig b/src/arch/riscv64/Emit.zig index 8ee566c7ed..2c4c04d5d3 100644 --- a/src/arch/riscv64/Emit.zig +++ b/src/arch/riscv64/Emit.zig @@ -10,8 +10,8 @@ prev_di_column: u32, /// Relative to the beginning of `code`. prev_di_pc: usize, -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, -relocs: std.ArrayListUnmanaged(Reloc) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, +relocs: std.ArrayListUnmanaged(Reloc) = .empty, pub const Error = Lower.Error || error{ EmitFail, diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index 589e9978a2..f2ffd517f9 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -68,7 +68,7 @@ stack_align: Alignment, /// MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// MIR extra data -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// Byte offset within the source file of the ending curly. end_di_line: u32, @@ -77,7 +77,7 @@ end_di_column: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty, /// Whenever there is a runtime branch, we push a Branch onto this stack, /// and pop it off when the runtime branch joins. This provides an "overlay" @@ -89,12 +89,12 @@ exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{}, branch_stack: *std.ArrayList(Branch), // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, /// Maps offset to what is stored there. -stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{}, +stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty, /// Tracks the current instruction allocated to the condition flags condition_flags_inst: ?Air.Inst.Index = null, @@ -201,7 +201,7 @@ const MCValue = union(enum) { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{}, + inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, fn deinit(self: *Branch, gpa: Allocator) void { self.inst_table.deinit(gpa); diff --git a/src/arch/sparc64/Emit.zig b/src/arch/sparc64/Emit.zig index a87c9cd0ae..ca50aa50c6 100644 --- a/src/arch/sparc64/Emit.zig +++ b/src/arch/sparc64/Emit.zig @@ -30,16 +30,16 @@ prev_di_column: u32, prev_di_pc: usize, /// The branch type of every branch -branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{}, +branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty, /// For every forward branch, maps the target instruction to a list of /// branches which branch to this target instruction -branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{}, +branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty, /// For backward branches: stores the code offset of the target /// instruction /// /// For forward branches: stores the code offset of the branch /// instruction -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, const InnerError = error{ OutOfMemory, @@ -571,7 +571,7 @@ fn lowerBranches(emit: *Emit) !void { if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| { try origin_list.append(gpa, inst); } else { - var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}; + var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty; try origin_list.append(gpa, inst); try emit.branch_forward_origins.put(gpa, target_inst, origin_list); } diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig index 4c42cd4ad2..193bd27a38 100644 --- a/src/arch/wasm/CodeGen.zig +++ b/src/arch/wasm/CodeGen.zig @@ -654,7 +654,7 @@ func_index: InternPool.Index, /// When we return from a branch, the branch will be popped from this list, /// which means branches can only contain references from within its own branch, /// or a branch higher (lower index) in the tree. -branches: std.ArrayListUnmanaged(Branch) = .{}, +branches: std.ArrayListUnmanaged(Branch) = .empty, /// Table to save `WValue`'s generated by an `Air.Inst` // values: ValueTable, /// Mapping from Air.Inst.Index to block ids @@ -663,7 +663,7 @@ blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, struct { value: WValue, }) = .{}, /// Maps `loop` instructions to their label. `br` to here repeats the loop. -loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .{}, +loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty, /// `bytes` contains the wasm bytecode belonging to the 'code' section. code: *ArrayList(u8), /// The index the next local generated will have @@ -681,7 +681,7 @@ locals: std.ArrayListUnmanaged(u8), /// List of simd128 immediates. Each value is stored as an array of bytes. /// This list will only be populated for 128bit-simd values when the target features /// are enabled also. -simd_immediates: std.ArrayListUnmanaged([16]u8) = .{}, +simd_immediates: std.ArrayListUnmanaged([16]u8) = .empty, /// The Target we're emitting (used to call intInfo) target: *const std.Target, /// Represents the wasm binary file that is being linked. @@ -690,7 +690,7 @@ pt: Zcu.PerThread, /// List of MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// Contains extra data for MIR -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// When a function is executing, we store the the current stack pointer's value within this local. /// This value is then used to restore the stack pointer to the original value at the return of the function. initial_stack_value: WValue = .none, @@ -717,19 +717,19 @@ stack_alignment: Alignment = .@"16", // allows us to re-use locals that are no longer used. e.g. a temporary local. /// A list of indexes which represents a local of valtype `i32`. /// It is illegal to store a non-i32 valtype in this list. -free_locals_i32: std.ArrayListUnmanaged(u32) = .{}, +free_locals_i32: std.ArrayListUnmanaged(u32) = .empty, /// A list of indexes which represents a local of valtype `i64`. /// It is illegal to store a non-i64 valtype in this list. -free_locals_i64: std.ArrayListUnmanaged(u32) = .{}, +free_locals_i64: std.ArrayListUnmanaged(u32) = .empty, /// A list of indexes which represents a local of valtype `f32`. /// It is illegal to store a non-f32 valtype in this list. -free_locals_f32: std.ArrayListUnmanaged(u32) = .{}, +free_locals_f32: std.ArrayListUnmanaged(u32) = .empty, /// A list of indexes which represents a local of valtype `f64`. /// It is illegal to store a non-f64 valtype in this list. -free_locals_f64: std.ArrayListUnmanaged(u32) = .{}, +free_locals_f64: std.ArrayListUnmanaged(u32) = .empty, /// A list of indexes which represents a local of valtype `v127`. /// It is illegal to store a non-v128 valtype in this list. -free_locals_v128: std.ArrayListUnmanaged(u32) = .{}, +free_locals_v128: std.ArrayListUnmanaged(u32) = .empty, /// When in debug mode, this tracks if no `finishAir` was missed. /// Forgetting to call `finishAir` will cause the result to not be diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 2d0b35a636..01e60367ea 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -78,7 +78,7 @@ eflags_inst: ?Air.Inst.Index = null, /// MIR Instructions mir_instructions: std.MultiArrayList(Mir.Inst) = .{}, /// MIR extra data -mir_extra: std.ArrayListUnmanaged(u32) = .{}, +mir_extra: std.ArrayListUnmanaged(u32) = .empty, /// Byte offset within the source file of the ending curly. end_di_line: u32, @@ -87,13 +87,13 @@ end_di_column: u32, /// The value is an offset into the `Function` `code` from the beginning. /// To perform the reloc, write 32-bit signed little-endian integer /// which is a relative jump, based on the address following the reloc. -exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, +exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, const_tracking: ConstTrackingMap = .{}, inst_tracking: InstTrackingMap = .{}, // Key is the block instruction -blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, +blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, register_manager: RegisterManager = .{}, @@ -101,7 +101,7 @@ register_manager: RegisterManager = .{}, scope_generation: u32 = 0, frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, -free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{}, +free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty, frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { @@ -799,7 +799,7 @@ const StackAllocation = struct { }; const BlockData = struct { - relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, + relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, state: State, fn deinit(self: *BlockData, gpa: Allocator) void { @@ -14248,7 +14248,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { const Label = struct { target: Mir.Inst.Index = undefined, - pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{}, + pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty, const Kind = enum { definition, reference }; @@ -14272,7 +14272,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void { return name.len > 0; } }; - var labels: std.StringHashMapUnmanaged(Label) = .{}; + var labels: std.StringHashMapUnmanaged(Label) = .empty; defer { var label_it = labels.valueIterator(); while (label_it.next()) |label| label.pending_relocs.deinit(self.gpa); diff --git a/src/arch/x86_64/Emit.zig b/src/arch/x86_64/Emit.zig index 372a520e52..c33fbb53a5 100644 --- a/src/arch/x86_64/Emit.zig +++ b/src/arch/x86_64/Emit.zig @@ -11,8 +11,8 @@ prev_di_column: u32, /// Relative to the beginning of `code`. prev_di_pc: usize, -code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{}, -relocs: std.ArrayListUnmanaged(Reloc) = .{}, +code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty, +relocs: std.ArrayListUnmanaged(Reloc) = .empty, pub const Error = Lower.Error || error{ EmitFail, diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 0ec5513b6f..466bdcde6a 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -304,14 +304,14 @@ pub const Function = struct { air: Air, liveness: Liveness, value_map: CValueMap, - blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{}, + blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty, next_arg_index: usize = 0, next_block_index: usize = 0, object: Object, lazy_fns: LazyFnMap, func_index: InternPool.Index, /// All the locals, to be emitted at the top of the function. - locals: std.ArrayListUnmanaged(Local) = .{}, + locals: std.ArrayListUnmanaged(Local) = .empty, /// Which locals are available for reuse, based on Type. free_locals_map: LocalsMap = .{}, /// Locals which will not be freed by Liveness. This is used after a @@ -320,10 +320,10 @@ pub const Function = struct { /// of variable declarations at the top of a function, sorted descending /// by type alignment. /// The value is whether the alloc needs to be emitted in the header. - allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .{}, + allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .empty, /// Maps from `loop_switch_br` instructions to the allocated local used /// for the switch cond. Dispatches should set this local to the new cond. - loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .{}, + loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .empty, fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue { const gop = try f.value_map.getOrPut(ref); diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 956ed7de08..ec2ba4e4c1 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -1500,7 +1500,7 @@ pub const Object = struct { // instructions. Depending on the calling convention, this list is not necessarily // a bijection with the actual LLVM parameters of the function. const gpa = o.gpa; - var args: std.ArrayListUnmanaged(Builder.Value) = .{}; + var args: std.ArrayListUnmanaged(Builder.Value) = .empty; defer args.deinit(gpa); { @@ -2497,7 +2497,7 @@ pub const Object = struct { switch (ip.indexToKey(ty.toIntern())) { .anon_struct_type => |tuple| { - var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; + var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; defer fields.deinit(gpa); try fields.ensureUnusedCapacity(gpa, tuple.types.len); @@ -2574,7 +2574,7 @@ pub const Object = struct { const struct_type = zcu.typeToStruct(ty).?; - var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; + var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; defer fields.deinit(gpa); try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len); @@ -2667,7 +2667,7 @@ pub const Object = struct { return debug_union_type; } - var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{}; + var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty; defer fields.deinit(gpa); try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len); @@ -3412,7 +3412,7 @@ pub const Object = struct { return int_ty; } - var llvm_field_types = std.ArrayListUnmanaged(Builder.Type){}; + var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty; defer llvm_field_types.deinit(o.gpa); // Although we can estimate how much capacity to add, these cannot be // relied upon because of the recursive calls to lowerType below. @@ -3481,7 +3481,7 @@ pub const Object = struct { return ty; }, .anon_struct_type => |anon_struct_type| { - var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .{}; + var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty; defer llvm_field_types.deinit(o.gpa); // Although we can estimate how much capacity to add, these cannot be // relied upon because of the recursive calls to lowerType below. @@ -3672,7 +3672,7 @@ pub const Object = struct { const target = zcu.getTarget(); const ret_ty = try lowerFnRetTy(o, fn_info); - var llvm_params = std.ArrayListUnmanaged(Builder.Type){}; + var llvm_params: std.ArrayListUnmanaged(Builder.Type) = .empty; defer llvm_params.deinit(o.gpa); if (firstParamSRet(fn_info, zcu, target)) { @@ -7438,7 +7438,7 @@ pub const FuncGen = struct { const inputs: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra_i..][0..extra.data.inputs_len]); extra_i += inputs.len; - var llvm_constraints: std.ArrayListUnmanaged(u8) = .{}; + var llvm_constraints: std.ArrayListUnmanaged(u8) = .empty; defer llvm_constraints.deinit(self.gpa); var arena_allocator = std.heap.ArenaAllocator.init(self.gpa); @@ -7466,7 +7466,7 @@ pub const FuncGen = struct { var llvm_param_i: usize = 0; var total_i: u16 = 0; - var name_map: std.StringArrayHashMapUnmanaged(u16) = .{}; + var name_map: std.StringArrayHashMapUnmanaged(u16) = .empty; try name_map.ensureUnusedCapacity(arena, max_param_count); var rw_extra_i = extra_i; diff --git a/src/codegen/llvm/Builder.zig b/src/codegen/llvm/Builder.zig index f6bfcab1ad..d3aa6e34c4 100644 --- a/src/codegen/llvm/Builder.zig +++ b/src/codegen/llvm/Builder.zig @@ -3994,7 +3994,7 @@ pub const Function = struct { names: [*]const String = &[0]String{}, value_indices: [*]const u32 = &[0]u32{}, strip: bool, - debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{}, + debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty, debug_values: []const Instruction.Index = &.{}, extra: []const u32 = &.{}, @@ -6166,7 +6166,7 @@ pub const WipFunction = struct { const value_indices = try gpa.alloc(u32, final_instructions_len); errdefer gpa.free(value_indices); - var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{}; + var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty; errdefer debug_locations.deinit(gpa); try debug_locations.ensureUnusedCapacity(gpa, @intCast(self.debug_locations.count())); @@ -9557,7 +9557,7 @@ pub fn printUnbuffered( } } - var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .{}; + var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .empty; defer attribute_groups.deinit(self.gpa); for (0.., self.functions.items) |function_i, function| { @@ -13133,7 +13133,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co // Write LLVM IR magic try bitcode.writeBits(ir.MAGIC, 32); - var record: std.ArrayListUnmanaged(u64) = .{}; + var record: std.ArrayListUnmanaged(u64) = .empty; defer record.deinit(self.gpa); // IDENTIFICATION_BLOCK @@ -13524,7 +13524,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co try paramattr_block.end(); } - var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .{}; + var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .empty; defer globals.deinit(self.gpa); try globals.ensureUnusedCapacity( self.gpa, @@ -13587,7 +13587,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co // Globals { - var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .{}; + var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .empty; defer section_map.deinit(self.gpa); try section_map.ensureUnusedCapacity(self.gpa, globals.count()); diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index afc7641072..dc45b26931 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -79,7 +79,7 @@ const ControlFlow = union(enum) { selection: struct { /// In order to know which merges we still need to do, we need to keep /// a stack of those. - merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .{}, + merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .empty, }, /// For a `loop` type block, we can early-exit the block by /// jumping to the loop exit node, and we don't need to generate @@ -87,7 +87,7 @@ const ControlFlow = union(enum) { loop: struct { /// The next block to jump to can be determined from any number /// of conditions that jump to the loop exit. - merges: std.ArrayListUnmanaged(Incoming) = .{}, + merges: std.ArrayListUnmanaged(Incoming) = .empty, /// The label id of the loop's merge block. merge_block: IdRef, }, @@ -102,10 +102,10 @@ const ControlFlow = union(enum) { }; /// The stack of (structured) blocks that we are currently in. This determines /// how exits from the current block must be handled. - block_stack: std.ArrayListUnmanaged(*Structured.Block) = .{}, + block_stack: std.ArrayListUnmanaged(*Structured.Block) = .empty, /// Maps `block` inst indices to the variable that the block's result /// value must be written to. - block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .{}, + block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .empty, }; const Unstructured = struct { @@ -116,12 +116,12 @@ const ControlFlow = union(enum) { const Block = struct { label: ?IdRef = null, - incoming_blocks: std.ArrayListUnmanaged(Incoming) = .{}, + incoming_blocks: std.ArrayListUnmanaged(Incoming) = .empty, }; /// We need to keep track of result ids for block labels, as well as the 'incoming' /// blocks for a block. - blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .{}, + blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .empty, }; structured: Structured, @@ -153,10 +153,10 @@ pub const Object = struct { /// The Zig module that this object file is generated for. /// A map of Zig decl indices to SPIR-V decl indices. - nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, SpvModule.Decl.Index) = .{}, + nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, SpvModule.Decl.Index) = .empty, /// A map of Zig InternPool indices for anonymous decls to SPIR-V decl indices. - uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .{}, + uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .empty, /// A map that maps AIR intern pool indices to SPIR-V result-ids. intern_map: InternMap = .{}, @@ -300,7 +300,7 @@ const NavGen = struct { /// An array of function argument result-ids. Each index corresponds with the /// function argument of the same index. - args: std.ArrayListUnmanaged(IdRef) = .{}, + args: std.ArrayListUnmanaged(IdRef) = .empty, /// A counter to keep track of how many `arg` instructions we've seen yet. next_arg_index: u32 = 0, @@ -6270,7 +6270,7 @@ const NavGen = struct { } } - var incoming_structured_blocks = std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming){}; + var incoming_structured_blocks: std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming) = .empty; defer incoming_structured_blocks.deinit(self.gpa); if (self.control_flow == .structured) { diff --git a/src/codegen/spirv/Assembler.zig b/src/codegen/spirv/Assembler.zig index 2cbb873d30..9e39f2ed09 100644 --- a/src/codegen/spirv/Assembler.zig +++ b/src/codegen/spirv/Assembler.zig @@ -148,7 +148,7 @@ const AsmValueMap = std.StringArrayHashMapUnmanaged(AsmValue); gpa: Allocator, /// A list of errors that occured during processing the assembly. -errors: std.ArrayListUnmanaged(ErrorMsg) = .{}, +errors: std.ArrayListUnmanaged(ErrorMsg) = .empty, /// The source code that is being assembled. src: []const u8, @@ -161,7 +161,7 @@ spv: *SpvModule, func: *SpvModule.Fn, /// `self.src` tokenized. -tokens: std.ArrayListUnmanaged(Token) = .{}, +tokens: std.ArrayListUnmanaged(Token) = .empty, /// The token that is next during parsing. current_token: u32 = 0, @@ -172,9 +172,9 @@ inst: struct { /// The opcode of the current instruction. opcode: Opcode = undefined, /// Operands of the current instruction. - operands: std.ArrayListUnmanaged(Operand) = .{}, + operands: std.ArrayListUnmanaged(Operand) = .empty, /// This is where string data resides. Strings are zero-terminated. - string_bytes: std.ArrayListUnmanaged(u8) = .{}, + string_bytes: std.ArrayListUnmanaged(u8) = .empty, /// Return a reference to the result of this instruction, if any. fn result(self: @This()) ?AsmValue.Ref { @@ -196,7 +196,7 @@ value_map: AsmValueMap = .{}, /// This set is used to quickly transform from an opcode name to the /// index in its instruction set. The index of the key is the /// index in `spec.InstructionSet.core.instructions()`. -instruction_map: std.StringArrayHashMapUnmanaged(void) = .{}, +instruction_map: std.StringArrayHashMapUnmanaged(void) = .empty, /// Free the resources owned by this assembler. pub fn deinit(self: *Assembler) void { diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index ae30de156b..94787e06b9 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -35,7 +35,7 @@ pub const Fn = struct { /// the end of this function definition. body: Section = .{}, /// The decl dependencies that this function depends on. - decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .{}, + decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .empty, /// Reset this function without deallocating resources, so that /// it may be used to emit code for another function. @@ -141,7 +141,7 @@ sections: struct { next_result_id: Word, /// Cache for results of OpString instructions. -strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, +strings: std.StringArrayHashMapUnmanaged(IdRef) = .empty, /// Some types shouldn't be emitted more than one time, but cannot be caught by /// the `intern_map` during codegen. Sometimes, IDs are compared to check if @@ -154,27 +154,27 @@ strings: std.StringArrayHashMapUnmanaged(IdRef) = .{}, cache: struct { bool_type: ?IdRef = null, void_type: ?IdRef = null, - int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .{}, - float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .{}, + int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .empty, + float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .empty, // This cache is required so that @Vector(X, u1) in direct representation has the // same ID as @Vector(X, bool) in indirect representation. - vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .{}, + vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .empty, - builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .{}, + builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .empty, } = .{}, /// Set of Decls, referred to by Decl.Index. -decls: std.ArrayListUnmanaged(Decl) = .{}, +decls: std.ArrayListUnmanaged(Decl) = .empty, /// List of dependencies, per decl. This list holds all the dependencies, sliced by the /// begin_dep and end_dep in `self.decls`. -decl_deps: std.ArrayListUnmanaged(Decl.Index) = .{}, +decl_deps: std.ArrayListUnmanaged(Decl.Index) = .empty, /// The list of entry points that should be exported from this module. -entry_points: std.ArrayListUnmanaged(EntryPoint) = .{}, +entry_points: std.ArrayListUnmanaged(EntryPoint) = .empty, /// The list of extended instruction sets that should be imported. -extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .{}, +extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .empty, pub fn init(gpa: Allocator) Module { return .{ diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig index 20abf8ab70..1fdf884bdb 100644 --- a/src/codegen/spirv/Section.zig +++ b/src/codegen/spirv/Section.zig @@ -15,7 +15,7 @@ const Opcode = spec.Opcode; /// The instructions in this section. Memory is owned by the Module /// externally associated to this Section. -instructions: std.ArrayListUnmanaged(Word) = .{}, +instructions: std.ArrayListUnmanaged(Word) = .empty, pub fn deinit(section: *Section, allocator: Allocator) void { section.instructions.deinit(allocator); diff --git a/src/link/C.zig b/src/link/C.zig index 7d00ad9028..a674b256b0 100644 --- a/src/link/C.zig +++ b/src/link/C.zig @@ -26,34 +26,34 @@ base: link.File, /// This linker backend does not try to incrementally link output C source code. /// Instead, it tracks all declarations in this table, and iterates over it /// in the flush function, stitching pre-rendered pieces of C code together. -navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .{}, +navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .empty, /// All the string bytes of rendered C code, all squished into one array. /// While in progress, a separate buffer is used, and then when finished, the /// buffer is copied into this one. -string_bytes: std.ArrayListUnmanaged(u8) = .{}, +string_bytes: std.ArrayListUnmanaged(u8) = .empty, /// Tracks all the anonymous decls that are used by all the decls so they can /// be rendered during flush(). -uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .{}, +uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .empty, /// Sparse set of uavs that are overaligned. Underaligned anon decls are /// lowered the same as ABI-aligned anon decls. The keys here are a subset of /// the keys of `uavs`. -aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .{}, +aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .empty, -exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .{}, -exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .{}, +exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .empty, +exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .empty, /// Optimization, `updateDecl` reuses this buffer rather than creating a new /// one with every call. -fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{}, +fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty, /// Optimization, `updateDecl` reuses this buffer rather than creating a new /// one with every call. -code_buf: std.ArrayListUnmanaged(u8) = .{}, +code_buf: std.ArrayListUnmanaged(u8) = .empty, /// Optimization, `flush` reuses this buffer rather than creating a new /// one with every call. -lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{}, +lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty, /// Optimization, `flush` reuses this buffer rather than creating a new /// one with every call. -lazy_code_buf: std.ArrayListUnmanaged(u8) = .{}, +lazy_code_buf: std.ArrayListUnmanaged(u8) = .empty, /// A reference into `string_bytes`. const String = extern struct { @@ -469,7 +469,7 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: // `CType`s, forward decls, and non-functions first. { - var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{}; + var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty; defer export_names.deinit(gpa); try export_names.ensureTotalCapacity(gpa, @intCast(zcu.single_exports.count())); for (zcu.single_exports.values()) |export_index| { @@ -559,16 +559,16 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: const Flush = struct { ctype_pool: codegen.CType.Pool, - ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .{}, - ctypes_buf: std.ArrayListUnmanaged(u8) = .{}, + ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .empty, + ctypes_buf: std.ArrayListUnmanaged(u8) = .empty, lazy_ctype_pool: codegen.CType.Pool, lazy_fns: LazyFns = .{}, - asm_buf: std.ArrayListUnmanaged(u8) = .{}, + asm_buf: std.ArrayListUnmanaged(u8) = .empty, /// We collect a list of buffers to write, and write them all at once with pwritev 😎 - all_buffers: std.ArrayListUnmanaged(std.posix.iovec_const) = .{}, + all_buffers: std.ArrayListUnmanaged(std.posix.iovec_const) = .empty, /// Keeps track of the total bytes of `all_buffers`. file_size: u64 = 0, diff --git a/src/link/Coff.zig b/src/link/Coff.zig index f67c7d54d7..24040cb2f8 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -26,7 +26,7 @@ repro: bool, ptr_width: PtrWidth, page_size: u32, -objects: std.ArrayListUnmanaged(Object) = .{}, +objects: std.ArrayListUnmanaged(Object) = .empty, sections: std.MultiArrayList(Section) = .{}, data_directories: [coff.IMAGE_NUMBEROF_DIRECTORY_ENTRIES]coff.ImageDataDirectory, @@ -38,14 +38,14 @@ data_section_index: ?u16 = null, reloc_section_index: ?u16 = null, idata_section_index: ?u16 = null, -locals: std.ArrayListUnmanaged(coff.Symbol) = .{}, -globals: std.ArrayListUnmanaged(SymbolWithLoc) = .{}, -resolver: std.StringHashMapUnmanaged(u32) = .{}, -unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .{}, -need_got_table: std.AutoHashMapUnmanaged(u32, void) = .{}, +locals: std.ArrayListUnmanaged(coff.Symbol) = .empty, +globals: std.ArrayListUnmanaged(SymbolWithLoc) = .empty, +resolver: std.StringHashMapUnmanaged(u32) = .empty, +unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .empty, +need_got_table: std.AutoHashMapUnmanaged(u32, void) = .empty, -locals_free_list: std.ArrayListUnmanaged(u32) = .{}, -globals_free_list: std.ArrayListUnmanaged(u32) = .{}, +locals_free_list: std.ArrayListUnmanaged(u32) = .empty, +globals_free_list: std.ArrayListUnmanaged(u32) = .empty, strtab: StringTable = .{}, strtab_offset: ?u32 = null, @@ -56,7 +56,7 @@ got_table: TableSection(SymbolWithLoc) = .{}, /// A table of ImportTables partitioned by the library name. /// Key is an offset into the interning string table `temp_strtab`. -import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .{}, +import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .empty, got_table_count_dirty: bool = true, got_table_contents_dirty: bool = true, @@ -69,10 +69,10 @@ lazy_syms: LazySymbolTable = .{}, navs: NavTable = .{}, /// List of atoms that are either synthetic or map directly to the Zig source program. -atoms: std.ArrayListUnmanaged(Atom) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, /// Table of atoms indexed by the symbol index. -atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{}, +atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty, uavs: UavTable = .{}, @@ -131,7 +131,7 @@ const Section = struct { /// overcapacity can be negative. A simple way to have negative overcapacity is to /// allocate a fresh atom, which will have ideal capacity, and then grow it /// by 1 byte. It will then have -1 overcapacity. - free_list: std.ArrayListUnmanaged(Atom.Index) = .{}, + free_list: std.ArrayListUnmanaged(Atom.Index) = .empty, }; const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata); @@ -148,7 +148,7 @@ const AvMetadata = struct { atom: Atom.Index, section: u16, /// A list of all exports aliases of this Decl. - exports: std.ArrayListUnmanaged(u32) = .{}, + exports: std.ArrayListUnmanaged(u32) = .empty, fn deinit(m: *AvMetadata, allocator: Allocator) void { m.exports.deinit(allocator); diff --git a/src/link/Coff/ImportTable.zig b/src/link/Coff/ImportTable.zig index c25851fe72..9ce00cf5ee 100644 --- a/src/link/Coff/ImportTable.zig +++ b/src/link/Coff/ImportTable.zig @@ -26,9 +26,9 @@ //! DLL#2 name //! --- END -entries: std.ArrayListUnmanaged(SymbolWithLoc) = .{}, -free_list: std.ArrayListUnmanaged(u32) = .{}, -lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .{}, +entries: std.ArrayListUnmanaged(SymbolWithLoc) = .empty, +free_list: std.ArrayListUnmanaged(u32) = .empty, +lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .empty, pub fn deinit(itab: *ImportTable, allocator: Allocator) void { itab.entries.deinit(allocator); diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 333501b29f..ba3abcf330 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -39,11 +39,11 @@ files: std.MultiArrayList(File.Entry) = .{}, /// Long-lived list of all file descriptors. /// We store them globally rather than per actual File so that we can re-use /// one file handle per every object file within an archive. -file_handles: std.ArrayListUnmanaged(File.Handle) = .{}, +file_handles: std.ArrayListUnmanaged(File.Handle) = .empty, zig_object_index: ?File.Index = null, linker_defined_index: ?File.Index = null, -objects: std.ArrayListUnmanaged(File.Index) = .{}, -shared_objects: std.ArrayListUnmanaged(File.Index) = .{}, +objects: std.ArrayListUnmanaged(File.Index) = .empty, +shared_objects: std.ArrayListUnmanaged(File.Index) = .empty, /// List of all output sections and their associated metadata. sections: std.MultiArrayList(Section) = .{}, @@ -52,7 +52,7 @@ shdr_table_offset: ?u64 = null, /// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write. /// Same order as in the file. -phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .{}, +phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .empty, /// Special program headers /// PT_PHDR @@ -77,23 +77,23 @@ page_size: u32, default_sym_version: elf.Elf64_Versym, /// .shstrtab buffer -shstrtab: std.ArrayListUnmanaged(u8) = .{}, +shstrtab: std.ArrayListUnmanaged(u8) = .empty, /// .symtab buffer -symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, +symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, /// .strtab buffer -strtab: std.ArrayListUnmanaged(u8) = .{}, +strtab: std.ArrayListUnmanaged(u8) = .empty, /// Dynamic symbol table. Only populated and emitted when linking dynamically. dynsym: DynsymSection = .{}, /// .dynstrtab buffer -dynstrtab: std.ArrayListUnmanaged(u8) = .{}, +dynstrtab: std.ArrayListUnmanaged(u8) = .empty, /// Version symbol table. Only populated and emitted when linking dynamically. -versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{}, +versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty, /// .verneed section verneed: VerneedSection = .{}, /// .got section got: GotSection = .{}, /// .rela.dyn section -rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, +rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, /// .dynamic section dynamic: DynamicSection = .{}, /// .hash section @@ -109,10 +109,10 @@ plt_got: PltGotSection = .{}, /// .copyrel section copy_rel: CopyRelSection = .{}, /// .rela.plt section -rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, +rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, /// SHT_GROUP sections /// Applies only to a relocatable. -comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .{}, +comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .empty, copy_rel_section_index: ?u32 = null, dynamic_section_index: ?u32 = null, @@ -143,10 +143,10 @@ has_text_reloc: bool = false, num_ifunc_dynrelocs: usize = 0, /// List of range extension thunks. -thunks: std.ArrayListUnmanaged(Thunk) = .{}, +thunks: std.ArrayListUnmanaged(Thunk) = .empty, /// List of output merge sections with deduped contents. -merge_sections: std.ArrayListUnmanaged(MergeSection) = .{}, +merge_sections: std.ArrayListUnmanaged(MergeSection) = .empty, first_eflags: ?elf.Elf64_Word = null, @@ -5487,9 +5487,9 @@ pub const Ref = struct { }; pub const SymbolResolver = struct { - keys: std.ArrayListUnmanaged(Key) = .{}, - values: std.ArrayListUnmanaged(Ref) = .{}, - table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, + keys: std.ArrayListUnmanaged(Key) = .empty, + values: std.ArrayListUnmanaged(Ref) = .empty, + table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, const Result = struct { found_existing: bool, @@ -5586,7 +5586,7 @@ const Section = struct { /// List of atoms contributing to this section. /// TODO currently this is only used for relocations tracking in relocatable mode /// but will be merged with atom_list_2. - atom_list: std.ArrayListUnmanaged(Ref) = .{}, + atom_list: std.ArrayListUnmanaged(Ref) = .empty, /// List of atoms contributing to this section. /// This can be used by sections that require special handling such as init/fini array, etc. @@ -5610,7 +5610,7 @@ const Section = struct { /// overcapacity can be negative. A simple way to have negative overcapacity is to /// allocate a fresh text block, which will have ideal capacity, and then grow it /// by 1 byte. It will then have -1 overcapacity. - free_list: std.ArrayListUnmanaged(Ref) = .{}, + free_list: std.ArrayListUnmanaged(Ref) = .empty, }; fn defaultEntrySymbolName(cpu_arch: std.Target.Cpu.Arch) []const u8 { diff --git a/src/link/Elf/Archive.zig b/src/link/Elf/Archive.zig index 030ddc13c6..8a97161034 100644 --- a/src/link/Elf/Archive.zig +++ b/src/link/Elf/Archive.zig @@ -1,5 +1,5 @@ -objects: std.ArrayListUnmanaged(Object) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +objects: std.ArrayListUnmanaged(Object) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, pub fn isArchive(path: []const u8) !bool { const file = try std.fs.cwd().openFile(path, .{}); @@ -127,7 +127,7 @@ const strtab_delimiter = '\n'; pub const max_member_name_len = 15; pub const ArSymtab = struct { - symtab: std.ArrayListUnmanaged(Entry) = .{}, + symtab: std.ArrayListUnmanaged(Entry) = .empty, strtab: StringTable = .{}, pub fn deinit(ar: *ArSymtab, allocator: Allocator) void { @@ -241,7 +241,7 @@ pub const ArSymtab = struct { }; pub const ArStrtab = struct { - buffer: std.ArrayListUnmanaged(u8) = .{}, + buffer: std.ArrayListUnmanaged(u8) = .empty, pub fn deinit(ar: *ArStrtab, allocator: Allocator) void { ar.buffer.deinit(allocator); diff --git a/src/link/Elf/AtomList.zig b/src/link/Elf/AtomList.zig index 51407ca6d9..5fc1893376 100644 --- a/src/link/Elf/AtomList.zig +++ b/src/link/Elf/AtomList.zig @@ -2,7 +2,7 @@ value: i64 = 0, size: u64 = 0, alignment: Atom.Alignment = .@"1", output_section_index: u32 = 0, -atoms: std.ArrayListUnmanaged(Elf.Ref) = .{}, +atoms: std.ArrayListUnmanaged(Elf.Ref) = .empty, pub fn deinit(list: *AtomList, allocator: Allocator) void { list.atoms.deinit(allocator); diff --git a/src/link/Elf/LdScript.zig b/src/link/Elf/LdScript.zig index 414ce035a4..bf5efd2137 100644 --- a/src/link/Elf/LdScript.zig +++ b/src/link/Elf/LdScript.zig @@ -1,6 +1,6 @@ path: []const u8, cpu_arch: ?std.Target.Cpu.Arch = null, -args: std.ArrayListUnmanaged(Elf.SystemLib) = .{}, +args: std.ArrayListUnmanaged(Elf.SystemLib) = .empty, pub fn deinit(scr: *LdScript, allocator: Allocator) void { scr.args.deinit(allocator); diff --git a/src/link/Elf/LinkerDefined.zig b/src/link/Elf/LinkerDefined.zig index 131ed6ad71..59aea19efa 100644 --- a/src/link/Elf/LinkerDefined.zig +++ b/src/link/Elf/LinkerDefined.zig @@ -1,11 +1,11 @@ index: File.Index, -symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, entry_index: ?Symbol.Index = null, dynamic_index: ?Symbol.Index = null, @@ -24,7 +24,7 @@ dso_handle_index: ?Symbol.Index = null, rela_iplt_start_index: ?Symbol.Index = null, rela_iplt_end_index: ?Symbol.Index = null, global_pointer_index: ?Symbol.Index = null, -start_stop_indexes: std.ArrayListUnmanaged(u32) = .{}, +start_stop_indexes: std.ArrayListUnmanaged(u32) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig index 18c7a91c8f..a7091b7394 100644 --- a/src/link/Elf/Object.zig +++ b/src/link/Elf/Object.zig @@ -4,29 +4,29 @@ file_handle: File.HandleIndex, index: File.Index, header: ?elf.Elf64_Ehdr = null, -shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{}, +shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty, -symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, first_global: ?Symbol.Index = null, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, -relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, +relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, -comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .{}, -comdat_group_data: std.ArrayListUnmanaged(u32) = .{}, +comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .empty, +comdat_group_data: std.ArrayListUnmanaged(u32) = .empty, -input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .{}, -input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .{}, +input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .empty, +input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .empty, -fdes: std.ArrayListUnmanaged(Fde) = .{}, -cies: std.ArrayListUnmanaged(Cie) = .{}, -eh_frame_data: std.ArrayListUnmanaged(u8) = .{}, +fdes: std.ArrayListUnmanaged(Fde) = .empty, +cies: std.ArrayListUnmanaged(Cie) = .empty, +eh_frame_data: std.ArrayListUnmanaged(u8) = .empty, alive: bool = true, num_dynrelocs: u32 = 0, diff --git a/src/link/Elf/SharedObject.zig b/src/link/Elf/SharedObject.zig index 677e63ebaf..3000af39ca 100644 --- a/src/link/Elf/SharedObject.zig +++ b/src/link/Elf/SharedObject.zig @@ -2,20 +2,20 @@ path: []const u8, index: File.Index, header: ?elf.Elf64_Ehdr = null, -shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{}, +shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty, -symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, /// Version symtab contains version strings of the symbols if present. -versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{}, -verstrings: std.ArrayListUnmanaged(u32) = .{}, +versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty, +verstrings: std.ArrayListUnmanaged(u32) = .empty, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, aliases: ?std.ArrayListUnmanaged(u32) = null, -dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .{}, +dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .empty, needed: bool, alive: bool, diff --git a/src/link/Elf/Thunk.zig b/src/link/Elf/Thunk.zig index 389ba7ffed..23dc2f3b0b 100644 --- a/src/link/Elf/Thunk.zig +++ b/src/link/Elf/Thunk.zig @@ -1,6 +1,6 @@ value: i64 = 0, output_section_index: u32 = 0, -symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .{}, +symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, pub fn deinit(thunk: *Thunk, allocator: Allocator) void { diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig index 98449d6a5b..671049919d 100644 --- a/src/link/Elf/ZigObject.zig +++ b/src/link/Elf/ZigObject.zig @@ -3,24 +3,24 @@ //! and any relocations that may have been emitted. //! Think about this as fake in-memory Object file for the Zig module. -data: std.ArrayListUnmanaged(u8) = .{}, +data: std.ArrayListUnmanaged(u8) = .empty, /// Externally owned memory. path: []const u8, index: File.Index, symtab: std.MultiArrayList(ElfSym) = .{}, strtab: StringTable = .{}, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{}, -local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, -global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, -globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{}, - -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, -relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty, +local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, +global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, +globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty, + +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, +relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .empty, num_dynrelocs: u32 = 0, @@ -2313,7 +2313,7 @@ const LazySymbolMetadata = struct { const AvMetadata = struct { symbol_index: Symbol.Index, /// A list of all exports aliases of this Av. - exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, + exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, /// Set to true if the AV has been initialized and allocated. allocated: bool = false, diff --git a/src/link/Elf/merge_section.zig b/src/link/Elf/merge_section.zig index 6241e1aec9..cf6506a9ea 100644 --- a/src/link/Elf/merge_section.zig +++ b/src/link/Elf/merge_section.zig @@ -7,15 +7,15 @@ pub const MergeSection = struct { type: u32 = 0, flags: u64 = 0, output_section_index: u32 = 0, - bytes: std.ArrayListUnmanaged(u8) = .{}, + bytes: std.ArrayListUnmanaged(u8) = .empty, table: std.HashMapUnmanaged( String, MergeSubsection.Index, IndexContext, std.hash_map.default_max_load_percentage, ) = .{}, - subsections: std.ArrayListUnmanaged(MergeSubsection) = .{}, - finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{}, + subsections: std.ArrayListUnmanaged(MergeSubsection) = .empty, + finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty, pub fn deinit(msec: *MergeSection, allocator: Allocator) void { msec.bytes.deinit(allocator); @@ -276,10 +276,10 @@ pub const MergeSubsection = struct { pub const InputMergeSection = struct { merge_section_index: MergeSection.Index = 0, atom_index: Atom.Index = 0, - offsets: std.ArrayListUnmanaged(u32) = .{}, - subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{}, - bytes: std.ArrayListUnmanaged(u8) = .{}, - strings: std.ArrayListUnmanaged(String) = .{}, + offsets: std.ArrayListUnmanaged(u32) = .empty, + subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty, + bytes: std.ArrayListUnmanaged(u8) = .empty, + strings: std.ArrayListUnmanaged(String) = .empty, pub fn deinit(imsec: *InputMergeSection, allocator: Allocator) void { imsec.offsets.deinit(allocator); diff --git a/src/link/Elf/synthetic_sections.zig b/src/link/Elf/synthetic_sections.zig index a159ba23c1..f914bb8d84 100644 --- a/src/link/Elf/synthetic_sections.zig +++ b/src/link/Elf/synthetic_sections.zig @@ -1,6 +1,6 @@ pub const DynamicSection = struct { soname: ?u32 = null, - needed: std.ArrayListUnmanaged(u32) = .{}, + needed: std.ArrayListUnmanaged(u32) = .empty, rpath: u32 = 0, pub fn deinit(dt: *DynamicSection, allocator: Allocator) void { @@ -226,7 +226,7 @@ pub const DynamicSection = struct { }; pub const GotSection = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, tlsld_index: ?u32 = null, flags: Flags = .{}, @@ -629,7 +629,7 @@ pub const GotSection = struct { }; pub const PltSection = struct { - symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, + symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, pub fn deinit(plt: *PltSection, allocator: Allocator) void { @@ -883,7 +883,7 @@ pub const GotPltSection = struct { }; pub const PltGotSection = struct { - symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, + symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, pub fn deinit(plt_got: *PltGotSection, allocator: Allocator) void { @@ -994,7 +994,7 @@ pub const PltGotSection = struct { }; pub const CopyRelSection = struct { - symbols: std.ArrayListUnmanaged(Elf.Ref) = .{}, + symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty, pub fn deinit(copy_rel: *CopyRelSection, allocator: Allocator) void { copy_rel.symbols.deinit(allocator); @@ -1072,7 +1072,7 @@ pub const CopyRelSection = struct { }; pub const DynsymSection = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, pub const Entry = struct { /// Ref of the symbol which gets privilege of getting a dynamic treatment @@ -1156,7 +1156,7 @@ pub const DynsymSection = struct { }; pub const HashSection = struct { - buffer: std.ArrayListUnmanaged(u8) = .{}, + buffer: std.ArrayListUnmanaged(u8) = .empty, pub fn deinit(hs: *HashSection, allocator: Allocator) void { hs.buffer.deinit(allocator); @@ -1320,8 +1320,8 @@ pub const GnuHashSection = struct { }; pub const VerneedSection = struct { - verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .{}, - vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .{}, + verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .empty, + vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .empty, index: elf.Elf64_Versym = elf.VER_NDX_GLOBAL + 1, pub fn deinit(vern: *VerneedSection, allocator: Allocator) void { diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 27bfc9392e..42923ecfba 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -13,21 +13,21 @@ files: std.MultiArrayList(File.Entry) = .{}, /// Long-lived list of all file descriptors. /// We store them globally rather than per actual File so that we can re-use /// one file handle per every object file within an archive. -file_handles: std.ArrayListUnmanaged(File.Handle) = .{}, +file_handles: std.ArrayListUnmanaged(File.Handle) = .empty, zig_object: ?File.Index = null, internal_object: ?File.Index = null, -objects: std.ArrayListUnmanaged(File.Index) = .{}, -dylibs: std.ArrayListUnmanaged(File.Index) = .{}, +objects: std.ArrayListUnmanaged(File.Index) = .empty, +dylibs: std.ArrayListUnmanaged(File.Index) = .empty, -segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{}, +segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty, sections: std.MultiArrayList(Section) = .{}, resolver: SymbolResolver = .{}, /// This table will be populated after `scanRelocs` has run. /// Key is symbol index. -undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .{}, +undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .empty, undefs_mutex: std.Thread.Mutex = .{}, -dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .{}, +dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .empty, dupes_mutex: std.Thread.Mutex = .{}, dyld_info_cmd: macho.dyld_info_command = .{}, @@ -52,11 +52,11 @@ eh_frame_sect_index: ?u8 = null, unwind_info_sect_index: ?u8 = null, objc_stubs_sect_index: ?u8 = null, -thunks: std.ArrayListUnmanaged(Thunk) = .{}, +thunks: std.ArrayListUnmanaged(Thunk) = .empty, /// Output synthetic sections -symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, indsymtab: Indsymtab = .{}, got: GotSection = .{}, stubs: StubsSection = .{}, @@ -4041,19 +4041,19 @@ const default_entry_symbol_name = "_main"; const Section = struct { header: macho.section_64, segment_id: u8, - atoms: std.ArrayListUnmanaged(Ref) = .{}, - free_list: std.ArrayListUnmanaged(Atom.Index) = .{}, + atoms: std.ArrayListUnmanaged(Ref) = .empty, + free_list: std.ArrayListUnmanaged(Atom.Index) = .empty, last_atom_index: Atom.Index = 0, - thunks: std.ArrayListUnmanaged(Thunk.Index) = .{}, - out: std.ArrayListUnmanaged(u8) = .{}, - relocs: std.ArrayListUnmanaged(macho.relocation_info) = .{}, + thunks: std.ArrayListUnmanaged(Thunk.Index) = .empty, + out: std.ArrayListUnmanaged(u8) = .empty, + relocs: std.ArrayListUnmanaged(macho.relocation_info) = .empty, }; pub const LiteralPool = struct { - table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, - keys: std.ArrayListUnmanaged(Key) = .{}, - values: std.ArrayListUnmanaged(MachO.Ref) = .{}, - data: std.ArrayListUnmanaged(u8) = .{}, + table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, + keys: std.ArrayListUnmanaged(Key) = .empty, + values: std.ArrayListUnmanaged(MachO.Ref) = .empty, + data: std.ArrayListUnmanaged(u8) = .empty, pub fn deinit(lp: *LiteralPool, allocator: Allocator) void { lp.table.deinit(allocator); @@ -4480,9 +4480,9 @@ pub const Ref = struct { }; pub const SymbolResolver = struct { - keys: std.ArrayListUnmanaged(Key) = .{}, - values: std.ArrayListUnmanaged(Ref) = .{}, - table: std.AutoArrayHashMapUnmanaged(void, void) = .{}, + keys: std.ArrayListUnmanaged(Key) = .empty, + values: std.ArrayListUnmanaged(Ref) = .empty, + table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, const Result = struct { found_existing: bool, diff --git a/src/link/MachO/Archive.zig b/src/link/MachO/Archive.zig index a1c8b84deb..bb589dfb66 100644 --- a/src/link/MachO/Archive.zig +++ b/src/link/MachO/Archive.zig @@ -1,4 +1,4 @@ -objects: std.ArrayListUnmanaged(Object) = .{}, +objects: std.ArrayListUnmanaged(Object) = .empty, pub fn deinit(self: *Archive, allocator: Allocator) void { self.objects.deinit(allocator); @@ -181,7 +181,7 @@ pub const ar_hdr = extern struct { }; pub const ArSymtab = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, strtab: StringTable = .{}, pub fn deinit(ar: *ArSymtab, allocator: Allocator) void { diff --git a/src/link/MachO/CodeSignature.zig b/src/link/MachO/CodeSignature.zig index 0b9c12204f..c8a092eab6 100644 --- a/src/link/MachO/CodeSignature.zig +++ b/src/link/MachO/CodeSignature.zig @@ -53,7 +53,7 @@ const CodeDirectory = struct { inner: macho.CodeDirectory, ident: []const u8, special_slots: [n_special_slots][hash_size]u8, - code_slots: std.ArrayListUnmanaged([hash_size]u8) = .{}, + code_slots: std.ArrayListUnmanaged([hash_size]u8) = .empty, const n_special_slots: usize = 7; diff --git a/src/link/MachO/DebugSymbols.zig b/src/link/MachO/DebugSymbols.zig index 7d00c413c2..093a202fd4 100644 --- a/src/link/MachO/DebugSymbols.zig +++ b/src/link/MachO/DebugSymbols.zig @@ -4,8 +4,8 @@ file: fs.File, symtab_cmd: macho.symtab_command = .{}, uuid_cmd: macho.uuid_command = .{ .uuid = [_]u8{0} ** 16 }, -segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{}, -sections: std.ArrayListUnmanaged(macho.section_64) = .{}, +segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty, +sections: std.ArrayListUnmanaged(macho.section_64) = .empty, dwarf_segment_cmd_index: ?u8 = null, linkedit_segment_cmd_index: ?u8 = null, @@ -19,11 +19,11 @@ debug_line_str_section_index: ?u8 = null, debug_loclists_section_index: ?u8 = null, debug_rnglists_section_index: ?u8 = null, -relocs: std.ArrayListUnmanaged(Reloc) = .{}, +relocs: std.ArrayListUnmanaged(Reloc) = .empty, /// Output synthetic sections -symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, pub const Reloc = struct { type: enum { diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index f5ed166ee0..9852cfb234 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -6,15 +6,15 @@ file_handle: File.HandleIndex, tag: enum { dylib, tbd }, exports: std.MultiArrayList(Export) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +strtab: std.ArrayListUnmanaged(u8) = .empty, id: ?Id = null, ordinal: u16 = 0, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, -dependents: std.ArrayListUnmanaged(Id) = .{}, -rpaths: std.StringArrayHashMapUnmanaged(void) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, +dependents: std.ArrayListUnmanaged(Id) = .empty, +rpaths: std.StringArrayHashMapUnmanaged(void) = .empty, umbrella: File.Index, platform: ?MachO.Platform = null, @@ -742,7 +742,7 @@ pub const TargetMatcher = struct { allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM, - target_strings: std.ArrayListUnmanaged([]const u8) = .{}, + target_strings: std.ArrayListUnmanaged([]const u8) = .empty, pub fn init(allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM) !TargetMatcher { var self = TargetMatcher{ diff --git a/src/link/MachO/InternalObject.zig b/src/link/MachO/InternalObject.zig index 4054429ef8..ed7a05b023 100644 --- a/src/link/MachO/InternalObject.zig +++ b/src/link/MachO/InternalObject.zig @@ -1,19 +1,19 @@ index: File.Index, sections: std.MultiArrayList(Section) = .{}, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, -symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, - -objc_methnames: std.ArrayListUnmanaged(u8) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, +symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty, +strtab: std.ArrayListUnmanaged(u8) = .empty, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, + +objc_methnames: std.ArrayListUnmanaged(u8) = .empty, objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64), -force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .{}, +force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .empty, entry_index: ?Symbol.Index = null, dyld_stub_binder_index: ?Symbol.Index = null, dyld_private_index: ?Symbol.Index = null, @@ -21,7 +21,7 @@ objc_msg_send_index: ?Symbol.Index = null, mh_execute_header_index: ?Symbol.Index = null, mh_dylib_header_index: ?Symbol.Index = null, dso_handle_index: ?Symbol.Index = null, -boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{}, +boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty, output_symtab_ctx: MachO.SymtabCtx = .{}, @@ -849,7 +849,7 @@ fn formatSymtab( const Section = struct { header: macho.section_64, - relocs: std.ArrayListUnmanaged(Relocation) = .{}, + relocs: std.ArrayListUnmanaged(Relocation) = .empty, extra: Extra = .{}, const Extra = packed struct { diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig index 4d2662a838..81f28de65a 100644 --- a/src/link/MachO/Object.zig +++ b/src/link/MachO/Object.zig @@ -9,27 +9,27 @@ in_archive: ?InArchive = null, header: ?macho.mach_header_64 = null, sections: std.MultiArrayList(Section) = .{}, symtab: std.MultiArrayList(Nlist) = .{}, -strtab: std.ArrayListUnmanaged(u8) = .{}, +strtab: std.ArrayListUnmanaged(u8) = .empty, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, platform: ?MachO.Platform = null, compile_unit: ?CompileUnit = null, -stab_files: std.ArrayListUnmanaged(StabFile) = .{}, +stab_files: std.ArrayListUnmanaged(StabFile) = .empty, eh_frame_sect_index: ?u8 = null, compact_unwind_sect_index: ?u8 = null, -cies: std.ArrayListUnmanaged(Cie) = .{}, -fdes: std.ArrayListUnmanaged(Fde) = .{}, -eh_frame_data: std.ArrayListUnmanaged(u8) = .{}, -unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .{}, -unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .{}, -data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .{}, +cies: std.ArrayListUnmanaged(Cie) = .empty, +fdes: std.ArrayListUnmanaged(Fde) = .empty, +eh_frame_data: std.ArrayListUnmanaged(u8) = .empty, +unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .empty, +unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .empty, +data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .empty, alive: bool = true, hidden: bool = false, @@ -2675,8 +2675,8 @@ fn formatPath( const Section = struct { header: macho.section_64, - subsections: std.ArrayListUnmanaged(Subsection) = .{}, - relocs: std.ArrayListUnmanaged(Relocation) = .{}, + subsections: std.ArrayListUnmanaged(Subsection) = .empty, + relocs: std.ArrayListUnmanaged(Relocation) = .empty, }; const Subsection = struct { @@ -2692,7 +2692,7 @@ pub const Nlist = struct { const StabFile = struct { comp_dir: u32, - stabs: std.ArrayListUnmanaged(Stab) = .{}, + stabs: std.ArrayListUnmanaged(Stab) = .empty, fn getCompDir(sf: StabFile, object: Object) [:0]const u8 { const nlist = object.symtab.items(.nlist)[sf.comp_dir]; diff --git a/src/link/MachO/Thunk.zig b/src/link/MachO/Thunk.zig index 4a76a408ed..d720d4fd25 100644 --- a/src/link/MachO/Thunk.zig +++ b/src/link/MachO/Thunk.zig @@ -1,6 +1,6 @@ value: u64 = 0, out_n_sect: u8 = 0, -symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .{}, +symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .empty, output_symtab_ctx: MachO.SymtabCtx = .{}, pub fn deinit(thunk: *Thunk, allocator: Allocator) void { diff --git a/src/link/MachO/UnwindInfo.zig b/src/link/MachO/UnwindInfo.zig index 42172b8518..cf8a49bed1 100644 --- a/src/link/MachO/UnwindInfo.zig +++ b/src/link/MachO/UnwindInfo.zig @@ -1,6 +1,6 @@ /// List of all unwind records gathered from all objects and sorted /// by allocated relative function address within the section. -records: std.ArrayListUnmanaged(Record.Ref) = .{}, +records: std.ArrayListUnmanaged(Record.Ref) = .empty, /// List of all personalities referenced by either unwind info entries /// or __eh_frame entries. @@ -12,11 +12,11 @@ common_encodings: [max_common_encodings]Encoding = undefined, common_encodings_count: u7 = 0, /// List of record indexes containing an LSDA pointer. -lsdas: std.ArrayListUnmanaged(u32) = .{}, -lsdas_lookup: std.ArrayListUnmanaged(u32) = .{}, +lsdas: std.ArrayListUnmanaged(u32) = .empty, +lsdas_lookup: std.ArrayListUnmanaged(u32) = .empty, /// List of second level pages. -pages: std.ArrayListUnmanaged(Page) = .{}, +pages: std.ArrayListUnmanaged(Page) = .empty, pub fn deinit(info: *UnwindInfo, allocator: Allocator) void { info.records.deinit(allocator); diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index 3ffa9c4745..a2d578845c 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -1,4 +1,4 @@ -data: std.ArrayListUnmanaged(u8) = .{}, +data: std.ArrayListUnmanaged(u8) = .empty, /// Externally owned memory. path: []const u8, index: File.Index, @@ -6,15 +6,15 @@ index: File.Index, symtab: std.MultiArrayList(Nlist) = .{}, strtab: StringTable = .{}, -symbols: std.ArrayListUnmanaged(Symbol) = .{}, -symbols_extra: std.ArrayListUnmanaged(u32) = .{}, -globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, +symbols_extra: std.ArrayListUnmanaged(u32) = .empty, +globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty, /// Maps string index (so name) into nlist index for the global symbol defined within this /// module. -globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .{}, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{}, -atoms_extra: std.ArrayListUnmanaged(u32) = .{}, +globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .empty, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty, +atoms_extra: std.ArrayListUnmanaged(u32) = .empty, /// Table of tracked LazySymbols. lazy_syms: LazySymbolTable = .{}, @@ -1786,7 +1786,7 @@ fn formatAtoms( const AvMetadata = struct { symbol_index: Symbol.Index, /// A list of all exports aliases of this Av. - exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, + exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, fn @"export"(m: AvMetadata, zig_object: *ZigObject, name: []const u8) ?*u32 { for (m.exports.items) |*exp| { diff --git a/src/link/MachO/dyld_info/Rebase.zig b/src/link/MachO/dyld_info/Rebase.zig index 2bee8ad22c..cbd0461431 100644 --- a/src/link/MachO/dyld_info/Rebase.zig +++ b/src/link/MachO/dyld_info/Rebase.zig @@ -1,5 +1,5 @@ -entries: std.ArrayListUnmanaged(Entry) = .{}, -buffer: std.ArrayListUnmanaged(u8) = .{}, +entries: std.ArrayListUnmanaged(Entry) = .empty, +buffer: std.ArrayListUnmanaged(u8) = .empty, pub const Entry = struct { offset: u64, diff --git a/src/link/MachO/dyld_info/Trie.zig b/src/link/MachO/dyld_info/Trie.zig index aed7b61df8..b45651eb67 100644 --- a/src/link/MachO/dyld_info/Trie.zig +++ b/src/link/MachO/dyld_info/Trie.zig @@ -31,9 +31,9 @@ /// The root node of the trie. root: ?Node.Index = null, -buffer: std.ArrayListUnmanaged(u8) = .{}, +buffer: std.ArrayListUnmanaged(u8) = .empty, nodes: std.MultiArrayList(Node) = .{}, -edges: std.ArrayListUnmanaged(Edge) = .{}, +edges: std.ArrayListUnmanaged(Edge) = .empty, /// Insert a symbol into the trie, updating the prefixes in the process. /// This operation may change the layout of the trie by splicing edges in @@ -317,7 +317,7 @@ const Node = struct { trie_offset: u32 = 0, /// List of all edges originating from this node. - edges: std.ArrayListUnmanaged(Edge.Index) = .{}, + edges: std.ArrayListUnmanaged(Edge.Index) = .empty, const Index = u32; }; diff --git a/src/link/MachO/dyld_info/bind.zig b/src/link/MachO/dyld_info/bind.zig index 310118af41..328d6a402c 100644 --- a/src/link/MachO/dyld_info/bind.zig +++ b/src/link/MachO/dyld_info/bind.zig @@ -17,8 +17,8 @@ pub const Entry = struct { }; pub const Bind = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, - buffer: std.ArrayListUnmanaged(u8) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, + buffer: std.ArrayListUnmanaged(u8) = .empty, const Self = @This(); @@ -269,8 +269,8 @@ pub const Bind = struct { }; pub const WeakBind = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, - buffer: std.ArrayListUnmanaged(u8) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, + buffer: std.ArrayListUnmanaged(u8) = .empty, const Self = @This(); @@ -511,9 +511,9 @@ pub const WeakBind = struct { }; pub const LazyBind = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, - buffer: std.ArrayListUnmanaged(u8) = .{}, - offsets: std.ArrayListUnmanaged(u32) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, + buffer: std.ArrayListUnmanaged(u8) = .empty, + offsets: std.ArrayListUnmanaged(u32) = .empty, const Self = @This(); diff --git a/src/link/MachO/synthetic.zig b/src/link/MachO/synthetic.zig index 5c7ede387d..900316a769 100644 --- a/src/link/MachO/synthetic.zig +++ b/src/link/MachO/synthetic.zig @@ -1,5 +1,5 @@ pub const GotSection = struct { - symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, + symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, pub const Index = u32; @@ -68,7 +68,7 @@ pub const GotSection = struct { }; pub const StubsSection = struct { - symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, + symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, pub const Index = u32; @@ -316,7 +316,7 @@ pub const LaSymbolPtrSection = struct { }; pub const TlvPtrSection = struct { - symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, + symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, pub const Index = u32; @@ -388,7 +388,7 @@ pub const TlvPtrSection = struct { }; pub const ObjcStubsSection = struct { - symbols: std.ArrayListUnmanaged(MachO.Ref) = .{}, + symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty, pub fn deinit(objc: *ObjcStubsSection, allocator: Allocator) void { objc.symbols.deinit(allocator); @@ -548,7 +548,7 @@ pub const Indsymtab = struct { }; pub const DataInCode = struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, pub fn deinit(dice: *DataInCode, allocator: Allocator) void { dice.entries.deinit(allocator); diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig index 7737c22d05..413ab7372a 100644 --- a/src/link/Plan9.zig +++ b/src/link/Plan9.zig @@ -34,13 +34,13 @@ bases: Bases, /// Does not represent the order or amount of symbols in the file /// it is just useful for storing symbols. Some other symbols are in /// file_segments. -syms: std.ArrayListUnmanaged(aout.Sym) = .{}, +syms: std.ArrayListUnmanaged(aout.Sym) = .empty, /// The plan9 a.out format requires segments of /// filenames to be deduplicated, so we use this map to /// de duplicate it. The value is the value of the path /// component -file_segments: std.StringArrayHashMapUnmanaged(u16) = .{}, +file_segments: std.StringArrayHashMapUnmanaged(u16) = .empty, /// The value of a 'f' symbol increments by 1 every time, so that no 2 'f' /// symbols have the same value. file_segments_i: u16 = 1, @@ -54,19 +54,19 @@ path_arena: std.heap.ArenaAllocator, /// If we group the decls by file, it makes it really easy to do this (put the symbol in the correct place) fn_nav_table: std.AutoArrayHashMapUnmanaged( Zcu.File.Index, - struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, FnNavOutput) = .{} }, + struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, FnNavOutput) = .empty }, ) = .{}, /// the code is modified when relocated, so that is why it is mutable -data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .{}, +data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .empty, /// When `updateExports` is called, we store the export indices here, to be used /// during flush. -nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .{}, +nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .empty, lazy_syms: LazySymbolTable = .{}, -uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .{}, +uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty, -relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .{}, +relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .empty, hdr: aout.ExecHdr = undefined, // relocs: std. @@ -77,12 +77,12 @@ entry_val: ?u64 = null, got_len: usize = 0, // A list of all the free got indexes, so when making a new decl // don't make a new one, just use one from here. -got_index_free_list: std.ArrayListUnmanaged(usize) = .{}, +got_index_free_list: std.ArrayListUnmanaged(usize) = .empty, -syms_index_free_list: std.ArrayListUnmanaged(usize) = .{}, +syms_index_free_list: std.ArrayListUnmanaged(usize) = .empty, -atoms: std.ArrayListUnmanaged(Atom) = .{}, -navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .{}, +atoms: std.ArrayListUnmanaged(Atom) = .empty, +navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .empty, /// Indices of the three "special" symbols into atoms etext_edata_end_atom_indices: [3]?Atom.Index = .{ null, null, null }, @@ -220,7 +220,7 @@ pub const DebugInfoOutput = struct { const NavMetadata = struct { index: Atom.Index, - exports: std.ArrayListUnmanaged(usize) = .{}, + exports: std.ArrayListUnmanaged(usize) = .empty, fn getExport(m: NavMetadata, p9: *const Plan9, name: []const u8) ?usize { for (m.exports.items) |exp| { diff --git a/src/link/SpirV/BinaryModule.zig b/src/link/SpirV/BinaryModule.zig index 648e55f2ca..c80bf9b06a 100644 --- a/src/link/SpirV/BinaryModule.zig +++ b/src/link/SpirV/BinaryModule.zig @@ -148,7 +148,7 @@ pub const Parser = struct { a: Allocator, /// Maps (instruction set, opcode) => instruction index (for instruction set) - opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .{}, + opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .empty, pub fn init(a: Allocator) !Parser { var self = Parser{ diff --git a/src/link/SpirV/deduplicate.zig b/src/link/SpirV/deduplicate.zig index 292ff0e868..f639644f7b 100644 --- a/src/link/SpirV/deduplicate.zig +++ b/src/link/SpirV/deduplicate.zig @@ -178,8 +178,8 @@ const ModuleInfo = struct { const EntityContext = struct { a: Allocator, - ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{}, - ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{}, + ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty, + ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty, info: *const ModuleInfo, binary: *const BinaryModule, diff --git a/src/link/SpirV/lower_invocation_globals.zig b/src/link/SpirV/lower_invocation_globals.zig index 111ec2621b..a06a868e18 100644 --- a/src/link/SpirV/lower_invocation_globals.zig +++ b/src/link/SpirV/lower_invocation_globals.zig @@ -342,9 +342,9 @@ const ModuleBuilder = struct { entry_point_new_id_base: u32, /// A set of all function types in the new program. SPIR-V mandates that these are unique, /// and until a general type deduplication pass is programmed, we just handle it here via this. - function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .{}, + function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .empty, /// Maps functions to new information required for creating the module - function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .{}, + function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .empty, /// Offset of the functions section in the new binary. new_functions_section: ?usize, diff --git a/src/link/StringTable.zig b/src/link/StringTable.zig index 2375bf4449..b03e025ff0 100644 --- a/src/link/StringTable.zig +++ b/src/link/StringTable.zig @@ -1,5 +1,5 @@ -buffer: std.ArrayListUnmanaged(u8) = .{}, -table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{}, +buffer: std.ArrayListUnmanaged(u8) = .empty, +table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty, pub fn deinit(self: *Self, gpa: Allocator) void { self.buffer.deinit(gpa); diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 23425a2e7c..7d97fb4c7d 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -72,11 +72,11 @@ files: std.MultiArrayList(File.Entry) = .{}, /// TODO: Allow setting this through a flag? host_name: []const u8 = "env", /// List of symbols generated by the linker. -synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .{}, +synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .empty, /// Maps atoms to their segment index -atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{}, +atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty, /// List of all atoms. -managed_atoms: std.ArrayListUnmanaged(Atom) = .{}, +managed_atoms: std.ArrayListUnmanaged(Atom) = .empty, /// Represents the index into `segments` where the 'code' section /// lives. code_section_index: ?u32 = null, @@ -106,22 +106,22 @@ imported_globals_count: u32 = 0, /// to the table indexes when sections are merged. imported_tables_count: u32 = 0, /// Map of symbol locations, represented by its `types.Import` -imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .{}, +imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .empty, /// Represents non-synthetic section entries. /// Used for code, data and custom sections. -segments: std.ArrayListUnmanaged(Segment) = .{}, +segments: std.ArrayListUnmanaged(Segment) = .empty, /// Maps a data segment key (such as .rodata) to the index into `segments`. -data_segments: std.StringArrayHashMapUnmanaged(u32) = .{}, +data_segments: std.StringArrayHashMapUnmanaged(u32) = .empty, /// A table of `types.Segment` which provide meta data /// about a data symbol such as its name where the key is /// the segment index, which can be found from `data_segments` -segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .{}, +segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .empty, /// Deduplicated string table for strings used by symbols, imports and exports. string_table: StringTable = .{}, // Output sections /// Output type section -func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{}, +func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty, /// Output function section where the key is the original /// function index and the value is function. /// This allows us to map multiple symbols to the same function. @@ -130,7 +130,7 @@ functions: std.AutoArrayHashMapUnmanaged( struct { func: std.wasm.Func, sym_index: Symbol.Index }, ) = .{}, /// Output global section -wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .{}, +wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty, /// Memory section memories: std.wasm.Memory = .{ .limits = .{ .min = 0, @@ -138,12 +138,12 @@ memories: std.wasm.Memory = .{ .limits = .{ .flags = 0, } }, /// Output table section -tables: std.ArrayListUnmanaged(std.wasm.Table) = .{}, +tables: std.ArrayListUnmanaged(std.wasm.Table) = .empty, /// Output export section -exports: std.ArrayListUnmanaged(types.Export) = .{}, +exports: std.ArrayListUnmanaged(types.Export) = .empty, /// List of initialization functions. These must be called in order of priority /// by the (synthetic) __wasm_call_ctors function. -init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .{}, +init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .empty, /// Index to a function defining the entry of the wasm file entry: ?u32 = null, @@ -152,31 +152,31 @@ entry: ?u32 = null, /// as well as an 'elements' section. /// /// Note: Key is symbol location, value represents the index into the table -function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .{}, +function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .empty, /// All object files and their data which are linked into the final binary -objects: std.ArrayListUnmanaged(File.Index) = .{}, +objects: std.ArrayListUnmanaged(File.Index) = .empty, /// All archive files that are lazy loaded. /// e.g. when an undefined symbol references a symbol from the archive. -archives: std.ArrayListUnmanaged(Archive) = .{}, +archives: std.ArrayListUnmanaged(Archive) = .empty, /// A map of global names (read: offset into string table) to their symbol location -globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .{}, +globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .empty, /// The list of GOT symbols and their location -got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .{}, +got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .empty, /// Maps discarded symbols and their positions to the location of the symbol /// it was resolved to -discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .{}, +discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .empty, /// List of all symbol locations which have been resolved by the linker and will be emit /// into the final binary. -resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .{}, +resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .empty, /// Symbols that remain undefined after symbol resolution. /// Note: The key represents an offset into the string table, rather than the actual string. -undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .{}, +undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .empty, /// Maps a symbol's location to an atom. This can be used to find meta /// data of a symbol, such as its size, or its offset to perform a relocation. /// Undefined (and synthetic) symbols do not have an Atom and therefore cannot be mapped. -symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .{}, +symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .empty, pub const Alignment = types.Alignment; @@ -287,7 +287,7 @@ pub const StringTable = struct { std.hash_map.default_max_load_percentage, ) = .{}, /// Holds the actual data of the string table. - string_data: std.ArrayListUnmanaged(u8) = .{}, + string_data: std.ArrayListUnmanaged(u8) = .empty, /// Accepts a string and searches for a corresponding string. /// When found, de-duplicates the string and returns the existing offset instead. @@ -1698,7 +1698,7 @@ fn allocateVirtualAddresses(wasm: *Wasm) void { fn sortDataSegments(wasm: *Wasm) !void { const gpa = wasm.base.comp.gpa; - var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .{}; + var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .empty; try new_mapping.ensureUnusedCapacity(gpa, wasm.data_segments.count()); errdefer new_mapping.deinit(gpa); diff --git a/src/link/Wasm/Archive.zig b/src/link/Wasm/Archive.zig index e069aeef8c..c7e5c7caba 100644 --- a/src/link/Wasm/Archive.zig +++ b/src/link/Wasm/Archive.zig @@ -12,7 +12,7 @@ long_file_names: []const u8 = undefined, /// Parsed table of contents. /// Each symbol name points to a list of all definition /// sites within the current static archive. -toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .{}, +toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .empty, // Archive files start with the ARMAG identifying string. Then follows a // `struct ar_hdr', and as many bytes of member file data as its `ar_size' diff --git a/src/link/Wasm/Atom.zig b/src/link/Wasm/Atom.zig index e5ad4ee161..dd373552d5 100644 --- a/src/link/Wasm/Atom.zig +++ b/src/link/Wasm/Atom.zig @@ -6,9 +6,9 @@ sym_index: Symbol.Index, /// Size of the atom, used to calculate section sizes in the final binary size: u32 = 0, /// List of relocations belonging to this atom -relocs: std.ArrayListUnmanaged(types.Relocation) = .{}, +relocs: std.ArrayListUnmanaged(types.Relocation) = .empty, /// Contains the binary data of an atom, which can be non-relocated -code: std.ArrayListUnmanaged(u8) = .{}, +code: std.ArrayListUnmanaged(u8) = .empty, /// For code this is 1, for data this is set to the highest value of all segments alignment: Wasm.Alignment = .@"1", /// Offset into the section where the atom lives, this already accounts @@ -22,7 +22,7 @@ original_offset: u32 = 0, prev: Atom.Index = .null, /// Contains atoms local to a decl, all managed by this `Atom`. /// When the parent atom is being freed, it will also do so for all local atoms. -locals: std.ArrayListUnmanaged(Atom.Index) = .{}, +locals: std.ArrayListUnmanaged(Atom.Index) = .empty, /// Represents the index of an Atom where `null` is considered /// an invalid atom. diff --git a/src/link/Wasm/Object.zig b/src/link/Wasm/Object.zig index fa46a1fea4..81a3cac737 100644 --- a/src/link/Wasm/Object.zig +++ b/src/link/Wasm/Object.zig @@ -51,7 +51,7 @@ start: ?u32 = null, features: []const types.Feature = &.{}, /// A table that maps the relocations we must perform where the key represents /// the section that the list of relocations applies to. -relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .{}, +relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .empty, /// Table of symbols belonging to this Object file symtable: []Symbol = &.{}, /// Extra metadata about the linking section, such as alignment of segments and their name @@ -62,7 +62,7 @@ init_funcs: []const types.InitFunc = &.{}, comdat_info: []const types.Comdat = &.{}, /// Represents non-synthetic sections that can essentially be mem-cpy'd into place /// after performing relocations. -relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .{}, +relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .empty, /// String table for all strings required by the object file, such as symbol names, /// import name, module name and export names. Each string will be deduplicated /// and returns an offset into the table. @@ -379,7 +379,7 @@ fn Parser(comptime ReaderType: type) type { try parser.parseFeatures(gpa); } else if (std.mem.startsWith(u8, name, ".debug")) { const gop = try parser.object.relocatable_data.getOrPut(gpa, .custom); - var relocatable_data: std.ArrayListUnmanaged(RelocatableData) = .{}; + var relocatable_data: std.ArrayListUnmanaged(RelocatableData) = .empty; defer relocatable_data.deinit(gpa); if (!gop.found_existing) { gop.value_ptr.* = &.{}; diff --git a/src/link/Wasm/ZigObject.zig b/src/link/Wasm/ZigObject.zig index afb0216fd7..962024eeef 100644 --- a/src/link/Wasm/ZigObject.zig +++ b/src/link/Wasm/ZigObject.zig @@ -8,37 +8,37 @@ path: []const u8, index: File.Index, /// Map of all `Nav` that are currently alive. /// Each index maps to the corresponding `NavInfo`. -navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .{}, +navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .empty, /// List of function type signatures for this Zig module. -func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{}, +func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty, /// List of `std.wasm.Func`. Each entry contains the function signature, /// rather than the actual body. -functions: std.ArrayListUnmanaged(std.wasm.Func) = .{}, +functions: std.ArrayListUnmanaged(std.wasm.Func) = .empty, /// List of indexes pointing to an entry within the `functions` list which has been removed. -functions_free_list: std.ArrayListUnmanaged(u32) = .{}, +functions_free_list: std.ArrayListUnmanaged(u32) = .empty, /// Map of symbol locations, represented by its `types.Import`. -imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .{}, +imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .empty, /// List of WebAssembly globals. -globals: std.ArrayListUnmanaged(std.wasm.Global) = .{}, +globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty, /// Mapping between an `Atom` and its type index representing the Wasm /// type of the function signature. -atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .{}, +atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .empty, /// List of all symbols generated by Zig code. -symbols: std.ArrayListUnmanaged(Symbol) = .{}, +symbols: std.ArrayListUnmanaged(Symbol) = .empty, /// Map from symbol name offset to their index into the `symbols` list. -global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{}, +global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty, /// List of symbol indexes which are free to be used. -symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .{}, +symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .empty, /// Extra metadata about the linking section, such as alignment of segments and their name. -segment_info: std.ArrayListUnmanaged(types.Segment) = .{}, +segment_info: std.ArrayListUnmanaged(types.Segment) = .empty, /// List of indexes which contain a free slot in the `segment_info` list. -segment_free_list: std.ArrayListUnmanaged(u32) = .{}, +segment_free_list: std.ArrayListUnmanaged(u32) = .empty, /// File encapsulated string table, used to deduplicate strings within the generated file. string_table: StringTable = .{}, /// Map for storing anonymous declarations. Each anonymous decl maps to its Atom's index. -uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .{}, +uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty, /// List of atom indexes of functions that are generated by the backend. -synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .{}, +synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .empty, /// Represents the symbol index of the error name table /// When this is `null`, no code references an error using runtime `@errorName`. /// During initializion, a symbol with corresponding atom will be created that is @@ -88,7 +88,7 @@ debug_abbrev_index: ?u32 = null, const NavInfo = struct { atom: Atom.Index = .null, - exports: std.ArrayListUnmanaged(Symbol.Index) = .{}, + exports: std.ArrayListUnmanaged(Symbol.Index) = .empty, fn @"export"(ni: NavInfo, zig_object: *const ZigObject, name: []const u8) ?Symbol.Index { for (ni.exports.items) |sym_index| { diff --git a/src/link/table_section.zig b/src/link/table_section.zig index 2c70b03f42..f3762b38dd 100644 --- a/src/link/table_section.zig +++ b/src/link/table_section.zig @@ -1,8 +1,8 @@ pub fn TableSection(comptime Entry: type) type { return struct { - entries: std.ArrayListUnmanaged(Entry) = .{}, - free_list: std.ArrayListUnmanaged(Index) = .{}, - lookup: std.AutoHashMapUnmanaged(Entry, Index) = .{}, + entries: std.ArrayListUnmanaged(Entry) = .empty, + free_list: std.ArrayListUnmanaged(Index) = .empty, + lookup: std.AutoHashMapUnmanaged(Entry, Index) = .empty, pub fn deinit(self: *Self, allocator: Allocator) void { self.entries.deinit(allocator); diff --git a/src/link/tapi/parse.zig b/src/link/tapi/parse.zig index deba9aaef0..f6556dd5dd 100644 --- a/src/link/tapi/parse.zig +++ b/src/link/tapi/parse.zig @@ -115,7 +115,7 @@ pub const Node = struct { .start = undefined, .end = undefined, }, - values: std.ArrayListUnmanaged(Entry) = .{}, + values: std.ArrayListUnmanaged(Entry) = .empty, pub const base_tag: Node.Tag = .map; @@ -161,7 +161,7 @@ pub const Node = struct { .start = undefined, .end = undefined, }, - values: std.ArrayListUnmanaged(*Node) = .{}, + values: std.ArrayListUnmanaged(*Node) = .empty, pub const base_tag: Node.Tag = .list; @@ -195,7 +195,7 @@ pub const Node = struct { .start = undefined, .end = undefined, }, - string_value: std.ArrayListUnmanaged(u8) = .{}, + string_value: std.ArrayListUnmanaged(u8) = .empty, pub const base_tag: Node.Tag = .value; @@ -227,7 +227,7 @@ pub const Tree = struct { source: []const u8, tokens: []Token, line_cols: std.AutoHashMap(TokenIndex, LineCol), - docs: std.ArrayListUnmanaged(*Node) = .{}, + docs: std.ArrayListUnmanaged(*Node) = .empty, pub fn init(allocator: Allocator) Tree { return .{ diff --git a/src/main.zig b/src/main.zig index 0e7a801b46..4a7f477106 100644 --- a/src/main.zig +++ b/src/main.zig @@ -126,7 +126,7 @@ const debug_usage = normal_usage ++ const usage = if (build_options.enable_debug_extensions) debug_usage else normal_usage; const default_local_zig_cache_basename = ".zig-cache"; -var log_scopes: std.ArrayListUnmanaged([]const u8) = .{}; +var log_scopes: std.ArrayListUnmanaged([]const u8) = .empty; pub fn log( comptime level: std.log.Level, @@ -895,14 +895,14 @@ fn buildOutputType( var linker_module_definition_file: ?[]const u8 = null; var test_no_exec = false; var entry: Compilation.CreateOptions.Entry = .default; - var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{}; + var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty; var stack_size: ?u64 = null; var image_base: ?u64 = null; var link_eh_frame_hdr = false; var link_emit_relocs = false; var build_id: ?std.zig.BuildId = null; var runtime_args_start: ?usize = null; - var test_filters: std.ArrayListUnmanaged([]const u8) = .{}; + var test_filters: std.ArrayListUnmanaged([]const u8) = .empty; var test_name_prefix: ?[]const u8 = null; var test_runner_path: ?[]const u8 = null; var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena); @@ -931,12 +931,12 @@ fn buildOutputType( var pdb_out_path: ?[]const u8 = null; var error_limit: ?Zcu.ErrorInt = null; // These are before resolving sysroot. - var extra_cflags: std.ArrayListUnmanaged([]const u8) = .{}; - var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .{}; - var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{}; + var extra_cflags: std.ArrayListUnmanaged([]const u8) = .empty; + var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .empty; + var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty; var rc_includes: Compilation.RcIncludes = .any; var manifest_file: ?[]const u8 = null; - var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .{}; + var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .empty; // Tracks the position in c_source_files which have already their owner populated. var c_source_files_owner_index: usize = 0; @@ -944,7 +944,7 @@ fn buildOutputType( var rc_source_files_owner_index: usize = 0; // null means replace with the test executable binary - var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .{}; + var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .empty; // These get set by CLI flags and then snapshotted when a `-M` flag is // encountered. @@ -953,8 +953,8 @@ fn buildOutputType( // These get appended to by CLI flags and then slurped when a `-M` flag // is encountered. var cssan: ClangSearchSanitizer = .{}; - var cc_argv: std.ArrayListUnmanaged([]const u8) = .{}; - var deps: std.ArrayListUnmanaged(CliModule.Dep) = .{}; + var cc_argv: std.ArrayListUnmanaged([]const u8) = .empty; + var deps: std.ArrayListUnmanaged(CliModule.Dep) = .empty; // Contains every module specified via -M. The dependencies are added // after argument parsing is completed. We use a StringArrayHashMap to make @@ -2806,7 +2806,7 @@ fn buildOutputType( create_module.opts.emit_bin = emit_bin != .no; create_module.opts.any_c_source_files = create_module.c_source_files.items.len != 0; - var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .{}; + var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .empty; // `builtin_modules` allocated into `arena`, so no deinit const main_mod = try createModule(gpa, arena, &create_module, 0, null, zig_lib_directory, &builtin_modules); for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| { @@ -3290,7 +3290,7 @@ fn buildOutputType( process.raiseFileDescriptorLimit(); - var file_system_inputs: std.ArrayListUnmanaged(u8) = .{}; + var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty; defer file_system_inputs.deinit(gpa); const comp = Compilation.create(gpa, arena, .{ @@ -5451,7 +5451,7 @@ fn jitCmd( }); defer thread_pool.deinit(); - var child_argv: std.ArrayListUnmanaged([]const u8) = .{}; + var child_argv: std.ArrayListUnmanaged([]const u8) = .empty; try child_argv.ensureUnusedCapacity(arena, args.len + 4); // We want to release all the locks before executing the child process, so we make a nice @@ -6553,7 +6553,7 @@ fn cmdChangelist( process.exit(1); } - var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{}; + var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty; defer inst_map.deinit(gpa); try Zcu.mapOldZirToNew(gpa, old_zir, file.zir, &inst_map); @@ -6738,7 +6738,7 @@ fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem { /// Silently ignore superfluous search dirs. /// Warn when a dir is added to multiple searchlists. const ClangSearchSanitizer = struct { - map: std.StringHashMapUnmanaged(Membership) = .{}, + map: std.StringHashMapUnmanaged(Membership) = .empty, fn reset(self: *@This()) void { self.map.clearRetainingCapacity(); diff --git a/src/register_manager.zig b/src/register_manager.zig index 7ca117be0c..0b569467e7 100644 --- a/src/register_manager.zig +++ b/src/register_manager.zig @@ -516,7 +516,7 @@ fn MockFunction(comptime Register: type) type { return struct { allocator: Allocator, register_manager: Register.RM = .{}, - spilled: std.ArrayListUnmanaged(Register) = .{}, + spilled: std.ArrayListUnmanaged(Register) = .empty, const Self = @This(); diff --git a/src/translate_c.zig b/src/translate_c.zig index 9e974fc237..6b84aeb743 100644 --- a/src/translate_c.zig +++ b/src/translate_c.zig @@ -27,23 +27,23 @@ pub const Context = struct { gpa: mem.Allocator, arena: mem.Allocator, source_manager: *clang.SourceManager, - decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{}, + decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty, alias_list: AliasList, global_scope: *Scope.Root, clang_context: *clang.ASTContext, mangle_count: u32 = 0, /// Table of record decls that have been demoted to opaques. - opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{}, + opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty, /// Table of unnamed enums and records that are child types of typedefs. - unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{}, + unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty, /// Needed to decide if we are parsing a typename - typedefs: std.StringArrayHashMapUnmanaged(void) = .{}, + typedefs: std.StringArrayHashMapUnmanaged(void) = .empty, /// This one is different than the root scope's name table. This contains /// a list of names that we found by visiting all the top level decls without /// translating them. The other maps are updated as we translate; this one is updated /// up front in a pre-processing step. - global_names: std.StringArrayHashMapUnmanaged(void) = .{}, + global_names: std.StringArrayHashMapUnmanaged(void) = .empty, /// This is similar to `global_names`, but contains names which we would /// *like* to use, but do not strictly *have* to if they are unavailable. @@ -52,7 +52,7 @@ pub const Context = struct { /// may be mangled. /// This is distinct from `global_names` so we can detect at a type /// declaration whether or not the name is available. - weak_global_names: std.StringArrayHashMapUnmanaged(void) = .{}, + weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty, pattern_list: PatternList, |
