authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-09-12 19:50:38+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-09-12 19:50:38+01:00
log0001f91e4e1e51cd64cdd5c0a21451c8bad67233
tree9c3efb262890fa76a9b1d02c694dadad11c316f4
parentb95e0e09dcbe4ca948fd4098a8e3a4d90df9cb22
parent9271a89c65967ff0fed7011b4195abdd0f9195eb
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #21287 from linusg/deprecated-default-init

Replace deprecated default initializations with decl literals

152 files changed, 842 insertions(+), 824 deletions(-)

doc/langref/wasi_args.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn main() !void {3pub fn main() !void {
4 var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};4 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
5 const gpa = general_purpose_allocator.allocator();5 const gpa = general_purpose_allocator.allocator();
6 const args = try std.process.argsAlloc(gpa);6 const args = try std.process.argsAlloc(gpa);
7 defer std.process.argsFree(gpa, args);7 defer std.process.argsFree(gpa, args);
doc/langref/wasi_preopens.zig+1-1
...@@ -2,7 +2,7 @@ const std = @import("std");...@@ -2,7 +2,7 @@ const std = @import("std");
2const fs = std.fs;2const fs = std.fs;
33
4pub fn main() !void {4pub fn main() !void {
5 var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};5 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
6 const gpa = general_purpose_allocator.allocator();6 const gpa = general_purpose_allocator.allocator();
77
8 var arena_instance = std.heap.ArenaAllocator.init(gpa);8 var arena_instance = std.heap.ArenaAllocator.init(gpa);
lib/compiler/aro/aro/CodeGen.zig+5-5
...@@ -42,11 +42,11 @@ node_tag: []const Tree.Tag,...@@ -42,11 +42,11 @@ node_tag: []const Tree.Tag,
42node_data: []const Tree.Node.Data,42node_data: []const Tree.Node.Data,
43node_ty: []const Type,43node_ty: []const Type,
44wip_switch: *WipSwitch = undefined,44wip_switch: *WipSwitch = undefined,
45symbols: std.ArrayListUnmanaged(Symbol) = .{},45symbols: std.ArrayListUnmanaged(Symbol) = .empty,
46ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},46ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty,
47phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{},47phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .empty,
48record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{},48record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .empty,
49record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .{},49record_cache: std.AutoHashMapUnmanaged(*Type.Record, Interner.Ref) = .empty,
50cond_dummy_ty: ?Interner.Ref = null,50cond_dummy_ty: ?Interner.Ref = null,
51bool_invert: bool = false,51bool_invert: bool = false,
52bool_end_label: Ir.Ref = .none,52bool_end_label: Ir.Ref = .none,
lib/compiler/aro/aro/Compilation.zig+5-5
...@@ -93,13 +93,13 @@ gpa: Allocator,...@@ -93,13 +93,13 @@ gpa: Allocator,
93diagnostics: Diagnostics,93diagnostics: Diagnostics,
9494
95environment: Environment = .{},95environment: Environment = .{},
96sources: std.StringArrayHashMapUnmanaged(Source) = .{},96sources: std.StringArrayHashMapUnmanaged(Source) = .empty,
97include_dirs: std.ArrayListUnmanaged([]const u8) = .{},97include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
98system_include_dirs: std.ArrayListUnmanaged([]const u8) = .{},98system_include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
99target: std.Target = @import("builtin").target,99target: std.Target = @import("builtin").target,
100pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .{},100pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty,
101langopts: LangOpts = .{},101langopts: LangOpts = .{},
102generated_buf: std.ArrayListUnmanaged(u8) = .{},102generated_buf: std.ArrayListUnmanaged(u8) = .empty,
103builtins: Builtins = .{},103builtins: Builtins = .{},
104types: struct {104types: struct {
105 wchar: Type = undefined,105 wchar: Type = undefined,
lib/compiler/aro/aro/Diagnostics.zig+1-1
...@@ -221,7 +221,7 @@ pub const Options = struct {...@@ -221,7 +221,7 @@ pub const Options = struct {
221221
222const Diagnostics = @This();222const Diagnostics = @This();
223223
224list: std.ArrayListUnmanaged(Message) = .{},224list: std.ArrayListUnmanaged(Message) = .empty,
225arena: std.heap.ArenaAllocator,225arena: std.heap.ArenaAllocator,
226fatal_errors: bool = false,226fatal_errors: bool = false,
227options: Options = .{},227options: Options = .{},
lib/compiler/aro/aro/Driver.zig+2-2
...@@ -25,8 +25,8 @@ pub const Linker = enum {...@@ -25,8 +25,8 @@ pub const Linker = enum {
25const Driver = @This();25const Driver = @This();
2626
27comp: *Compilation,27comp: *Compilation,
28inputs: std.ArrayListUnmanaged(Source) = .{},28inputs: std.ArrayListUnmanaged(Source) = .empty,
29link_objects: std.ArrayListUnmanaged([]const u8) = .{},29link_objects: std.ArrayListUnmanaged([]const u8) = .empty,
30output_name: ?[]const u8 = null,30output_name: ?[]const u8 = null,
31sysroot: ?[]const u8 = null,31sysroot: ?[]const u8 = null,
32system_defines: Compilation.SystemDefinesMode = .include_system_defines,32system_defines: Compilation.SystemDefinesMode = .include_system_defines,
lib/compiler/aro/aro/Hideset.zig+2-2
...@@ -51,10 +51,10 @@ pub const Index = enum(u32) {...@@ -51,10 +51,10 @@ pub const Index = enum(u32) {
51 _,51 _,
52};52};
5353
54map: std.AutoHashMapUnmanaged(Identifier, Index) = .{},54map: std.AutoHashMapUnmanaged(Identifier, Index) = .empty,
55/// Used for computing union/intersection of two lists; stored here so that allocations can be retained55/// Used for computing union/intersection of two lists; stored here so that allocations can be retained
56/// until hideset is deinit'ed56/// until hideset is deinit'ed
57tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .{},57tmp_map: std.AutoHashMapUnmanaged(Identifier, void) = .empty,
58linked_list: Item.List = .{},58linked_list: Item.List = .{},
59comp: *const Compilation,59comp: *const Compilation,
6060
lib/compiler/aro/aro/InitList.zig+1-1
...@@ -23,7 +23,7 @@ const Item = struct {...@@ -23,7 +23,7 @@ const Item = struct {
2323
24const InitList = @This();24const InitList = @This();
2525
26list: std.ArrayListUnmanaged(Item) = .{},26list: std.ArrayListUnmanaged(Item) = .empty,
27node: NodeIndex = .none,27node: NodeIndex = .none,
28tok: TokenIndex = 0,28tok: TokenIndex = 0,
2929
lib/compiler/aro/aro/Parser.zig+3-3
...@@ -109,7 +109,7 @@ param_buf: std.ArrayList(Type.Func.Param),...@@ -109,7 +109,7 @@ param_buf: std.ArrayList(Type.Func.Param),
109enum_buf: std.ArrayList(Type.Enum.Field),109enum_buf: std.ArrayList(Type.Enum.Field),
110record_buf: std.ArrayList(Type.Record.Field),110record_buf: std.ArrayList(Type.Record.Field),
111attr_buf: std.MultiArrayList(TentativeAttribute) = .{},111attr_buf: std.MultiArrayList(TentativeAttribute) = .{},
112attr_application_buf: std.ArrayListUnmanaged(Attribute) = .{},112attr_application_buf: std.ArrayListUnmanaged(Attribute) = .empty,
113field_attr_buf: std.ArrayList([]const Attribute),113field_attr_buf: std.ArrayList([]const Attribute),
114/// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types)114/// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types)
115/// e.g. `struct Foo bar;` where `struct Foo` is not defined yet.115/// e.g. `struct Foo bar;` where `struct Foo` is not defined yet.
...@@ -117,7 +117,7 @@ field_attr_buf: std.ArrayList([]const Attribute),...@@ -117,7 +117,7 @@ field_attr_buf: std.ArrayList([]const Attribute),
117/// Items are removed if the type is subsequently completed with a definition.117/// Items are removed if the type is subsequently completed with a definition.
118/// We only store the first tentative definition that uses a given type because this map is only used118/// We only store the first tentative definition that uses a given type because this map is only used
119/// for issuing an error message, and correcting the first error for a type will fix all of them for that type.119/// for issuing an error message, and correcting the first error for a type will fix all of them for that type.
120tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .{},120tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .empty,
121121
122// configuration and miscellaneous info122// configuration and miscellaneous info
123no_eval: bool = false,123no_eval: bool = false,
...@@ -174,7 +174,7 @@ record: struct {...@@ -174,7 +174,7 @@ record: struct {
174 }174 }
175 }175 }
176} = .{},176} = .{},
177record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{},177record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .empty,
178@"switch": ?*Switch = null,178@"switch": ?*Switch = null,
179in_loop: bool = false,179in_loop: bool = false,
180pragma_pack: ?u8 = null,180pragma_pack: ?u8 = null,
lib/compiler/aro/aro/Preprocessor.zig+1-1
...@@ -95,7 +95,7 @@ counter: u32 = 0,...@@ -95,7 +95,7 @@ counter: u32 = 0,
95expansion_source_loc: Source.Location = undefined,95expansion_source_loc: Source.Location = undefined,
96poisoned_identifiers: std.StringHashMap(void),96poisoned_identifiers: std.StringHashMap(void),
97/// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any97/// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any
98include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{},98include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .empty,
9999
100/// Store `keyword_define` and `keyword_undef` tokens.100/// Store `keyword_define` and `keyword_undef` tokens.
101/// Used to implement preprocessor debug dump options101/// Used to implement preprocessor debug dump options
lib/compiler/aro/aro/SymbolStack.zig+3-3
...@@ -33,14 +33,14 @@ pub const Kind = enum {...@@ -33,14 +33,14 @@ pub const Kind = enum {
33 constexpr,33 constexpr,
34};34};
3535
36scopes: std.ArrayListUnmanaged(Scope) = .{},36scopes: std.ArrayListUnmanaged(Scope) = .empty,
37/// allocations from nested scopes are retained after popping; `active_len` is the number37/// allocations from nested scopes are retained after popping; `active_len` is the number
38/// of currently-active items in `scopes`.38/// of currently-active items in `scopes`.
39active_len: usize = 0,39active_len: usize = 0,
4040
41const Scope = struct {41const Scope = struct {
42 vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},42 vars: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
43 tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .{},43 tags: std.AutoHashMapUnmanaged(StringId, Symbol) = .empty,
4444
45 fn deinit(self: *Scope, allocator: Allocator) void {45 fn deinit(self: *Scope, allocator: Allocator) void {
46 self.vars.deinit(allocator);46 self.vars.deinit(allocator);
lib/compiler/aro/aro/pragmas/gcc.zig+1-1
...@@ -19,7 +19,7 @@ pragma: Pragma = .{...@@ -19,7 +19,7 @@ pragma: Pragma = .{
19 .preserveTokens = preserveTokens,19 .preserveTokens = preserveTokens,
20},20},
21original_options: Diagnostics.Options = .{},21original_options: Diagnostics.Options = .{},
22options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .{},22options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .empty,
2323
24const Directive = enum {24const Directive = enum {
25 warning,25 warning,
lib/compiler/aro/aro/pragmas/pack.zig+1-1
...@@ -15,7 +15,7 @@ pragma: Pragma = .{...@@ -15,7 +15,7 @@ pragma: Pragma = .{
15 .parserHandler = parserHandler,15 .parserHandler = parserHandler,
16 .preserveTokens = preserveTokens,16 .preserveTokens = preserveTokens,
17},17},
18stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{},18stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .empty,
1919
20pub fn init(allocator: mem.Allocator) !*Pragma {20pub fn init(allocator: mem.Allocator) !*Pragma {
21 var pack = try allocator.create(Pack);21 var pack = try allocator.create(Pack);
lib/compiler/aro/aro/toolchains/Linux.zig+1-1
...@@ -11,7 +11,7 @@ const system_defaults = @import("system_defaults");...@@ -11,7 +11,7 @@ const system_defaults = @import("system_defaults");
11const Linux = @This();11const Linux = @This();
1212
13distro: Distro.Tag = .unknown,13distro: Distro.Tag = .unknown,
14extra_opts: std.ArrayListUnmanaged([]const u8) = .{},14extra_opts: std.ArrayListUnmanaged([]const u8) = .empty,
15gcc_detector: GCCDetector = .{},15gcc_detector: GCCDetector = .{},
1616
17pub fn discover(self: *Linux, tc: *Toolchain) !void {17pub fn discover(self: *Linux, tc: *Toolchain) !void {
lib/compiler/aro/backend/Interner.zig+4-4
...@@ -8,14 +8,14 @@ const Limb = std.math.big.Limb;...@@ -8,14 +8,14 @@ const Limb = std.math.big.Limb;
88
9const Interner = @This();9const Interner = @This();
1010
11map: std.AutoArrayHashMapUnmanaged(void, void) = .{},11map: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
12items: std.MultiArrayList(struct {12items: std.MultiArrayList(struct {
13 tag: Tag,13 tag: Tag,
14 data: u32,14 data: u32,
15}) = .{},15}) = .{},
16extra: std.ArrayListUnmanaged(u32) = .{},16extra: std.ArrayListUnmanaged(u32) = .empty,
17limbs: std.ArrayListUnmanaged(Limb) = .{},17limbs: std.ArrayListUnmanaged(Limb) = .empty,
18strings: std.ArrayListUnmanaged(u8) = .{},18strings: std.ArrayListUnmanaged(u8) = .empty,
1919
20const KeyAdapter = struct {20const KeyAdapter = struct {
21 interner: *const Interner,21 interner: *const Interner,
lib/compiler/aro/backend/Ir.zig+2-2
...@@ -26,9 +26,9 @@ pub const Builder = struct {...@@ -26,9 +26,9 @@ pub const Builder = struct {
26 arena: std.heap.ArenaAllocator,26 arena: std.heap.ArenaAllocator,
27 interner: *Interner,27 interner: *Interner,
2828
29 decls: std.StringArrayHashMapUnmanaged(Decl) = .{},29 decls: std.StringArrayHashMapUnmanaged(Decl) = .empty,
30 instructions: std.MultiArrayList(Ir.Inst) = .{},30 instructions: std.MultiArrayList(Ir.Inst) = .{},
31 body: std.ArrayListUnmanaged(Ref) = .{},31 body: std.ArrayListUnmanaged(Ref) = .empty,
32 alloc_count: u32 = 0,32 alloc_count: u32 = 0,
33 arg_count: u32 = 0,33 arg_count: u32 = 0,
34 current_label: Ref = undefined,34 current_label: Ref = undefined,
lib/compiler/aro/backend/Object/Elf.zig+4-4
...@@ -5,7 +5,7 @@ const Object = @import("../Object.zig");...@@ -5,7 +5,7 @@ const Object = @import("../Object.zig");
55
6const Section = struct {6const Section = struct {
7 data: std.ArrayList(u8),7 data: std.ArrayList(u8),
8 relocations: std.ArrayListUnmanaged(Relocation) = .{},8 relocations: std.ArrayListUnmanaged(Relocation) = .empty,
9 flags: u64,9 flags: u64,
10 type: u32,10 type: u32,
11 index: u16 = undefined,11 index: u16 = undefined,
...@@ -37,9 +37,9 @@ const Elf = @This();...@@ -37,9 +37,9 @@ const Elf = @This();
3737
38obj: Object,38obj: Object,
39/// The keys are owned by the Codegen.tree39/// The keys are owned by the Codegen.tree
40sections: std.StringHashMapUnmanaged(*Section) = .{},40sections: std.StringHashMapUnmanaged(*Section) = .empty,
41local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},41local_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
42global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{},42global_symbols: std.StringHashMapUnmanaged(*Symbol) = .empty,
43unnamed_symbol_mangle: u32 = 0,43unnamed_symbol_mangle: u32 = 0,
44strtab_len: u64 = strtab_default.len,44strtab_len: u64 = strtab_default.len,
45arena: std.heap.ArenaAllocator,45arena: std.heap.ArenaAllocator,
lib/compiler/aro_translate_c.zig+8-8
...@@ -16,22 +16,22 @@ const Context = @This();...@@ -16,22 +16,22 @@ const Context = @This();
1616
17gpa: mem.Allocator,17gpa: mem.Allocator,
18arena: mem.Allocator,18arena: mem.Allocator,
19decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{},19decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty,
20alias_list: AliasList,20alias_list: AliasList,
21global_scope: *Scope.Root,21global_scope: *Scope.Root,
22mangle_count: u32 = 0,22mangle_count: u32 = 0,
23/// Table of record decls that have been demoted to opaques.23/// Table of record decls that have been demoted to opaques.
24opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{},24opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty,
25/// Table of unnamed enums and records that are child types of typedefs.25/// Table of unnamed enums and records that are child types of typedefs.
26unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{},26unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty,
27/// Needed to decide if we are parsing a typename27/// Needed to decide if we are parsing a typename
28typedefs: std.StringArrayHashMapUnmanaged(void) = .{},28typedefs: std.StringArrayHashMapUnmanaged(void) = .empty,
2929
30/// This one is different than the root scope's name table. This contains30/// This one is different than the root scope's name table. This contains
31/// a list of names that we found by visiting all the top level decls without31/// a list of names that we found by visiting all the top level decls without
32/// translating them. The other maps are updated as we translate; this one is updated32/// translating them. The other maps are updated as we translate; this one is updated
33/// up front in a pre-processing step.33/// up front in a pre-processing step.
34global_names: std.StringArrayHashMapUnmanaged(void) = .{},34global_names: std.StringArrayHashMapUnmanaged(void) = .empty,
3535
36/// This is similar to `global_names`, but contains names which we would36/// This is similar to `global_names`, but contains names which we would
37/// *like* to use, but do not strictly *have* to if they are unavailable.37/// *like* to use, but do not strictly *have* to if they are unavailable.
...@@ -40,7 +40,7 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .{},...@@ -40,7 +40,7 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .{},
40/// may be mangled.40/// may be mangled.
41/// This is distinct from `global_names` so we can detect at a type41/// This is distinct from `global_names` so we can detect at a type
42/// declaration whether or not the name is available.42/// declaration whether or not the name is available.
43weak_global_names: std.StringArrayHashMapUnmanaged(void) = .{},43weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty,
4444
45pattern_list: PatternList,45pattern_list: PatternList,
46tree: Tree,46tree: Tree,
...@@ -697,7 +697,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const Type.Enum, field_...@@ -697,7 +697,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const Type.Enum, field_
697}697}
698698
699fn getTypeStr(c: *Context, ty: Type) ![]const u8 {699fn getTypeStr(c: *Context, ty: Type) ![]const u8 {
700 var buf: std.ArrayListUnmanaged(u8) = .{};700 var buf: std.ArrayListUnmanaged(u8) = .empty;
701 defer buf.deinit(c.gpa);701 defer buf.deinit(c.gpa);
702 const w = buf.writer(c.gpa);702 const w = buf.writer(c.gpa);
703 try ty.print(c.mapper, c.comp.langopts, w);703 try ty.print(c.mapper, c.comp.langopts, w);
...@@ -1793,7 +1793,7 @@ pub fn main() !void {...@@ -1793,7 +1793,7 @@ pub fn main() !void {
1793 defer arena_instance.deinit();1793 defer arena_instance.deinit();
1794 const arena = arena_instance.allocator();1794 const arena = arena_instance.allocator();
17951795
1796 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};1796 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
1797 const gpa = general_purpose_allocator.allocator();1797 const gpa = general_purpose_allocator.allocator();
17981798
1799 const args = try std.process.argsAlloc(arena);1799 const args = try std.process.argsAlloc(arena);
lib/compiler/aro_translate_c/ast.zig+1-1
...@@ -808,7 +808,7 @@ const Context = struct {...@@ -808,7 +808,7 @@ const Context = struct {
808 gpa: Allocator,808 gpa: Allocator,
809 buf: std.ArrayList(u8),809 buf: std.ArrayList(u8),
810 nodes: std.zig.Ast.NodeList = .{},810 nodes: std.zig.Ast.NodeList = .{},
811 extra_data: std.ArrayListUnmanaged(std.zig.Ast.Node.Index) = .{},811 extra_data: std.ArrayListUnmanaged(std.zig.Ast.Node.Index) = .empty,
812 tokens: std.zig.Ast.TokenList = .{},812 tokens: std.zig.Ast.TokenList = .{},
813813
814 fn addTokenFmt(c: *Context, tag: TokenTag, comptime format: []const u8, args: anytype) Allocator.Error!TokenIndex {814 fn addTokenFmt(c: *Context, tag: TokenTag, comptime format: []const u8, args: anytype) Allocator.Error!TokenIndex {
lib/compiler/build_runner.zig+2-2
...@@ -336,7 +336,7 @@ pub fn main() !void {...@@ -336,7 +336,7 @@ pub fn main() !void {
336 }336 }
337337
338 if (graph.needed_lazy_dependencies.entries.len != 0) {338 if (graph.needed_lazy_dependencies.entries.len != 0) {
339 var buffer: std.ArrayListUnmanaged(u8) = .{};339 var buffer: std.ArrayListUnmanaged(u8) = .empty;
340 for (graph.needed_lazy_dependencies.keys()) |k| {340 for (graph.needed_lazy_dependencies.keys()) |k| {
341 try buffer.appendSlice(arena, k);341 try buffer.appendSlice(arena, k);
342 try buffer.append(arena, '\n');342 try buffer.append(arena, '\n');
...@@ -1173,7 +1173,7 @@ pub fn printErrorMessages(...@@ -1173,7 +1173,7 @@ pub fn printErrorMessages(
1173 // Provide context for where these error messages are coming from by1173 // Provide context for where these error messages are coming from by
1174 // printing the corresponding Step subtree.1174 // printing the corresponding Step subtree.
11751175
1176 var step_stack: std.ArrayListUnmanaged(*Step) = .{};1176 var step_stack: std.ArrayListUnmanaged(*Step) = .empty;
1177 defer step_stack.deinit(gpa);1177 defer step_stack.deinit(gpa);
1178 try step_stack.append(gpa, failing_step);1178 try step_stack.append(gpa, failing_step);
1179 while (step_stack.items[step_stack.items.len - 1].dependants.items.len != 0) {1179 while (step_stack.items[step_stack.items.len - 1].dependants.items.len != 0) {
lib/compiler/objcopy.zig+1-1
...@@ -15,7 +15,7 @@ pub fn main() !void {...@@ -15,7 +15,7 @@ pub fn main() !void {
15 defer arena_instance.deinit();15 defer arena_instance.deinit();
16 const arena = arena_instance.allocator();16 const arena = arena_instance.allocator();
1717
18 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};18 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
19 const gpa = general_purpose_allocator.allocator();19 const gpa = general_purpose_allocator.allocator();
2020
21 const args = try std.process.argsAlloc(arena);21 const args = try std.process.argsAlloc(arena);
lib/compiler/reduce.zig+2-2
...@@ -51,7 +51,7 @@ pub fn main() !void {...@@ -51,7 +51,7 @@ pub fn main() !void {
51 defer arena_instance.deinit();51 defer arena_instance.deinit();
52 const arena = arena_instance.allocator();52 const arena = arena_instance.allocator();
5353
54 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};54 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
55 const gpa = general_purpose_allocator.allocator();55 const gpa = general_purpose_allocator.allocator();
5656
57 const args = try std.process.argsAlloc(arena);57 const args = try std.process.argsAlloc(arena);
...@@ -109,7 +109,7 @@ pub fn main() !void {...@@ -109,7 +109,7 @@ pub fn main() !void {
109 const root_source_file_path = opt_root_source_file_path orelse109 const root_source_file_path = opt_root_source_file_path orelse
110 fatal("missing root source file path argument; see -h for usage", .{});110 fatal("missing root source file path argument; see -h for usage", .{});
111111
112 var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .{};112 var interestingness_argv: std.ArrayListUnmanaged([]const u8) = .empty;
113 try interestingness_argv.ensureUnusedCapacity(arena, argv.len + 1);113 try interestingness_argv.ensureUnusedCapacity(arena, argv.len + 1);
114 interestingness_argv.appendAssumeCapacity(checker_path);114 interestingness_argv.appendAssumeCapacity(checker_path);
115 interestingness_argv.appendSliceAssumeCapacity(argv);115 interestingness_argv.appendSliceAssumeCapacity(argv);
lib/compiler/resinator/ast.zig+1-1
...@@ -28,7 +28,7 @@ pub const Tree = struct {...@@ -28,7 +28,7 @@ pub const Tree = struct {
28};28};
2929
30pub const CodePageLookup = struct {30pub const CodePageLookup = struct {
31 lookup: std.ArrayListUnmanaged(CodePage) = .{},31 lookup: std.ArrayListUnmanaged(CodePage) = .empty,
32 allocator: Allocator,32 allocator: Allocator,
33 default_code_page: CodePage,33 default_code_page: CodePage,
3434
lib/compiler/resinator/cli.zig+4-4
...@@ -70,13 +70,13 @@ pub fn writeUsage(writer: anytype, command_name: []const u8) !void {...@@ -70,13 +70,13 @@ pub fn writeUsage(writer: anytype, command_name: []const u8) !void {
70}70}
7171
72pub const Diagnostics = struct {72pub const Diagnostics = struct {
73 errors: std.ArrayListUnmanaged(ErrorDetails) = .{},73 errors: std.ArrayListUnmanaged(ErrorDetails) = .empty,
74 allocator: Allocator,74 allocator: Allocator,
7575
76 pub const ErrorDetails = struct {76 pub const ErrorDetails = struct {
77 arg_index: usize,77 arg_index: usize,
78 arg_span: ArgSpan = .{},78 arg_span: ArgSpan = .{},
79 msg: std.ArrayListUnmanaged(u8) = .{},79 msg: std.ArrayListUnmanaged(u8) = .empty,
80 type: Type = .err,80 type: Type = .err,
81 print_args: bool = true,81 print_args: bool = true,
8282
...@@ -132,13 +132,13 @@ pub const Options = struct {...@@ -132,13 +132,13 @@ pub const Options = struct {
132 allocator: Allocator,132 allocator: Allocator,
133 input_filename: []const u8 = &[_]u8{},133 input_filename: []const u8 = &[_]u8{},
134 output_filename: []const u8 = &[_]u8{},134 output_filename: []const u8 = &[_]u8{},
135 extra_include_paths: std.ArrayListUnmanaged([]const u8) = .{},135 extra_include_paths: std.ArrayListUnmanaged([]const u8) = .empty,
136 ignore_include_env_var: bool = false,136 ignore_include_env_var: bool = false,
137 preprocess: Preprocess = .yes,137 preprocess: Preprocess = .yes,
138 default_language_id: ?u16 = null,138 default_language_id: ?u16 = null,
139 default_code_page: ?CodePage = null,139 default_code_page: ?CodePage = null,
140 verbose: bool = false,140 verbose: bool = false,
141 symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .{},141 symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .empty,
142 null_terminate_string_table_strings: bool = false,142 null_terminate_string_table_strings: bool = false,
143 max_string_literal_codepoints: u15 = lex.default_max_string_literal_codepoints,143 max_string_literal_codepoints: u15 = lex.default_max_string_literal_codepoints,
144 silent_duplicate_control_ids: bool = false,144 silent_duplicate_control_ids: bool = false,
lib/compiler/resinator/compile.zig+5-5
...@@ -3004,9 +3004,9 @@ test "limitedWriter basic usage" {...@@ -3004,9 +3004,9 @@ test "limitedWriter basic usage" {
3004}3004}
30053005
3006pub const FontDir = struct {3006pub const FontDir = struct {
3007 fonts: std.ArrayListUnmanaged(Font) = .{},3007 fonts: std.ArrayListUnmanaged(Font) = .empty,
3008 /// To keep track of which ids are set and where they were set from3008 /// To keep track of which ids are set and where they were set from
3009 ids: std.AutoHashMapUnmanaged(u16, Token) = .{},3009 ids: std.AutoHashMapUnmanaged(u16, Token) = .empty,
30103010
3011 pub const Font = struct {3011 pub const Font = struct {
3012 id: u16,3012 id: u16,
...@@ -3112,7 +3112,7 @@ pub const StringTablesByLanguage = struct {...@@ -3112,7 +3112,7 @@ pub const StringTablesByLanguage = struct {
3112 /// when the first STRINGTABLE for the language was defined, and all blocks for a given3112 /// when the first STRINGTABLE for the language was defined, and all blocks for a given
3113 /// language are written contiguously.3113 /// language are written contiguously.
3114 /// Using an ArrayHashMap here gives us this property for free.3114 /// Using an ArrayHashMap here gives us this property for free.
3115 tables: std.AutoArrayHashMapUnmanaged(res.Language, StringTable) = .{},3115 tables: std.AutoArrayHashMapUnmanaged(res.Language, StringTable) = .empty,
31163116
3117 pub fn deinit(self: *StringTablesByLanguage, allocator: Allocator) void {3117 pub fn deinit(self: *StringTablesByLanguage, allocator: Allocator) void {
3118 self.tables.deinit(allocator);3118 self.tables.deinit(allocator);
...@@ -3143,10 +3143,10 @@ pub const StringTable = struct {...@@ -3143,10 +3143,10 @@ pub const StringTable = struct {
3143 /// was added to the block (i.e. `STRINGTABLE { 16 "b" 0 "a" }` would then get written3143 /// was added to the block (i.e. `STRINGTABLE { 16 "b" 0 "a" }` would then get written
3144 /// with block ID 2 (the one with "b") first and block ID 1 (the one with "a") second).3144 /// with block ID 2 (the one with "b") first and block ID 1 (the one with "a") second).
3145 /// Using an ArrayHashMap here gives us this property for free.3145 /// Using an ArrayHashMap here gives us this property for free.
3146 blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .{},3146 blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .empty,
31473147
3148 pub const Block = struct {3148 pub const Block = struct {
3149 strings: std.ArrayListUnmanaged(Token) = .{},3149 strings: std.ArrayListUnmanaged(Token) = .empty,
3150 set_indexes: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 },3150 set_indexes: std.bit_set.IntegerBitSet(16) = .{ .mask = 0 },
3151 memory_flags: MemoryFlags = MemoryFlags.defaults(res.RT.STRING),3151 memory_flags: MemoryFlags = MemoryFlags.defaults(res.RT.STRING),
3152 characteristics: u32,3152 characteristics: u32,
lib/compiler/resinator/errors.zig+3-3
...@@ -13,10 +13,10 @@ const builtin = @import("builtin");...@@ -13,10 +13,10 @@ const builtin = @import("builtin");
13const native_endian = builtin.cpu.arch.endian();13const native_endian = builtin.cpu.arch.endian();
1414
15pub const Diagnostics = struct {15pub const Diagnostics = struct {
16 errors: std.ArrayListUnmanaged(ErrorDetails) = .{},16 errors: std.ArrayListUnmanaged(ErrorDetails) = .empty,
17 /// Append-only, cannot handle removing strings.17 /// Append-only, cannot handle removing strings.
18 /// Expects to own all strings within the list.18 /// Expects to own all strings within the list.
19 strings: std.ArrayListUnmanaged([]const u8) = .{},19 strings: std.ArrayListUnmanaged([]const u8) = .empty,
20 allocator: std.mem.Allocator,20 allocator: std.mem.Allocator,
2121
22 pub fn init(allocator: std.mem.Allocator) Diagnostics {22 pub fn init(allocator: std.mem.Allocator) Diagnostics {
...@@ -968,7 +968,7 @@ pub fn renderErrorMessage(allocator: std.mem.Allocator, writer: anytype, tty_con...@@ -968,7 +968,7 @@ pub fn renderErrorMessage(allocator: std.mem.Allocator, writer: anytype, tty_con
968const CorrespondingLines = struct {968const CorrespondingLines = struct {
969 worth_printing_note: bool = true,969 worth_printing_note: bool = true,
970 worth_printing_lines: bool = true,970 worth_printing_lines: bool = true,
971 lines: std.ArrayListUnmanaged(u8) = .{},971 lines: std.ArrayListUnmanaged(u8) = .empty,
972 lines_is_error_message: bool = false,972 lines_is_error_message: bool = false,
973973
974 pub fn init(allocator: std.mem.Allocator, cwd: std.fs.Dir, err_details: ErrorDetails, lines_for_comparison: []const u8, corresponding_span: SourceMappings.CorrespondingSpan, corresponding_file: []const u8) !CorrespondingLines {974 pub fn init(allocator: std.mem.Allocator, cwd: std.fs.Dir, err_details: ErrorDetails, lines_for_comparison: []const u8, corresponding_span: SourceMappings.CorrespondingSpan, corresponding_file: []const u8) !CorrespondingLines {
lib/compiler/resinator/main.zig+5-5
...@@ -10,7 +10,7 @@ const renderErrorMessage = @import("utils.zig").renderErrorMessage;...@@ -10,7 +10,7 @@ const renderErrorMessage = @import("utils.zig").renderErrorMessage;
10const aro = @import("aro");10const aro = @import("aro");
1111
12pub fn main() !void {12pub fn main() !void {
13 var gpa = std.heap.GeneralPurposeAllocator(.{}){};13 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
14 defer std.debug.assert(gpa.deinit() == .ok);14 defer std.debug.assert(gpa.deinit() == .ok);
15 const allocator = gpa.allocator();15 const allocator = gpa.allocator();
1616
...@@ -432,7 +432,7 @@ fn cliDiagnosticsToErrorBundle(...@@ -432,7 +432,7 @@ fn cliDiagnosticsToErrorBundle(
432 });432 });
433433
434 var cur_err: ?ErrorBundle.ErrorMessage = null;434 var cur_err: ?ErrorBundle.ErrorMessage = null;
435 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{};435 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty;
436 defer cur_notes.deinit(gpa);436 defer cur_notes.deinit(gpa);
437 for (diagnostics.errors.items) |err_details| {437 for (diagnostics.errors.items) |err_details| {
438 switch (err_details.type) {438 switch (err_details.type) {
...@@ -474,10 +474,10 @@ fn diagnosticsToErrorBundle(...@@ -474,10 +474,10 @@ fn diagnosticsToErrorBundle(
474 try bundle.init(gpa);474 try bundle.init(gpa);
475 errdefer bundle.deinit();475 errdefer bundle.deinit();
476476
477 var msg_buf: std.ArrayListUnmanaged(u8) = .{};477 var msg_buf: std.ArrayListUnmanaged(u8) = .empty;
478 defer msg_buf.deinit(gpa);478 defer msg_buf.deinit(gpa);
479 var cur_err: ?ErrorBundle.ErrorMessage = null;479 var cur_err: ?ErrorBundle.ErrorMessage = null;
480 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{};480 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty;
481 defer cur_notes.deinit(gpa);481 defer cur_notes.deinit(gpa);
482 for (diagnostics.errors.items) |err_details| {482 for (diagnostics.errors.items) |err_details| {
483 switch (err_details.type) {483 switch (err_details.type) {
...@@ -587,7 +587,7 @@ fn aroDiagnosticsToErrorBundle(...@@ -587,7 +587,7 @@ fn aroDiagnosticsToErrorBundle(
587 var msg_writer = MsgWriter.init(gpa);587 var msg_writer = MsgWriter.init(gpa);
588 defer msg_writer.deinit();588 defer msg_writer.deinit();
589 var cur_err: ?ErrorBundle.ErrorMessage = null;589 var cur_err: ?ErrorBundle.ErrorMessage = null;
590 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .{};590 var cur_notes: std.ArrayListUnmanaged(ErrorBundle.ErrorMessage) = .empty;
591 defer cur_notes.deinit(gpa);591 defer cur_notes.deinit(gpa);
592 for (comp.diagnostics.list.items) |msg| {592 for (comp.diagnostics.list.items) |msg| {
593 switch (msg.kind) {593 switch (msg.kind) {
lib/compiler/resinator/parse.zig+15-15
...@@ -111,7 +111,7 @@ pub const Parser = struct {...@@ -111,7 +111,7 @@ pub const Parser = struct {
111 /// current token is unchanged.111 /// current token is unchanged.
112 /// The returned slice is allocated by the parser's arena112 /// The returned slice is allocated by the parser's arena
113 fn parseCommonResourceAttributes(self: *Self) ![]Token {113 fn parseCommonResourceAttributes(self: *Self) ![]Token {
114 var common_resource_attributes = std.ArrayListUnmanaged(Token){};114 var common_resource_attributes: std.ArrayListUnmanaged(Token) = .empty;
115 while (true) {115 while (true) {
116 const maybe_common_resource_attribute = try self.lookaheadToken(.normal);116 const maybe_common_resource_attribute = try self.lookaheadToken(.normal);
117 if (maybe_common_resource_attribute.id == .literal and rc.CommonResourceAttributes.map.has(maybe_common_resource_attribute.slice(self.lexer.buffer))) {117 if (maybe_common_resource_attribute.id == .literal and rc.CommonResourceAttributes.map.has(maybe_common_resource_attribute.slice(self.lexer.buffer))) {
...@@ -131,7 +131,7 @@ pub const Parser = struct {...@@ -131,7 +131,7 @@ pub const Parser = struct {
131 /// current token is unchanged.131 /// current token is unchanged.
132 /// The returned slice is allocated by the parser's arena132 /// The returned slice is allocated by the parser's arena
133 fn parseOptionalStatements(self: *Self, resource: Resource) ![]*Node {133 fn parseOptionalStatements(self: *Self, resource: Resource) ![]*Node {
134 var optional_statements = std.ArrayListUnmanaged(*Node){};134 var optional_statements: std.ArrayListUnmanaged(*Node) = .empty;
135 while (true) {135 while (true) {
136 const lookahead_token = try self.lookaheadToken(.normal);136 const lookahead_token = try self.lookaheadToken(.normal);
137 if (lookahead_token.id != .literal) break;137 if (lookahead_token.id != .literal) break;
...@@ -445,7 +445,7 @@ pub const Parser = struct {...@@ -445,7 +445,7 @@ pub const Parser = struct {
445 const begin_token = self.state.token;445 const begin_token = self.state.token;
446 try self.check(.begin);446 try self.check(.begin);
447447
448 var accelerators = std.ArrayListUnmanaged(*Node){};448 var accelerators: std.ArrayListUnmanaged(*Node) = .empty;
449449
450 while (true) {450 while (true) {
451 const lookahead = try self.lookaheadToken(.normal);451 const lookahead = try self.lookaheadToken(.normal);
...@@ -463,7 +463,7 @@ pub const Parser = struct {...@@ -463,7 +463,7 @@ pub const Parser = struct {
463463
464 const idvalue = try self.parseExpression(.{ .allowed_types = .{ .number = true } });464 const idvalue = try self.parseExpression(.{ .allowed_types = .{ .number = true } });
465465
466 var type_and_options = std.ArrayListUnmanaged(Token){};466 var type_and_options: std.ArrayListUnmanaged(Token) = .empty;
467 while (true) {467 while (true) {
468 if (!(try self.parseOptionalToken(.comma))) break;468 if (!(try self.parseOptionalToken(.comma))) break;
469469
...@@ -528,7 +528,7 @@ pub const Parser = struct {...@@ -528,7 +528,7 @@ pub const Parser = struct {
528 const begin_token = self.state.token;528 const begin_token = self.state.token;
529 try self.check(.begin);529 try self.check(.begin);
530530
531 var controls = std.ArrayListUnmanaged(*Node){};531 var controls: std.ArrayListUnmanaged(*Node) = .empty;
532 defer controls.deinit(self.state.allocator);532 defer controls.deinit(self.state.allocator);
533 while (try self.parseControlStatement(resource)) |control_node| {533 while (try self.parseControlStatement(resource)) |control_node| {
534 // The number of controls must fit in a u16 in order for it to534 // The number of controls must fit in a u16 in order for it to
...@@ -587,7 +587,7 @@ pub const Parser = struct {...@@ -587,7 +587,7 @@ pub const Parser = struct {
587 const begin_token = self.state.token;587 const begin_token = self.state.token;
588 try self.check(.begin);588 try self.check(.begin);
589589
590 var buttons = std.ArrayListUnmanaged(*Node){};590 var buttons: std.ArrayListUnmanaged(*Node) = .empty;
591 defer buttons.deinit(self.state.allocator);591 defer buttons.deinit(self.state.allocator);
592 while (try self.parseToolbarButtonStatement()) |button_node| {592 while (try self.parseToolbarButtonStatement()) |button_node| {
593 // The number of buttons must fit in a u16 in order for it to593 // The number of buttons must fit in a u16 in order for it to
...@@ -645,7 +645,7 @@ pub const Parser = struct {...@@ -645,7 +645,7 @@ pub const Parser = struct {
645 const begin_token = self.state.token;645 const begin_token = self.state.token;
646 try self.check(.begin);646 try self.check(.begin);
647647
648 var items = std.ArrayListUnmanaged(*Node){};648 var items: std.ArrayListUnmanaged(*Node) = .empty;
649 defer items.deinit(self.state.allocator);649 defer items.deinit(self.state.allocator);
650 while (try self.parseMenuItemStatement(resource, id_token, 1)) |item_node| {650 while (try self.parseMenuItemStatement(resource, id_token, 1)) |item_node| {
651 try items.append(self.state.allocator, item_node);651 try items.append(self.state.allocator, item_node);
...@@ -679,7 +679,7 @@ pub const Parser = struct {...@@ -679,7 +679,7 @@ pub const Parser = struct {
679 // common resource attributes must all be contiguous and come before optional-statements679 // common resource attributes must all be contiguous and come before optional-statements
680 const common_resource_attributes = try self.parseCommonResourceAttributes();680 const common_resource_attributes = try self.parseCommonResourceAttributes();
681681
682 var fixed_info = std.ArrayListUnmanaged(*Node){};682 var fixed_info: std.ArrayListUnmanaged(*Node) = .empty;
683 while (try self.parseVersionStatement()) |version_statement| {683 while (try self.parseVersionStatement()) |version_statement| {
684 try fixed_info.append(self.state.arena, version_statement);684 try fixed_info.append(self.state.arena, version_statement);
685 }685 }
...@@ -688,7 +688,7 @@ pub const Parser = struct {...@@ -688,7 +688,7 @@ pub const Parser = struct {
688 const begin_token = self.state.token;688 const begin_token = self.state.token;
689 try self.check(.begin);689 try self.check(.begin);
690690
691 var block_statements = std.ArrayListUnmanaged(*Node){};691 var block_statements: std.ArrayListUnmanaged(*Node) = .empty;
692 while (try self.parseVersionBlockOrValue(id_token, 1)) |block_node| {692 while (try self.parseVersionBlockOrValue(id_token, 1)) |block_node| {
693 try block_statements.append(self.state.arena, block_node);693 try block_statements.append(self.state.arena, block_node);
694 }694 }
...@@ -1064,7 +1064,7 @@ pub const Parser = struct {...@@ -1064,7 +1064,7 @@ pub const Parser = struct {
10641064
1065 _ = try self.parseOptionalToken(.comma);1065 _ = try self.parseOptionalToken(.comma);
10661066
1067 var options = std.ArrayListUnmanaged(Token){};1067 var options: std.ArrayListUnmanaged(Token) = .empty;
1068 while (true) {1068 while (true) {
1069 const option_token = try self.lookaheadToken(.normal);1069 const option_token = try self.lookaheadToken(.normal);
1070 if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) {1070 if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) {
...@@ -1099,7 +1099,7 @@ pub const Parser = struct {...@@ -1099,7 +1099,7 @@ pub const Parser = struct {
1099 }1099 }
1100 try self.skipAnyCommas();1100 try self.skipAnyCommas();
11011101
1102 var options = std.ArrayListUnmanaged(Token){};1102 var options: std.ArrayListUnmanaged(Token) = .empty;
1103 while (true) {1103 while (true) {
1104 const option_token = try self.lookaheadToken(.normal);1104 const option_token = try self.lookaheadToken(.normal);
1105 if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) {1105 if (!rc.MenuItem.Option.map.has(option_token.slice(self.lexer.buffer))) {
...@@ -1114,7 +1114,7 @@ pub const Parser = struct {...@@ -1114,7 +1114,7 @@ pub const Parser = struct {
1114 const begin_token = self.state.token;1114 const begin_token = self.state.token;
1115 try self.check(.begin);1115 try self.check(.begin);
11161116
1117 var items = std.ArrayListUnmanaged(*Node){};1117 var items: std.ArrayListUnmanaged(*Node) = .empty;
1118 while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| {1118 while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| {
1119 try items.append(self.state.arena, item_node);1119 try items.append(self.state.arena, item_node);
1120 }1120 }
...@@ -1184,7 +1184,7 @@ pub const Parser = struct {...@@ -1184,7 +1184,7 @@ pub const Parser = struct {
1184 const begin_token = self.state.token;1184 const begin_token = self.state.token;
1185 try self.check(.begin);1185 try self.check(.begin);
11861186
1187 var items = std.ArrayListUnmanaged(*Node){};1187 var items: std.ArrayListUnmanaged(*Node) = .empty;
1188 while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| {1188 while (try self.parseMenuItemStatement(resource, top_level_menu_id_token, nesting_level + 1)) |item_node| {
1189 try items.append(self.state.arena, item_node);1189 try items.append(self.state.arena, item_node);
1190 }1190 }
...@@ -1341,7 +1341,7 @@ pub const Parser = struct {...@@ -1341,7 +1341,7 @@ pub const Parser = struct {
1341 const begin_token = self.state.token;1341 const begin_token = self.state.token;
1342 try self.check(.begin);1342 try self.check(.begin);
13431343
1344 var children = std.ArrayListUnmanaged(*Node){};1344 var children: std.ArrayListUnmanaged(*Node) = .empty;
1345 while (try self.parseVersionBlockOrValue(top_level_version_id_token, nesting_level + 1)) |value_node| {1345 while (try self.parseVersionBlockOrValue(top_level_version_id_token, nesting_level + 1)) |value_node| {
1346 try children.append(self.state.arena, value_node);1346 try children.append(self.state.arena, value_node);
1347 }1347 }
...@@ -1374,7 +1374,7 @@ pub const Parser = struct {...@@ -1374,7 +1374,7 @@ pub const Parser = struct {
1374 }1374 }
13751375
1376 fn parseBlockValuesList(self: *Self, had_comma_before_first_value: bool) Error![]*Node {1376 fn parseBlockValuesList(self: *Self, had_comma_before_first_value: bool) Error![]*Node {
1377 var values = std.ArrayListUnmanaged(*Node){};1377 var values: std.ArrayListUnmanaged(*Node) = .empty;
1378 var seen_number: bool = false;1378 var seen_number: bool = false;
1379 var first_string_value: ?*Node = null;1379 var first_string_value: ?*Node = null;
1380 while (true) {1380 while (true) {
lib/compiler/resinator/source_mapping.zig+3-3
...@@ -10,7 +10,7 @@ pub const ParseLineCommandsResult = struct {...@@ -10,7 +10,7 @@ pub const ParseLineCommandsResult = struct {
1010
11const CurrentMapping = struct {11const CurrentMapping = struct {
12 line_num: usize = 1,12 line_num: usize = 1,
13 filename: std.ArrayListUnmanaged(u8) = .{},13 filename: std.ArrayListUnmanaged(u8) = .empty,
14 pending: bool = true,14 pending: bool = true,
15 ignore_contents: bool = false,15 ignore_contents: bool = false,
16};16};
...@@ -626,8 +626,8 @@ test "SourceMappings collapse" {...@@ -626,8 +626,8 @@ test "SourceMappings collapse" {
626626
627/// Same thing as StringTable in Zig's src/Wasm.zig627/// Same thing as StringTable in Zig's src/Wasm.zig
628pub const StringTable = struct {628pub const StringTable = struct {
629 data: std.ArrayListUnmanaged(u8) = .{},629 data: std.ArrayListUnmanaged(u8) = .empty,
630 map: std.HashMapUnmanaged(u32, void, std.hash_map.StringIndexContext, std.hash_map.default_max_load_percentage) = .{},630 map: std.HashMapUnmanaged(u32, void, std.hash_map.StringIndexContext, std.hash_map.default_max_load_percentage) = .empty,
631631
632 pub fn deinit(self: *StringTable, allocator: Allocator) void {632 pub fn deinit(self: *StringTable, allocator: Allocator) void {
633 self.data.deinit(allocator);633 self.data.deinit(allocator);
lib/compiler/std-docs.zig+2-2
...@@ -25,7 +25,7 @@ pub fn main() !void {...@@ -25,7 +25,7 @@ pub fn main() !void {
25 defer arena_instance.deinit();25 defer arena_instance.deinit();
26 const arena = arena_instance.allocator();26 const arena = arena_instance.allocator();
2727
28 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};28 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
29 const gpa = general_purpose_allocator.allocator();29 const gpa = general_purpose_allocator.allocator();
3030
31 var argv = try std.process.argsWithAllocator(arena);31 var argv = try std.process.argsWithAllocator(arena);
...@@ -265,7 +265,7 @@ fn buildWasmBinary(...@@ -265,7 +265,7 @@ fn buildWasmBinary(
265) !Cache.Path {265) !Cache.Path {
266 const gpa = context.gpa;266 const gpa = context.gpa;
267267
268 var argv: std.ArrayListUnmanaged([]const u8) = .{};268 var argv: std.ArrayListUnmanaged([]const u8) = .empty;
269269
270 try argv.appendSlice(arena, &.{270 try argv.appendSlice(arena, &.{
271 context.zig_exe_path, //271 context.zig_exe_path, //
lib/compiler/test_runner.zig+1-1
...@@ -85,7 +85,7 @@ fn mainServer() !void {...@@ -85,7 +85,7 @@ fn mainServer() !void {
85 @panic("internal test runner memory leak");85 @panic("internal test runner memory leak");
86 };86 };
8787
88 var string_bytes: std.ArrayListUnmanaged(u8) = .{};88 var string_bytes: std.ArrayListUnmanaged(u8) = .empty;
89 defer string_bytes.deinit(testing.allocator);89 defer string_bytes.deinit(testing.allocator);
90 try string_bytes.append(testing.allocator, 0); // Reserve 0 for null.90 try string_bytes.append(testing.allocator, 0); // Reserve 0 for null.
9191
lib/docs/wasm/Walk.zig+10-10
...@@ -10,9 +10,9 @@ const Oom = error{OutOfMemory};...@@ -10,9 +10,9 @@ const Oom = error{OutOfMemory};
1010
11pub const Decl = @import("Decl.zig");11pub const Decl = @import("Decl.zig");
1212
13pub var files: std.StringArrayHashMapUnmanaged(File) = .{};13pub var files: std.StringArrayHashMapUnmanaged(File) = .empty;
14pub var decls: std.ArrayListUnmanaged(Decl) = .{};14pub var decls: std.ArrayListUnmanaged(Decl) = .empty;
15pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .{};15pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .empty;
1616
17file: File.Index,17file: File.Index,
1818
...@@ -42,17 +42,17 @@ pub const Category = union(enum(u8)) {...@@ -42,17 +42,17 @@ pub const Category = union(enum(u8)) {
42pub const File = struct {42pub const File = struct {
43 ast: Ast,43 ast: Ast,
44 /// Maps identifiers to the declarations they point to.44 /// Maps identifiers to the declarations they point to.
45 ident_decls: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .{},45 ident_decls: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .empty,
46 /// Maps field access identifiers to the containing field access node.46 /// Maps field access identifiers to the containing field access node.
47 token_parents: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .{},47 token_parents: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .empty,
48 /// Maps declarations to their global index.48 /// Maps declarations to their global index.
49 node_decls: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Decl.Index) = .{},49 node_decls: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Decl.Index) = .empty,
50 /// Maps function declarations to doctests.50 /// Maps function declarations to doctests.
51 doctests: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .{},51 doctests: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty,
52 /// root node => its namespace scope52 /// root node => its namespace scope
53 /// struct/union/enum/opaque decl node => its namespace scope53 /// struct/union/enum/opaque decl node => its namespace scope
54 /// local var decl node => its local variable scope54 /// local var decl node => its local variable scope
55 scopes: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, *Scope) = .{},55 scopes: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, *Scope) = .empty,
5656
57 pub fn lookup_token(file: *File, token: Ast.TokenIndex) Decl.Index {57 pub fn lookup_token(file: *File, token: Ast.TokenIndex) Decl.Index {
58 const decl_node = file.ident_decls.get(token) orelse return .none;58 const decl_node = file.ident_decls.get(token) orelse return .none;
...@@ -464,8 +464,8 @@ pub const Scope = struct {...@@ -464,8 +464,8 @@ pub const Scope = struct {
464 const Namespace = struct {464 const Namespace = struct {
465 base: Scope = .{ .tag = .namespace },465 base: Scope = .{ .tag = .namespace },
466 parent: *Scope,466 parent: *Scope,
467 names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .{},467 names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty,
468 doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .{},468 doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty,
469 decl_index: Decl.Index,469 decl_index: Decl.Index,
470 };470 };
471471
lib/docs/wasm/html_render.zig+1-1
...@@ -38,7 +38,7 @@ pub fn fileSourceHtml(...@@ -38,7 +38,7 @@ pub fn fileSourceHtml(
38 const file = file_index.get();38 const file = file_index.get();
3939
40 const g = struct {40 const g = struct {
41 var field_access_buffer: std.ArrayListUnmanaged(u8) = .{};41 var field_access_buffer: std.ArrayListUnmanaged(u8) = .empty;
42 };42 };
4343
44 const token_tags = ast.tokens.items(.tag);44 const token_tags = ast.tokens.items(.tag);
lib/docs/wasm/main.zig+14-14
...@@ -60,8 +60,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void {...@@ -60,8 +60,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void {
60 };60 };
61}61}
6262
63var query_string: std.ArrayListUnmanaged(u8) = .{};63var query_string: std.ArrayListUnmanaged(u8) = .empty;
64var query_results: std.ArrayListUnmanaged(Decl.Index) = .{};64var query_results: std.ArrayListUnmanaged(Decl.Index) = .empty;
6565
66/// Resizes the query string to be the correct length; returns the pointer to66/// Resizes the query string to be the correct length; returns the pointer to
67/// the query string.67/// the query string.
...@@ -93,11 +93,11 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void {...@@ -93,11 +93,11 @@ fn query_exec_fallible(query: []const u8, ignore_case: bool) !void {
93 segments: u16,93 segments: u16,
94 };94 };
95 const g = struct {95 const g = struct {
96 var full_path_search_text: std.ArrayListUnmanaged(u8) = .{};96 var full_path_search_text: std.ArrayListUnmanaged(u8) = .empty;
97 var full_path_search_text_lower: std.ArrayListUnmanaged(u8) = .{};97 var full_path_search_text_lower: std.ArrayListUnmanaged(u8) = .empty;
98 var doc_search_text: std.ArrayListUnmanaged(u8) = .{};98 var doc_search_text: std.ArrayListUnmanaged(u8) = .empty;
99 /// Each element matches a corresponding query_results element.99 /// Each element matches a corresponding query_results element.
100 var scores: std.ArrayListUnmanaged(Score) = .{};100 var scores: std.ArrayListUnmanaged(Score) = .empty;
101 };101 };
102102
103 // First element stores the size of the list.103 // First element stores the size of the list.
...@@ -255,8 +255,8 @@ const ErrorIdentifier = packed struct(u64) {...@@ -255,8 +255,8 @@ const ErrorIdentifier = packed struct(u64) {
255 }255 }
256};256};
257257
258var string_result: std.ArrayListUnmanaged(u8) = .{};258var string_result: std.ArrayListUnmanaged(u8) = .empty;
259var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .{};259var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .empty;
260260
261export fn decl_error_set(decl_index: Decl.Index) Slice(ErrorIdentifier) {261export fn decl_error_set(decl_index: Decl.Index) Slice(ErrorIdentifier) {
262 return Slice(ErrorIdentifier).init(decl_error_set_fallible(decl_index) catch @panic("OOM"));262 return Slice(ErrorIdentifier).init(decl_error_set_fallible(decl_index) catch @panic("OOM"));
...@@ -381,7 +381,7 @@ export fn decl_params(decl_index: Decl.Index) Slice(Ast.Node.Index) {...@@ -381,7 +381,7 @@ export fn decl_params(decl_index: Decl.Index) Slice(Ast.Node.Index) {
381381
382fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {382fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {
383 const g = struct {383 const g = struct {
384 var result: std.ArrayListUnmanaged(Ast.Node.Index) = .{};384 var result: std.ArrayListUnmanaged(Ast.Node.Index) = .empty;
385 };385 };
386 g.result.clearRetainingCapacity();386 g.result.clearRetainingCapacity();
387 const decl = decl_index.get();387 const decl = decl_index.get();
...@@ -403,7 +403,7 @@ fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {...@@ -403,7 +403,7 @@ fn decl_fields_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {
403403
404fn decl_params_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {404fn decl_params_fallible(decl_index: Decl.Index) ![]Ast.Node.Index {
405 const g = struct {405 const g = struct {
406 var result: std.ArrayListUnmanaged(Ast.Node.Index) = .{};406 var result: std.ArrayListUnmanaged(Ast.Node.Index) = .empty;
407 };407 };
408 g.result.clearRetainingCapacity();408 g.result.clearRetainingCapacity();
409 const decl = decl_index.get();409 const decl = decl_index.get();
...@@ -672,7 +672,7 @@ fn render_docs(...@@ -672,7 +672,7 @@ fn render_docs(
672 defer parsed_doc.deinit(gpa);672 defer parsed_doc.deinit(gpa);
673673
674 const g = struct {674 const g = struct {
675 var link_buffer: std.ArrayListUnmanaged(u8) = .{};675 var link_buffer: std.ArrayListUnmanaged(u8) = .empty;
676 };676 };
677677
678 const Writer = std.ArrayListUnmanaged(u8).Writer;678 const Writer = std.ArrayListUnmanaged(u8).Writer;
...@@ -817,7 +817,7 @@ export fn find_module_root(pkg: Walk.ModuleIndex) Decl.Index {...@@ -817,7 +817,7 @@ export fn find_module_root(pkg: Walk.ModuleIndex) Decl.Index {
817}817}
818818
819/// Set by `set_input_string`.819/// Set by `set_input_string`.
820var input_string: std.ArrayListUnmanaged(u8) = .{};820var input_string: std.ArrayListUnmanaged(u8) = .empty;
821821
822export fn set_input_string(len: usize) [*]u8 {822export fn set_input_string(len: usize) [*]u8 {
823 input_string.resize(gpa, len) catch @panic("OOM");823 input_string.resize(gpa, len) catch @panic("OOM");
...@@ -839,7 +839,7 @@ export fn find_decl() Decl.Index {...@@ -839,7 +839,7 @@ export fn find_decl() Decl.Index {
839 if (result != .none) return result;839 if (result != .none) return result;
840840
841 const g = struct {841 const g = struct {
842 var match_fqn: std.ArrayListUnmanaged(u8) = .{};842 var match_fqn: std.ArrayListUnmanaged(u8) = .empty;
843 };843 };
844 for (Walk.decls.items, 0..) |*decl, decl_index| {844 for (Walk.decls.items, 0..) |*decl, decl_index| {
845 g.match_fqn.clearRetainingCapacity();845 g.match_fqn.clearRetainingCapacity();
...@@ -888,7 +888,7 @@ export fn type_fn_members(parent: Decl.Index, include_private: bool) Slice(Decl....@@ -888,7 +888,7 @@ export fn type_fn_members(parent: Decl.Index, include_private: bool) Slice(Decl.
888888
889export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Decl.Index) {889export fn namespace_members(parent: Decl.Index, include_private: bool) Slice(Decl.Index) {
890 const g = struct {890 const g = struct {
891 var members: std.ArrayListUnmanaged(Decl.Index) = .{};891 var members: std.ArrayListUnmanaged(Decl.Index) = .empty;
892 };892 };
893893
894 g.members.clearRetainingCapacity();894 g.members.clearRetainingCapacity();
lib/docs/wasm/markdown/Parser.zig+7-7
...@@ -31,11 +31,11 @@ const ExtraData = Document.ExtraData;...@@ -31,11 +31,11 @@ const ExtraData = Document.ExtraData;
31const StringIndex = Document.StringIndex;31const StringIndex = Document.StringIndex;
3232
33nodes: Node.List = .{},33nodes: Node.List = .{},
34extra: std.ArrayListUnmanaged(u32) = .{},34extra: std.ArrayListUnmanaged(u32) = .empty,
35scratch_extra: std.ArrayListUnmanaged(u32) = .{},35scratch_extra: std.ArrayListUnmanaged(u32) = .empty,
36string_bytes: std.ArrayListUnmanaged(u8) = .{},36string_bytes: std.ArrayListUnmanaged(u8) = .empty,
37scratch_string: std.ArrayListUnmanaged(u8) = .{},37scratch_string: std.ArrayListUnmanaged(u8) = .empty,
38pending_blocks: std.ArrayListUnmanaged(Block) = .{},38pending_blocks: std.ArrayListUnmanaged(Block) = .empty,
39allocator: Allocator,39allocator: Allocator,
4040
41const Parser = @This();41const Parser = @This();
...@@ -928,8 +928,8 @@ const InlineParser = struct {...@@ -928,8 +928,8 @@ const InlineParser = struct {
928 parent: *Parser,928 parent: *Parser,
929 content: []const u8,929 content: []const u8,
930 pos: usize = 0,930 pos: usize = 0,
931 pending_inlines: std.ArrayListUnmanaged(PendingInline) = .{},931 pending_inlines: std.ArrayListUnmanaged(PendingInline) = .empty,
932 completed_inlines: std.ArrayListUnmanaged(CompletedInline) = .{},932 completed_inlines: std.ArrayListUnmanaged(CompletedInline) = .empty,
933933
934 const PendingInline = struct {934 const PendingInline = struct {
935 tag: Tag,935 tag: Tag,
lib/fuzzer.zig+1-1
...@@ -402,7 +402,7 @@ fn oom(err: anytype) noreturn {...@@ -402,7 +402,7 @@ fn oom(err: anytype) noreturn {
402 }402 }
403}403}
404404
405var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};405var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
406406
407var fuzzer: Fuzzer = .{407var fuzzer: Fuzzer = .{
408 .gpa = general_purpose_allocator.allocator(),408 .gpa = general_purpose_allocator.allocator(),
lib/fuzzer/web/main.zig+10-10
...@@ -58,7 +58,7 @@ export fn alloc(n: usize) [*]u8 {...@@ -58,7 +58,7 @@ export fn alloc(n: usize) [*]u8 {
58 return slice.ptr;58 return slice.ptr;
59}59}
6060
61var message_buffer: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .{};61var message_buffer: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .empty;
6262
63/// Resizes the message buffer to be the correct length; returns the pointer to63/// Resizes the message buffer to be the correct length; returns the pointer to
64/// the query string.64/// the query string.
...@@ -90,8 +90,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void {...@@ -90,8 +90,8 @@ export fn unpack(tar_ptr: [*]u8, tar_len: usize) void {
90}90}
9191
92/// Set by `set_input_string`.92/// Set by `set_input_string`.
93var input_string: std.ArrayListUnmanaged(u8) = .{};93var input_string: std.ArrayListUnmanaged(u8) = .empty;
94var string_result: std.ArrayListUnmanaged(u8) = .{};94var string_result: std.ArrayListUnmanaged(u8) = .empty;
9595
96export fn set_input_string(len: usize) [*]u8 {96export fn set_input_string(len: usize) [*]u8 {
97 input_string.resize(gpa, len) catch @panic("OOM");97 input_string.resize(gpa, len) catch @panic("OOM");
...@@ -249,7 +249,7 @@ fn coverageUpdateMessage(msg_bytes: []u8) error{OutOfMemory}!void {...@@ -249,7 +249,7 @@ fn coverageUpdateMessage(msg_bytes: []u8) error{OutOfMemory}!void {
249 js.emitCoverageUpdate();249 js.emitCoverageUpdate();
250}250}
251251
252var entry_points: std.ArrayListUnmanaged(u32) = .{};252var entry_points: std.ArrayListUnmanaged(u32) = .empty;
253253
254fn entryPointsMessage(msg_bytes: []u8) error{OutOfMemory}!void {254fn entryPointsMessage(msg_bytes: []u8) error{OutOfMemory}!void {
255 const header: abi.EntryPointHeader = @bitCast(msg_bytes[0..@sizeOf(abi.EntryPointHeader)].*);255 const header: abi.EntryPointHeader = @bitCast(msg_bytes[0..@sizeOf(abi.EntryPointHeader)].*);
...@@ -295,7 +295,7 @@ const SourceLocationIndex = enum(u32) {...@@ -295,7 +295,7 @@ const SourceLocationIndex = enum(u32) {
295 }295 }
296296
297 fn toWalkFile(sli: SourceLocationIndex) ?Walk.File.Index {297 fn toWalkFile(sli: SourceLocationIndex) ?Walk.File.Index {
298 var buf: std.ArrayListUnmanaged(u8) = .{};298 var buf: std.ArrayListUnmanaged(u8) = .empty;
299 defer buf.deinit(gpa);299 defer buf.deinit(gpa);
300 sli.appendPath(&buf) catch @panic("OOM");300 sli.appendPath(&buf) catch @panic("OOM");
301 return @enumFromInt(Walk.files.getIndex(buf.items) orelse return null);301 return @enumFromInt(Walk.files.getIndex(buf.items) orelse return null);
...@@ -307,7 +307,7 @@ const SourceLocationIndex = enum(u32) {...@@ -307,7 +307,7 @@ const SourceLocationIndex = enum(u32) {
307 ) error{ OutOfMemory, SourceUnavailable }!void {307 ) error{ OutOfMemory, SourceUnavailable }!void {
308 const walk_file_index = sli.toWalkFile() orelse return error.SourceUnavailable;308 const walk_file_index = sli.toWalkFile() orelse return error.SourceUnavailable;
309 const root_node = walk_file_index.findRootDecl().get().ast_node;309 const root_node = walk_file_index.findRootDecl().get().ast_node;
310 var annotations: std.ArrayListUnmanaged(html_render.Annotation) = .{};310 var annotations: std.ArrayListUnmanaged(html_render.Annotation) = .empty;
311 defer annotations.deinit(gpa);311 defer annotations.deinit(gpa);
312 try computeSourceAnnotations(sli.ptr().file, walk_file_index, &annotations, coverage_source_locations.items);312 try computeSourceAnnotations(sli.ptr().file, walk_file_index, &annotations, coverage_source_locations.items);
313 html_render.fileSourceHtml(walk_file_index, out, root_node, .{313 html_render.fileSourceHtml(walk_file_index, out, root_node, .{
...@@ -327,7 +327,7 @@ fn computeSourceAnnotations(...@@ -327,7 +327,7 @@ fn computeSourceAnnotations(
327 // Collect all the source locations from only this file into this array327 // Collect all the source locations from only this file into this array
328 // first, then sort by line, col, so that we can collect annotations with328 // first, then sort by line, col, so that we can collect annotations with
329 // O(N) time complexity.329 // O(N) time complexity.
330 var locs: std.ArrayListUnmanaged(SourceLocationIndex) = .{};330 var locs: std.ArrayListUnmanaged(SourceLocationIndex) = .empty;
331 defer locs.deinit(gpa);331 defer locs.deinit(gpa);
332332
333 for (source_locations, 0..) |sl, sli_usize| {333 for (source_locations, 0..) |sl, sli_usize| {
...@@ -374,9 +374,9 @@ fn computeSourceAnnotations(...@@ -374,9 +374,9 @@ fn computeSourceAnnotations(
374374
375var coverage = Coverage.init;375var coverage = Coverage.init;
376/// Index of type `SourceLocationIndex`.376/// Index of type `SourceLocationIndex`.
377var coverage_source_locations: std.ArrayListUnmanaged(Coverage.SourceLocation) = .{};377var coverage_source_locations: std.ArrayListUnmanaged(Coverage.SourceLocation) = .empty;
378/// Contains the most recent coverage update message, unmodified.378/// Contains the most recent coverage update message, unmodified.
379var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .{};379var recent_coverage_update: std.ArrayListAlignedUnmanaged(u8, @alignOf(u64)) = .empty;
380380
381fn updateCoverage(381fn updateCoverage(
382 directories: []const Coverage.String,382 directories: []const Coverage.String,
...@@ -425,7 +425,7 @@ export fn sourceLocationFileHtml(sli: SourceLocationIndex) String {...@@ -425,7 +425,7 @@ export fn sourceLocationFileHtml(sli: SourceLocationIndex) String {
425425
426export fn sourceLocationFileCoveredList(sli_file: SourceLocationIndex) Slice(SourceLocationIndex) {426export fn sourceLocationFileCoveredList(sli_file: SourceLocationIndex) Slice(SourceLocationIndex) {
427 const global = struct {427 const global = struct {
428 var result: std.ArrayListUnmanaged(SourceLocationIndex) = .{};428 var result: std.ArrayListUnmanaged(SourceLocationIndex) = .empty;
429 fn add(i: u32, want_file: Coverage.File.Index) void {429 fn add(i: u32, want_file: Coverage.File.Index) void {
430 const src_loc_index: SourceLocationIndex = @enumFromInt(i);430 const src_loc_index: SourceLocationIndex = @enumFromInt(i);
431 if (src_loc_index.ptr().file == want_file) result.appendAssumeCapacity(src_loc_index);431 if (src_loc_index.ptr().file == want_file) result.appendAssumeCapacity(src_loc_index);
lib/std/Build.zig+2-2
...@@ -111,7 +111,7 @@ pub const ReleaseMode = enum {...@@ -111,7 +111,7 @@ pub const ReleaseMode = enum {
111/// Settings that are here rather than in Build are not configurable per-package.111/// Settings that are here rather than in Build are not configurable per-package.
112pub const Graph = struct {112pub const Graph = struct {
113 arena: Allocator,113 arena: Allocator,
114 system_library_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .{},114 system_library_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .empty,
115 system_package_mode: bool = false,115 system_package_mode: bool = false,
116 debug_compiler_runtime_libs: bool = false,116 debug_compiler_runtime_libs: bool = false,
117 cache: Cache,117 cache: Cache,
...@@ -119,7 +119,7 @@ pub const Graph = struct {...@@ -119,7 +119,7 @@ pub const Graph = struct {
119 env_map: EnvMap,119 env_map: EnvMap,
120 global_cache_root: Cache.Directory,120 global_cache_root: Cache.Directory,
121 zig_lib_directory: Cache.Directory,121 zig_lib_directory: Cache.Directory,
122 needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .{},122 needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .empty,
123 /// Information about the native target. Computed before build() is invoked.123 /// Information about the native target. Computed before build() is invoked.
124 host: ResolvedTarget,124 host: ResolvedTarget,
125 incremental: ?bool = null,125 incremental: ?bool = null,
lib/std/Build/Fuzz.zig+1-1
...@@ -30,7 +30,7 @@ pub fn start(...@@ -30,7 +30,7 @@ pub fn start(
30 defer rebuild_node.end();30 defer rebuild_node.end();
31 var wait_group: std.Thread.WaitGroup = .{};31 var wait_group: std.Thread.WaitGroup = .{};
32 defer wait_group.wait();32 defer wait_group.wait();
33 var fuzz_run_steps: std.ArrayListUnmanaged(*Step.Run) = .{};33 var fuzz_run_steps: std.ArrayListUnmanaged(*Step.Run) = .empty;
34 defer fuzz_run_steps.deinit(gpa);34 defer fuzz_run_steps.deinit(gpa);
35 for (all_steps) |step| {35 for (all_steps) |step| {
36 const run = step.cast(Step.Run) orelse continue;36 const run = step.cast(Step.Run) orelse continue;
lib/std/Build/Fuzz/WebServer.zig+1-1
...@@ -236,7 +236,7 @@ fn buildWasmBinary(...@@ -236,7 +236,7 @@ fn buildWasmBinary(
236 .sub_path = "docs/wasm/html_render.zig",236 .sub_path = "docs/wasm/html_render.zig",
237 };237 };
238238
239 var argv: std.ArrayListUnmanaged([]const u8) = .{};239 var argv: std.ArrayListUnmanaged([]const u8) = .empty;
240240
241 try argv.appendSlice(arena, &.{241 try argv.appendSlice(arena, &.{
242 ws.zig_exe_path, "build-exe", //242 ws.zig_exe_path, "build-exe", //
lib/std/Build/Step.zig+1-1
...@@ -714,7 +714,7 @@ pub fn allocPrintCmd2(...@@ -714,7 +714,7 @@ pub fn allocPrintCmd2(
714 opt_env: ?*const std.process.EnvMap,714 opt_env: ?*const std.process.EnvMap,
715 argv: []const []const u8,715 argv: []const []const u8,
716) Allocator.Error![]u8 {716) Allocator.Error![]u8 {
717 var buf: std.ArrayListUnmanaged(u8) = .{};717 var buf: std.ArrayListUnmanaged(u8) = .empty;
718 if (opt_cwd) |cwd| try buf.writer(arena).print("cd {s} && ", .{cwd});718 if (opt_cwd) |cwd| try buf.writer(arena).print("cd {s} && ", .{cwd});
719 if (opt_env) |env| {719 if (opt_env) |env| {
720 const process_env_map = std.process.getEnvMap(arena) catch std.process.EnvMap.init(arena);720 const process_env_map = std.process.getEnvMap(arena) catch std.process.EnvMap.init(arena);
lib/std/Build/Step/CheckObject.zig+8-8
...@@ -713,12 +713,12 @@ const MachODumper = struct {...@@ -713,12 +713,12 @@ const MachODumper = struct {
713 gpa: Allocator,713 gpa: Allocator,
714 data: []const u8,714 data: []const u8,
715 header: macho.mach_header_64,715 header: macho.mach_header_64,
716 segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{},716 segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty,
717 sections: std.ArrayListUnmanaged(macho.section_64) = .{},717 sections: std.ArrayListUnmanaged(macho.section_64) = .empty,
718 symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{},718 symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty,
719 strtab: std.ArrayListUnmanaged(u8) = .{},719 strtab: std.ArrayListUnmanaged(u8) = .empty,
720 indsymtab: std.ArrayListUnmanaged(u32) = .{},720 indsymtab: std.ArrayListUnmanaged(u32) = .empty,
721 imports: std.ArrayListUnmanaged([]const u8) = .{},721 imports: std.ArrayListUnmanaged([]const u8) = .empty,
722722
723 fn parse(ctx: *ObjectContext) !void {723 fn parse(ctx: *ObjectContext) !void {
724 var it = ctx.getLoadCommandIterator();724 var it = ctx.getLoadCommandIterator();
...@@ -1797,9 +1797,9 @@ const ElfDumper = struct {...@@ -1797,9 +1797,9 @@ const ElfDumper = struct {
1797 const ArchiveContext = struct {1797 const ArchiveContext = struct {
1798 gpa: Allocator,1798 gpa: Allocator,
1799 data: []const u8,1799 data: []const u8,
1800 symtab: std.ArrayListUnmanaged(ArSymtabEntry) = .{},1800 symtab: std.ArrayListUnmanaged(ArSymtabEntry) = .empty,
1801 strtab: []const u8,1801 strtab: []const u8,
1802 objects: std.ArrayListUnmanaged(struct { name: []const u8, off: usize, len: usize }) = .{},1802 objects: std.ArrayListUnmanaged(struct { name: []const u8, off: usize, len: usize }) = .empty,
18031803
1804 fn parseSymtab(ctx: *ArchiveContext, raw: []const u8, ptr_width: enum { p32, p64 }) !void {1804 fn parseSymtab(ctx: *ArchiveContext, raw: []const u8, ptr_width: enum { p32, p64 }) !void {
1805 var stream = std.io.fixedBufferStream(raw);1805 var stream = std.io.fixedBufferStream(raw);
lib/std/Build/Step/Compile.zig+2-2
...@@ -1070,8 +1070,8 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {...@@ -1070,8 +1070,8 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
1070 // Stores system libraries that have already been seen for at least one1070 // Stores system libraries that have already been seen for at least one
1071 // module, along with any arguments that need to be passed to the1071 // module, along with any arguments that need to be passed to the
1072 // compiler for each module individually.1072 // compiler for each module individually.
1073 var seen_system_libs: std.StringHashMapUnmanaged([]const []const u8) = .{};1073 var seen_system_libs: std.StringHashMapUnmanaged([]const []const u8) = .empty;
1074 var frameworks: std.StringArrayHashMapUnmanaged(Module.LinkFrameworkOptions) = .{};1074 var frameworks: std.StringArrayHashMapUnmanaged(Module.LinkFrameworkOptions) = .empty;
10751075
1076 var prev_has_cflags = false;1076 var prev_has_cflags = false;
1077 var prev_has_rcflags = false;1077 var prev_has_rcflags = false;
lib/std/Build/Step/Fmt.zig+1-1
...@@ -48,7 +48,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {...@@ -48,7 +48,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
48 const arena = b.allocator;48 const arena = b.allocator;
49 const fmt: *Fmt = @fieldParentPtr("step", step);49 const fmt: *Fmt = @fieldParentPtr("step", step);
5050
51 var argv: std.ArrayListUnmanaged([]const u8) = .{};51 var argv: std.ArrayListUnmanaged([]const u8) = .empty;
52 try argv.ensureUnusedCapacity(arena, 2 + 1 + fmt.paths.len + 2 * fmt.exclude_paths.len);52 try argv.ensureUnusedCapacity(arena, 2 + 1 + fmt.paths.len + 2 * fmt.exclude_paths.len);
5353
54 argv.appendAssumeCapacity(b.graph.zig_exe);54 argv.appendAssumeCapacity(b.graph.zig_exe);
lib/std/Build/Step/Run.zig+1-1
...@@ -856,7 +856,7 @@ pub fn rerunInFuzzMode(...@@ -856,7 +856,7 @@ pub fn rerunInFuzzMode(
856 const step = &run.step;856 const step = &run.step;
857 const b = step.owner;857 const b = step.owner;
858 const arena = b.allocator;858 const arena = b.allocator;
859 var argv_list: std.ArrayListUnmanaged([]const u8) = .{};859 var argv_list: std.ArrayListUnmanaged([]const u8) = .empty;
860 for (run.argv.items) |arg| {860 for (run.argv.items) |arg| {
861 switch (arg) {861 switch (arg) {
862 .bytes => |bytes| {862 .bytes => |bytes| {
lib/std/array_hash_map.zig+3-3
...@@ -130,7 +130,7 @@ pub fn ArrayHashMap(...@@ -130,7 +130,7 @@ pub fn ArrayHashMap(
130 }130 }
131 pub fn initContext(allocator: Allocator, ctx: Context) Self {131 pub fn initContext(allocator: Allocator, ctx: Context) Self {
132 return .{132 return .{
133 .unmanaged = .{},133 .unmanaged = .empty,
134 .allocator = allocator,134 .allocator = allocator,
135 .ctx = ctx,135 .ctx = ctx,
136 };136 };
...@@ -429,7 +429,7 @@ pub fn ArrayHashMap(...@@ -429,7 +429,7 @@ pub fn ArrayHashMap(
429 pub fn move(self: *Self) Self {429 pub fn move(self: *Self) Self {
430 self.unmanaged.pointer_stability.assertUnlocked();430 self.unmanaged.pointer_stability.assertUnlocked();
431 const result = self.*;431 const result = self.*;
432 self.unmanaged = .{};432 self.unmanaged = .empty;
433 return result;433 return result;
434 }434 }
435435
...@@ -1290,7 +1290,7 @@ pub fn ArrayHashMapUnmanaged(...@@ -1290,7 +1290,7 @@ pub fn ArrayHashMapUnmanaged(
1290 pub fn move(self: *Self) Self {1290 pub fn move(self: *Self) Self {
1291 self.pointer_stability.assertUnlocked();1291 self.pointer_stability.assertUnlocked();
1292 const result = self.*;1292 const result = self.*;
1293 self.* = .{};1293 self.* = .empty;
1294 return result;1294 return result;
1295 }1295 }
12961296
lib/std/array_list.zig+32-32
...@@ -710,7 +710,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ...@@ -710,7 +710,7 @@ pub fn ArrayListAlignedUnmanaged(comptime T: type, comptime alignment: ?u29) typ
710 const old_memory = self.allocatedSlice();710 const old_memory = self.allocatedSlice();
711 if (allocator.resize(old_memory, self.items.len)) {711 if (allocator.resize(old_memory, self.items.len)) {
712 const result = self.items;712 const result = self.items;
713 self.* = .{};713 self.* = .empty;
714 return result;714 return result;
715 }715 }
716716
...@@ -1267,7 +1267,7 @@ test "init" {...@@ -1267,7 +1267,7 @@ test "init" {
1267 }1267 }
12681268
1269 {1269 {
1270 const list = ArrayListUnmanaged(i32){};1270 const list: ArrayListUnmanaged(i32) = .empty;
12711271
1272 try testing.expect(list.items.len == 0);1272 try testing.expect(list.items.len == 0);
1273 try testing.expect(list.capacity == 0);1273 try testing.expect(list.capacity == 0);
...@@ -1312,7 +1312,7 @@ test "clone" {...@@ -1312,7 +1312,7 @@ test "clone" {
1312 try testing.expectEqual(@as(i32, 5), cloned.items[2]);1312 try testing.expectEqual(@as(i32, 5), cloned.items[2]);
1313 }1313 }
1314 {1314 {
1315 var array = ArrayListUnmanaged(i32){};1315 var array: ArrayListUnmanaged(i32) = .empty;
1316 try array.append(a, -1);1316 try array.append(a, -1);
1317 try array.append(a, 3);1317 try array.append(a, 3);
1318 try array.append(a, 5);1318 try array.append(a, 5);
...@@ -1384,7 +1384,7 @@ test "basic" {...@@ -1384,7 +1384,7 @@ test "basic" {
1384 try testing.expect(list.pop() == 33);1384 try testing.expect(list.pop() == 33);
1385 }1385 }
1386 {1386 {
1387 var list = ArrayListUnmanaged(i32){};1387 var list: ArrayListUnmanaged(i32) = .empty;
1388 defer list.deinit(a);1388 defer list.deinit(a);
13891389
1390 {1390 {
...@@ -1448,7 +1448,7 @@ test "appendNTimes" {...@@ -1448,7 +1448,7 @@ test "appendNTimes" {
1448 }1448 }
1449 }1449 }
1450 {1450 {
1451 var list = ArrayListUnmanaged(i32){};1451 var list: ArrayListUnmanaged(i32) = .empty;
1452 defer list.deinit(a);1452 defer list.deinit(a);
14531453
1454 try list.appendNTimes(a, 2, 10);1454 try list.appendNTimes(a, 2, 10);
...@@ -1467,7 +1467,7 @@ test "appendNTimes with failing allocator" {...@@ -1467,7 +1467,7 @@ test "appendNTimes with failing allocator" {
1467 try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10));1467 try testing.expectError(error.OutOfMemory, list.appendNTimes(2, 10));
1468 }1468 }
1469 {1469 {
1470 var list = ArrayListUnmanaged(i32){};1470 var list: ArrayListUnmanaged(i32) = .empty;
1471 defer list.deinit(a);1471 defer list.deinit(a);
1472 try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10));1472 try testing.expectError(error.OutOfMemory, list.appendNTimes(a, 2, 10));
1473 }1473 }
...@@ -1502,7 +1502,7 @@ test "orderedRemove" {...@@ -1502,7 +1502,7 @@ test "orderedRemove" {
1502 try testing.expectEqual(@as(usize, 4), list.items.len);1502 try testing.expectEqual(@as(usize, 4), list.items.len);
1503 }1503 }
1504 {1504 {
1505 var list = ArrayListUnmanaged(i32){};1505 var list: ArrayListUnmanaged(i32) = .empty;
1506 defer list.deinit(a);1506 defer list.deinit(a);
15071507
1508 try list.append(a, 1);1508 try list.append(a, 1);
...@@ -1537,7 +1537,7 @@ test "orderedRemove" {...@@ -1537,7 +1537,7 @@ test "orderedRemove" {
1537 }1537 }
1538 {1538 {
1539 // remove last item1539 // remove last item
1540 var list = ArrayListUnmanaged(i32){};1540 var list: ArrayListUnmanaged(i32) = .empty;
1541 defer list.deinit(a);1541 defer list.deinit(a);
1542 try list.append(a, 1);1542 try list.append(a, 1);
1543 try testing.expectEqual(@as(i32, 1), list.orderedRemove(0));1543 try testing.expectEqual(@as(i32, 1), list.orderedRemove(0));
...@@ -1574,7 +1574,7 @@ test "swapRemove" {...@@ -1574,7 +1574,7 @@ test "swapRemove" {
1574 try testing.expect(list.items.len == 4);1574 try testing.expect(list.items.len == 4);
1575 }1575 }
1576 {1576 {
1577 var list = ArrayListUnmanaged(i32){};1577 var list: ArrayListUnmanaged(i32) = .empty;
1578 defer list.deinit(a);1578 defer list.deinit(a);
15791579
1580 try list.append(a, 1);1580 try list.append(a, 1);
...@@ -1617,7 +1617,7 @@ test "insert" {...@@ -1617,7 +1617,7 @@ test "insert" {
1617 try testing.expect(list.items[3] == 3);1617 try testing.expect(list.items[3] == 3);
1618 }1618 }
1619 {1619 {
1620 var list = ArrayListUnmanaged(i32){};1620 var list: ArrayListUnmanaged(i32) = .empty;
1621 defer list.deinit(a);1621 defer list.deinit(a);
16221622
1623 try list.insert(a, 0, 1);1623 try list.insert(a, 0, 1);
...@@ -1655,7 +1655,7 @@ test "insertSlice" {...@@ -1655,7 +1655,7 @@ test "insertSlice" {
1655 try testing.expect(list.items[0] == 1);1655 try testing.expect(list.items[0] == 1);
1656 }1656 }
1657 {1657 {
1658 var list = ArrayListUnmanaged(i32){};1658 var list: ArrayListUnmanaged(i32) = .empty;
1659 defer list.deinit(a);1659 defer list.deinit(a);
16601660
1661 try list.append(a, 1);1661 try list.append(a, 1);
...@@ -1789,7 +1789,7 @@ test "ArrayListUnmanaged.replaceRange" {...@@ -1789,7 +1789,7 @@ test "ArrayListUnmanaged.replaceRange" {
1789 const a = testing.allocator;1789 const a = testing.allocator;
17901790
1791 {1791 {
1792 var list = ArrayListUnmanaged(i32){};1792 var list: ArrayListUnmanaged(i32) = .empty;
1793 defer list.deinit(a);1793 defer list.deinit(a);
1794 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1794 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
17951795
...@@ -1798,7 +1798,7 @@ test "ArrayListUnmanaged.replaceRange" {...@@ -1798,7 +1798,7 @@ test "ArrayListUnmanaged.replaceRange" {
1798 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);1798 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);
1799 }1799 }
1800 {1800 {
1801 var list = ArrayListUnmanaged(i32){};1801 var list: ArrayListUnmanaged(i32) = .empty;
1802 defer list.deinit(a);1802 defer list.deinit(a);
1803 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1803 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18041804
...@@ -1811,7 +1811,7 @@ test "ArrayListUnmanaged.replaceRange" {...@@ -1811,7 +1811,7 @@ test "ArrayListUnmanaged.replaceRange" {
1811 );1811 );
1812 }1812 }
1813 {1813 {
1814 var list = ArrayListUnmanaged(i32){};1814 var list: ArrayListUnmanaged(i32) = .empty;
1815 defer list.deinit(a);1815 defer list.deinit(a);
1816 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1816 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18171817
...@@ -1820,7 +1820,7 @@ test "ArrayListUnmanaged.replaceRange" {...@@ -1820,7 +1820,7 @@ test "ArrayListUnmanaged.replaceRange" {
1820 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);1820 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);
1821 }1821 }
1822 {1822 {
1823 var list = ArrayListUnmanaged(i32){};1823 var list: ArrayListUnmanaged(i32) = .empty;
1824 defer list.deinit(a);1824 defer list.deinit(a);
1825 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1825 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18261826
...@@ -1829,7 +1829,7 @@ test "ArrayListUnmanaged.replaceRange" {...@@ -1829,7 +1829,7 @@ test "ArrayListUnmanaged.replaceRange" {
1829 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);1829 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);
1830 }1830 }
1831 {1831 {
1832 var list = ArrayListUnmanaged(i32){};1832 var list: ArrayListUnmanaged(i32) = .empty;
1833 defer list.deinit(a);1833 defer list.deinit(a);
1834 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1834 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18351835
...@@ -1843,7 +1843,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {...@@ -1843,7 +1843,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
1843 const a = testing.allocator;1843 const a = testing.allocator;
18441844
1845 {1845 {
1846 var list = ArrayListUnmanaged(i32){};1846 var list: ArrayListUnmanaged(i32) = .empty;
1847 defer list.deinit(a);1847 defer list.deinit(a);
1848 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1848 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18491849
...@@ -1852,7 +1852,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {...@@ -1852,7 +1852,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
1852 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);1852 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 2, 3, 4, 5 }, list.items);
1853 }1853 }
1854 {1854 {
1855 var list = ArrayListUnmanaged(i32){};1855 var list: ArrayListUnmanaged(i32) = .empty;
1856 defer list.deinit(a);1856 defer list.deinit(a);
1857 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1857 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18581858
...@@ -1865,7 +1865,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {...@@ -1865,7 +1865,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
1865 );1865 );
1866 }1866 }
1867 {1867 {
1868 var list = ArrayListUnmanaged(i32){};1868 var list: ArrayListUnmanaged(i32) = .empty;
1869 defer list.deinit(a);1869 defer list.deinit(a);
1870 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1870 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18711871
...@@ -1874,7 +1874,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {...@@ -1874,7 +1874,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
1874 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);1874 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 4, 5 }, list.items);
1875 }1875 }
1876 {1876 {
1877 var list = ArrayListUnmanaged(i32){};1877 var list: ArrayListUnmanaged(i32) = .empty;
1878 defer list.deinit(a);1878 defer list.deinit(a);
1879 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1879 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18801880
...@@ -1883,7 +1883,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {...@@ -1883,7 +1883,7 @@ test "ArrayListUnmanaged.replaceRangeAssumeCapacity" {
1883 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);1883 try testing.expectEqualSlices(i32, &[_]i32{ 1, 0, 0, 0, 5 }, list.items);
1884 }1884 }
1885 {1885 {
1886 var list = ArrayListUnmanaged(i32){};1886 var list: ArrayListUnmanaged(i32) = .empty;
1887 defer list.deinit(a);1887 defer list.deinit(a);
1888 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });1888 try list.appendSlice(a, &[_]i32{ 1, 2, 3, 4, 5 });
18891889
...@@ -1906,15 +1906,15 @@ const ItemUnmanaged = struct {...@@ -1906,15 +1906,15 @@ const ItemUnmanaged = struct {
1906test "ArrayList(T) of struct T" {1906test "ArrayList(T) of struct T" {
1907 const a = std.testing.allocator;1907 const a = std.testing.allocator;
1908 {1908 {
1909 var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(a) };1909 var root = Item{ .integer = 1, .sub_items = .init(a) };
1910 defer root.sub_items.deinit();1910 defer root.sub_items.deinit();
1911 try root.sub_items.append(Item{ .integer = 42, .sub_items = ArrayList(Item).init(a) });1911 try root.sub_items.append(Item{ .integer = 42, .sub_items = .init(a) });
1912 try testing.expect(root.sub_items.items[0].integer == 42);1912 try testing.expect(root.sub_items.items[0].integer == 42);
1913 }1913 }
1914 {1914 {
1915 var root = ItemUnmanaged{ .integer = 1, .sub_items = ArrayListUnmanaged(ItemUnmanaged){} };1915 var root = ItemUnmanaged{ .integer = 1, .sub_items = .empty };
1916 defer root.sub_items.deinit(a);1916 defer root.sub_items.deinit(a);
1917 try root.sub_items.append(a, ItemUnmanaged{ .integer = 42, .sub_items = ArrayListUnmanaged(ItemUnmanaged){} });1917 try root.sub_items.append(a, ItemUnmanaged{ .integer = 42, .sub_items = .empty });
1918 try testing.expect(root.sub_items.items[0].integer == 42);1918 try testing.expect(root.sub_items.items[0].integer == 42);
1919 }1919 }
1920}1920}
...@@ -1950,7 +1950,7 @@ test "ArrayListUnmanaged(u8) implements writer" {...@@ -1950,7 +1950,7 @@ test "ArrayListUnmanaged(u8) implements writer" {
1950 const a = testing.allocator;1950 const a = testing.allocator;
19511951
1952 {1952 {
1953 var buffer: ArrayListUnmanaged(u8) = .{};1953 var buffer: ArrayListUnmanaged(u8) = .empty;
1954 defer buffer.deinit(a);1954 defer buffer.deinit(a);
19551955
1956 const x: i32 = 42;1956 const x: i32 = 42;
...@@ -1960,7 +1960,7 @@ test "ArrayListUnmanaged(u8) implements writer" {...@@ -1960,7 +1960,7 @@ test "ArrayListUnmanaged(u8) implements writer" {
1960 try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items);1960 try testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items);
1961 }1961 }
1962 {1962 {
1963 var list: ArrayListAlignedUnmanaged(u8, 2) = .{};1963 var list: ArrayListAlignedUnmanaged(u8, 2) = .empty;
1964 defer list.deinit(a);1964 defer list.deinit(a);
19651965
1966 const writer = list.writer(a);1966 const writer = list.writer(a);
...@@ -1989,7 +1989,7 @@ test "shrink still sets length when resizing is disabled" {...@@ -1989,7 +1989,7 @@ test "shrink still sets length when resizing is disabled" {
1989 try testing.expect(list.items.len == 1);1989 try testing.expect(list.items.len == 1);
1990 }1990 }
1991 {1991 {
1992 var list = ArrayListUnmanaged(i32){};1992 var list: ArrayListUnmanaged(i32) = .empty;
1993 defer list.deinit(a);1993 defer list.deinit(a);
19941994
1995 try list.append(a, 1);1995 try list.append(a, 1);
...@@ -2026,7 +2026,7 @@ test "addManyAsArray" {...@@ -2026,7 +2026,7 @@ test "addManyAsArray" {
2026 try testing.expectEqualSlices(u8, list.items, "aoeuasdf");2026 try testing.expectEqualSlices(u8, list.items, "aoeuasdf");
2027 }2027 }
2028 {2028 {
2029 var list = ArrayListUnmanaged(u8){};2029 var list: ArrayListUnmanaged(u8) = .empty;
2030 defer list.deinit(a);2030 defer list.deinit(a);
20312031
2032 (try list.addManyAsArray(a, 4)).* = "aoeu".*;2032 (try list.addManyAsArray(a, 4)).* = "aoeu".*;
...@@ -2056,7 +2056,7 @@ test "growing memory preserves contents" {...@@ -2056,7 +2056,7 @@ test "growing memory preserves contents" {
2056 try testing.expectEqualSlices(u8, list.items, "abcdijklefgh");2056 try testing.expectEqualSlices(u8, list.items, "abcdijklefgh");
2057 }2057 }
2058 {2058 {
2059 var list = ArrayListUnmanaged(u8){};2059 var list: ArrayListUnmanaged(u8) = .empty;
2060 defer list.deinit(a);2060 defer list.deinit(a);
20612061
2062 (try list.addManyAsArray(a, 4)).* = "abcd".*;2062 (try list.addManyAsArray(a, 4)).* = "abcd".*;
...@@ -2132,7 +2132,7 @@ test "toOwnedSliceSentinel" {...@@ -2132,7 +2132,7 @@ test "toOwnedSliceSentinel" {
2132 try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0));2132 try testing.expectEqualStrings(result, mem.sliceTo(result.ptr, 0));
2133 }2133 }
2134 {2134 {
2135 var list = ArrayListUnmanaged(u8){};2135 var list: ArrayListUnmanaged(u8) = .empty;
2136 defer list.deinit(a);2136 defer list.deinit(a);
21372137
2138 try list.appendSlice(a, "foobar");2138 try list.appendSlice(a, "foobar");
...@@ -2156,7 +2156,7 @@ test "accepts unaligned slices" {...@@ -2156,7 +2156,7 @@ test "accepts unaligned slices" {
2156 try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 });2156 try testing.expectEqualSlices(u8, list.items, &.{ 0, 8, 9, 6, 7, 2, 3 });
2157 }2157 }
2158 {2158 {
2159 var list = std.ArrayListAlignedUnmanaged(u8, 8){};2159 var list: std.ArrayListAlignedUnmanaged(u8, 8) = .empty;
2160 defer list.deinit(a);2160 defer list.deinit(a);
21612161
2162 try list.appendSlice(a, &.{ 0, 1, 2, 3 });2162 try list.appendSlice(a, &.{ 0, 1, 2, 3 });
lib/std/crypto/Certificate/Bundle.zig+2-2
...@@ -6,8 +6,8 @@...@@ -6,8 +6,8 @@
6//! certificate within `bytes`.6//! certificate within `bytes`.
77
8/// The key is the contents slice of the subject.8/// The key is the contents slice of the subject.
9map: std.HashMapUnmanaged(der.Element.Slice, u32, MapContext, std.hash_map.default_max_load_percentage) = .{},9map: std.HashMapUnmanaged(der.Element.Slice, u32, MapContext, std.hash_map.default_max_load_percentage) = .empty,
10bytes: std.ArrayListUnmanaged(u8) = .{},10bytes: std.ArrayListUnmanaged(u8) = .empty,
1111
12pub const VerifyError = Certificate.Parsed.VerifyError || error{12pub const VerifyError = Certificate.Parsed.VerifyError || error{
13 CertificateIssuerNotFound,13 CertificateIssuerNotFound,
lib/std/debug/Dwarf.zig+8-8
...@@ -42,20 +42,20 @@ sections: SectionArray = null_section_array,...@@ -42,20 +42,20 @@ sections: SectionArray = null_section_array,
42is_macho: bool,42is_macho: bool,
4343
44/// Filled later by the initializer44/// Filled later by the initializer
45abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .{},45abbrev_table_list: std.ArrayListUnmanaged(Abbrev.Table) = .empty,
46/// Filled later by the initializer46/// Filled later by the initializer
47compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .{},47compile_unit_list: std.ArrayListUnmanaged(CompileUnit) = .empty,
48/// Filled later by the initializer48/// Filled later by the initializer
49func_list: std.ArrayListUnmanaged(Func) = .{},49func_list: std.ArrayListUnmanaged(Func) = .empty,
5050
51eh_frame_hdr: ?ExceptionFrameHeader = null,51eh_frame_hdr: ?ExceptionFrameHeader = null,
52/// These lookup tables are only used if `eh_frame_hdr` is null52/// These lookup tables are only used if `eh_frame_hdr` is null
53cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .{},53cie_map: std.AutoArrayHashMapUnmanaged(u64, CommonInformationEntry) = .empty,
54/// Sorted by start_pc54/// Sorted by start_pc
55fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .{},55fde_list: std.ArrayListUnmanaged(FrameDescriptionEntry) = .empty,
5656
57/// Populated by `populateRanges`.57/// Populated by `populateRanges`.
58ranges: std.ArrayListUnmanaged(Range) = .{},58ranges: std.ArrayListUnmanaged(Range) = .empty,
5959
60pub const Range = struct {60pub const Range = struct {
61 start: u64,61 start: u64,
...@@ -1464,9 +1464,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) !...@@ -1464,9 +1464,9 @@ fn runLineNumberProgram(d: *Dwarf, gpa: Allocator, compile_unit: *CompileUnit) !
14641464
1465 const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1);1465 const standard_opcode_lengths = try fbr.readBytes(opcode_base - 1);
14661466
1467 var directories: std.ArrayListUnmanaged(FileEntry) = .{};1467 var directories: std.ArrayListUnmanaged(FileEntry) = .empty;
1468 defer directories.deinit(gpa);1468 defer directories.deinit(gpa);
1469 var file_entries: std.ArrayListUnmanaged(FileEntry) = .{};1469 var file_entries: std.ArrayListUnmanaged(FileEntry) = .empty;
1470 defer file_entries.deinit(gpa);1470 defer file_entries.deinit(gpa);
14711471
1472 if (version < 5) {1472 if (version < 5) {
lib/std/debug/Dwarf/expression.zig+1-1
...@@ -153,7 +153,7 @@ pub fn StackMachine(comptime options: Options) type {...@@ -153,7 +153,7 @@ pub fn StackMachine(comptime options: Options) type {
153 }153 }
154 };154 };
155155
156 stack: std.ArrayListUnmanaged(Value) = .{},156 stack: std.ArrayListUnmanaged(Value) = .empty,
157157
158 pub fn reset(self: *Self) void {158 pub fn reset(self: *Self) void {
159 self.stack.clearRetainingCapacity();159 self.stack.clearRetainingCapacity();
lib/std/debug/SelfInfo.zig+2-2
...@@ -1933,8 +1933,8 @@ pub const VirtualMachine = struct {...@@ -1933,8 +1933,8 @@ pub const VirtualMachine = struct {
1933 len: u8 = 0,1933 len: u8 = 0,
1934 };1934 };
19351935
1936 columns: std.ArrayListUnmanaged(Column) = .{},1936 columns: std.ArrayListUnmanaged(Column) = .empty,
1937 stack: std.ArrayListUnmanaged(ColumnRange) = .{},1937 stack: std.ArrayListUnmanaged(ColumnRange) = .empty,
1938 current_row: Row = .{},1938 current_row: Row = .{},
19391939
1940 /// The result of executing the CIE's initial_instructions1940 /// The result of executing the CIE's initial_instructions
lib/std/fs/Dir.zig+1-1
...@@ -750,7 +750,7 @@ pub const Walker = struct {...@@ -750,7 +750,7 @@ pub const Walker = struct {
750///750///
751/// `self` will not be closed after walking it.751/// `self` will not be closed after walking it.
752pub fn walk(self: Dir, allocator: Allocator) Allocator.Error!Walker {752pub fn walk(self: Dir, allocator: Allocator) Allocator.Error!Walker {
753 var stack: std.ArrayListUnmanaged(Walker.StackItem) = .{};753 var stack: std.ArrayListUnmanaged(Walker.StackItem) = .empty;
754754
755 try stack.append(allocator, .{755 try stack.append(allocator, .{
756 .iter = self.iterate(),756 .iter = self.iterate(),
lib/std/fs/wasi.zig+1-1
...@@ -24,7 +24,7 @@ pub const Preopens = struct {...@@ -24,7 +24,7 @@ pub const Preopens = struct {
24};24};
2525
26pub fn preopensAlloc(gpa: Allocator) Allocator.Error!Preopens {26pub fn preopensAlloc(gpa: Allocator) Allocator.Error!Preopens {
27 var names: std.ArrayListUnmanaged([]const u8) = .{};27 var names: std.ArrayListUnmanaged([]const u8) = .empty;
28 defer names.deinit(gpa);28 defer names.deinit(gpa);
2929
30 try names.ensureUnusedCapacity(gpa, 3);30 try names.ensureUnusedCapacity(gpa, 3);
lib/std/hash/benchmark.zig+1-1
...@@ -410,7 +410,7 @@ pub fn main() !void {...@@ -410,7 +410,7 @@ pub fn main() !void {
410 }410 }
411 }411 }
412412
413 var gpa = std.heap.GeneralPurposeAllocator(.{}){};413 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
414 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");414 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
415 const allocator = gpa.allocator();415 const allocator = gpa.allocator();
416416
lib/std/hash_map.zig+7-7
...@@ -401,7 +401,7 @@ pub fn HashMap(...@@ -401,7 +401,7 @@ pub fn HashMap(
401 @compileError("Context must be specified! Call initContext(allocator, ctx) instead.");401 @compileError("Context must be specified! Call initContext(allocator, ctx) instead.");
402 }402 }
403 return .{403 return .{
404 .unmanaged = .{},404 .unmanaged = .empty,
405 .allocator = allocator,405 .allocator = allocator,
406 .ctx = undefined, // ctx is zero-sized so this is safe.406 .ctx = undefined, // ctx is zero-sized so this is safe.
407 };407 };
...@@ -410,7 +410,7 @@ pub fn HashMap(...@@ -410,7 +410,7 @@ pub fn HashMap(
410 /// Create a managed hash map with a context410 /// Create a managed hash map with a context
411 pub fn initContext(allocator: Allocator, ctx: Context) Self {411 pub fn initContext(allocator: Allocator, ctx: Context) Self {
412 return .{412 return .{
413 .unmanaged = .{},413 .unmanaged = .empty,
414 .allocator = allocator,414 .allocator = allocator,
415 .ctx = ctx,415 .ctx = ctx,
416 };416 };
...@@ -691,7 +691,7 @@ pub fn HashMap(...@@ -691,7 +691,7 @@ pub fn HashMap(
691 pub fn move(self: *Self) Self {691 pub fn move(self: *Self) Self {
692 self.unmanaged.pointer_stability.assertUnlocked();692 self.unmanaged.pointer_stability.assertUnlocked();
693 const result = self.*;693 const result = self.*;
694 self.unmanaged = .{};694 self.unmanaged = .empty;
695 return result;695 return result;
696 }696 }
697697
...@@ -1543,7 +1543,7 @@ pub fn HashMapUnmanaged(...@@ -1543,7 +1543,7 @@ pub fn HashMapUnmanaged(
1543 return self.cloneContext(allocator, @as(Context, undefined));1543 return self.cloneContext(allocator, @as(Context, undefined));
1544 }1544 }
1545 pub fn cloneContext(self: Self, allocator: Allocator, new_ctx: anytype) Allocator.Error!HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) {1545 pub fn cloneContext(self: Self, allocator: Allocator, new_ctx: anytype) Allocator.Error!HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) {
1546 var other = HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage){};1546 var other: HashMapUnmanaged(K, V, @TypeOf(new_ctx), max_load_percentage) = .empty;
1547 if (self.size == 0)1547 if (self.size == 0)
1548 return other;1548 return other;
15491549
...@@ -1572,7 +1572,7 @@ pub fn HashMapUnmanaged(...@@ -1572,7 +1572,7 @@ pub fn HashMapUnmanaged(
1572 pub fn move(self: *Self) Self {1572 pub fn move(self: *Self) Self {
1573 self.pointer_stability.assertUnlocked();1573 self.pointer_stability.assertUnlocked();
1574 const result = self.*;1574 const result = self.*;
1575 self.* = .{};1575 self.* = .empty;
1576 return result;1576 return result;
1577 }1577 }
15781578
...@@ -2360,7 +2360,7 @@ test "removeByPtr 0 sized key" {...@@ -2360,7 +2360,7 @@ test "removeByPtr 0 sized key" {
2360}2360}
23612361
2362test "repeat fetchRemove" {2362test "repeat fetchRemove" {
2363 var map = AutoHashMapUnmanaged(u64, void){};2363 var map: AutoHashMapUnmanaged(u64, void) = .empty;
2364 defer map.deinit(testing.allocator);2364 defer map.deinit(testing.allocator);
23652365
2366 try map.ensureTotalCapacity(testing.allocator, 4);2366 try map.ensureTotalCapacity(testing.allocator, 4);
...@@ -2384,7 +2384,7 @@ test "repeat fetchRemove" {...@@ -2384,7 +2384,7 @@ test "repeat fetchRemove" {
2384}2384}
23852385
2386test "getOrPut allocation failure" {2386test "getOrPut allocation failure" {
2387 var map: std.StringHashMapUnmanaged(void) = .{};2387 var map: std.StringHashMapUnmanaged(void) = .empty;
2388 try testing.expectError(error.OutOfMemory, map.getOrPut(std.testing.failing_allocator, "hello"));2388 try testing.expectError(error.OutOfMemory, map.getOrPut(std.testing.failing_allocator, "hello"));
2389}2389}
23902390
lib/std/json/hashmap.zig+3-3
...@@ -12,14 +12,14 @@ const Value = @import("dynamic.zig").Value;...@@ -12,14 +12,14 @@ const Value = @import("dynamic.zig").Value;
12/// instead of comptime-known struct field names.12/// instead of comptime-known struct field names.
13pub fn ArrayHashMap(comptime T: type) type {13pub fn ArrayHashMap(comptime T: type) type {
14 return struct {14 return struct {
15 map: std.StringArrayHashMapUnmanaged(T) = .{},15 map: std.StringArrayHashMapUnmanaged(T) = .empty,
1616
17 pub fn deinit(self: *@This(), allocator: Allocator) void {17 pub fn deinit(self: *@This(), allocator: Allocator) void {
18 self.map.deinit(allocator);18 self.map.deinit(allocator);
19 }19 }
2020
21 pub fn jsonParse(allocator: Allocator, source: anytype, options: ParseOptions) !@This() {21 pub fn jsonParse(allocator: Allocator, source: anytype, options: ParseOptions) !@This() {
22 var map = std.StringArrayHashMapUnmanaged(T){};22 var map: std.StringArrayHashMapUnmanaged(T) = .empty;
23 errdefer map.deinit(allocator);23 errdefer map.deinit(allocator);
2424
25 if (.object_begin != try source.next()) return error.UnexpectedToken;25 if (.object_begin != try source.next()) return error.UnexpectedToken;
...@@ -52,7 +52,7 @@ pub fn ArrayHashMap(comptime T: type) type {...@@ -52,7 +52,7 @@ pub fn ArrayHashMap(comptime T: type) type {
52 pub fn jsonParseFromValue(allocator: Allocator, source: Value, options: ParseOptions) !@This() {52 pub fn jsonParseFromValue(allocator: Allocator, source: Value, options: ParseOptions) !@This() {
53 if (source != .object) return error.UnexpectedToken;53 if (source != .object) return error.UnexpectedToken;
5454
55 var map = std.StringArrayHashMapUnmanaged(T){};55 var map: std.StringArrayHashMapUnmanaged(T) = .empty;
56 errdefer map.deinit(allocator);56 errdefer map.deinit(allocator);
5757
58 var it = source.object.iterator();58 var it = source.object.iterator();
lib/std/process/Child.zig+2-2
...@@ -907,12 +907,12 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void {...@@ -907,12 +907,12 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void {
907 var cmd_line_cache = WindowsCommandLineCache.init(self.allocator, self.argv);907 var cmd_line_cache = WindowsCommandLineCache.init(self.allocator, self.argv);
908 defer cmd_line_cache.deinit();908 defer cmd_line_cache.deinit();
909909
910 var app_buf = std.ArrayListUnmanaged(u16){};910 var app_buf: std.ArrayListUnmanaged(u16) = .empty;
911 defer app_buf.deinit(self.allocator);911 defer app_buf.deinit(self.allocator);
912912
913 try app_buf.appendSlice(self.allocator, app_name_w);913 try app_buf.appendSlice(self.allocator, app_name_w);
914914
915 var dir_buf = std.ArrayListUnmanaged(u16){};915 var dir_buf: std.ArrayListUnmanaged(u16) = .empty;
916 defer dir_buf.deinit(self.allocator);916 defer dir_buf.deinit(self.allocator);
917917
918 if (cwd_path_w.len > 0) {918 if (cwd_path_w.len > 0) {
lib/std/tar.zig+1-1
...@@ -27,7 +27,7 @@ pub const writer = @import("tar/writer.zig").writer;...@@ -27,7 +27,7 @@ pub const writer = @import("tar/writer.zig").writer;
27/// the errors in diagnostics to know whether the operation succeeded or failed.27/// the errors in diagnostics to know whether the operation succeeded or failed.
28pub const Diagnostics = struct {28pub const Diagnostics = struct {
29 allocator: std.mem.Allocator,29 allocator: std.mem.Allocator,
30 errors: std.ArrayListUnmanaged(Error) = .{},30 errors: std.ArrayListUnmanaged(Error) = .empty,
3131
32 entries: usize = 0,32 entries: usize = 0,
33 root_dir: []const u8 = "",33 root_dir: []const u8 = "",
lib/std/testing.zig+2-2
...@@ -11,10 +11,10 @@ pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAll...@@ -11,10 +11,10 @@ pub const FailingAllocator = @import("testing/failing_allocator.zig").FailingAll
1111
12/// This should only be used in temporary test programs.12/// This should only be used in temporary test programs.
13pub const allocator = allocator_instance.allocator();13pub const allocator = allocator_instance.allocator();
14pub var allocator_instance = b: {14pub var allocator_instance: std.heap.GeneralPurposeAllocator(.{}) = b: {
15 if (!builtin.is_test)15 if (!builtin.is_test)
16 @compileError("Cannot use testing allocator outside of test block");16 @compileError("Cannot use testing allocator outside of test block");
17 break :b std.heap.GeneralPurposeAllocator(.{}){};17 break :b .init;
18};18};
1919
20pub const failing_allocator = failing_allocator_instance.allocator();20pub const failing_allocator = failing_allocator_instance.allocator();
lib/std/zig/AstGen.zig+20-20
...@@ -22,8 +22,8 @@ tree: *const Ast,...@@ -22,8 +22,8 @@ tree: *const Ast,
22/// sub-expressions. See `AstRlAnnotate` for details.22/// sub-expressions. See `AstRlAnnotate` for details.
23nodes_need_rl: *const AstRlAnnotate.RlNeededSet,23nodes_need_rl: *const AstRlAnnotate.RlNeededSet,
24instructions: std.MultiArrayList(Zir.Inst) = .{},24instructions: std.MultiArrayList(Zir.Inst) = .{},
25extra: ArrayListUnmanaged(u32) = .{},25extra: ArrayListUnmanaged(u32) = .empty,
26string_bytes: ArrayListUnmanaged(u8) = .{},26string_bytes: ArrayListUnmanaged(u8) = .empty,
27/// Tracks the current byte offset within the source file.27/// Tracks the current byte offset within the source file.
28/// Used to populate line deltas in the ZIR. AstGen maintains28/// Used to populate line deltas in the ZIR. AstGen maintains
29/// this "cursor" throughout the entire AST lowering process in order29/// this "cursor" throughout the entire AST lowering process in order
...@@ -39,8 +39,8 @@ source_column: u32 = 0,...@@ -39,8 +39,8 @@ source_column: u32 = 0,
39/// Used for temporary allocations; freed after AstGen is complete.39/// Used for temporary allocations; freed after AstGen is complete.
40/// The resulting ZIR code has no references to anything in this arena.40/// The resulting ZIR code has no references to anything in this arena.
41arena: Allocator,41arena: Allocator,
42string_table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{},42string_table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty,
43compile_errors: ArrayListUnmanaged(Zir.Inst.CompileErrors.Item) = .{},43compile_errors: ArrayListUnmanaged(Zir.Inst.CompileErrors.Item) = .empty,
44/// The topmost block of the current function.44/// The topmost block of the current function.
45fn_block: ?*GenZir = null,45fn_block: ?*GenZir = null,
46fn_var_args: bool = false,46fn_var_args: bool = false,
...@@ -52,9 +52,9 @@ within_fn: bool = false,...@@ -52,9 +52,9 @@ within_fn: bool = false,
52fn_ret_ty: Zir.Inst.Ref = .none,52fn_ret_ty: Zir.Inst.Ref = .none,
53/// Maps string table indexes to the first `@import` ZIR instruction53/// Maps string table indexes to the first `@import` ZIR instruction
54/// that uses this string as the operand.54/// that uses this string as the operand.
55imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{},55imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty,
56/// Used for temporary storage when building payloads.56/// Used for temporary storage when building payloads.
57scratch: std.ArrayListUnmanaged(u32) = .{},57scratch: std.ArrayListUnmanaged(u32) = .empty,
58/// Whenever a `ref` instruction is needed, it is created and saved in this58/// Whenever a `ref` instruction is needed, it is created and saved in this
59/// table instead of being immediately appended to the current block body.59/// table instead of being immediately appended to the current block body.
60/// Then, when the instruction is being added to the parent block (typically from60/// Then, when the instruction is being added to the parent block (typically from
...@@ -65,7 +65,7 @@ scratch: std.ArrayListUnmanaged(u32) = .{},...@@ -65,7 +65,7 @@ scratch: std.ArrayListUnmanaged(u32) = .{},
65/// 2. `ref` instructions will dominate their uses. This is a required property65/// 2. `ref` instructions will dominate their uses. This is a required property
66/// of ZIR.66/// of ZIR.
67/// The key is the ref operand; the value is the ref instruction.67/// The key is the ref operand; the value is the ref instruction.
68ref_table: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{},68ref_table: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty,
69/// Any information which should trigger invalidation of incremental compilation69/// Any information which should trigger invalidation of incremental compilation
70/// data should be used to update this hasher. The result is the final source70/// data should be used to update this hasher. The result is the final source
71/// hash of the enclosing declaration/etc.71/// hash of the enclosing declaration/etc.
...@@ -159,7 +159,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {...@@ -159,7 +159,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
159159
160 var top_scope: Scope.Top = .{};160 var top_scope: Scope.Top = .{};
161161
162 var gz_instructions: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};162 var gz_instructions: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
163 var gen_scope: GenZir = .{163 var gen_scope: GenZir = .{
164 .is_comptime = true,164 .is_comptime = true,
165 .parent = &top_scope.base,165 .parent = &top_scope.base,
...@@ -5854,7 +5854,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi...@@ -5854,7 +5854,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi
5854 const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).@"struct".fields.len);5854 const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).@"struct".fields.len);
5855 var fields_len: usize = 0;5855 var fields_len: usize = 0;
5856 {5856 {
5857 var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{};5857 var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty;
5858 defer idents.deinit(gpa);5858 defer idents.deinit(gpa);
58595859
5860 const error_token = main_tokens[node];5860 const error_token = main_tokens[node];
...@@ -11259,7 +11259,7 @@ fn identifierTokenString(astgen: *AstGen, token: Ast.TokenIndex) InnerError![]co...@@ -11259,7 +11259,7 @@ fn identifierTokenString(astgen: *AstGen, token: Ast.TokenIndex) InnerError![]co
11259 if (!mem.startsWith(u8, ident_name, "@")) {11259 if (!mem.startsWith(u8, ident_name, "@")) {
11260 return ident_name;11260 return ident_name;
11261 }11261 }
11262 var buf: ArrayListUnmanaged(u8) = .{};11262 var buf: ArrayListUnmanaged(u8) = .empty;
11263 defer buf.deinit(astgen.gpa);11263 defer buf.deinit(astgen.gpa);
11264 try astgen.parseStrLit(token, &buf, ident_name, 1);11264 try astgen.parseStrLit(token, &buf, ident_name, 1);
11265 if (mem.indexOfScalar(u8, buf.items, 0) != null) {11265 if (mem.indexOfScalar(u8, buf.items, 0) != null) {
...@@ -11881,7 +11881,7 @@ const Scope = struct {...@@ -11881,7 +11881,7 @@ const Scope = struct {
11881 parent: *Scope,11881 parent: *Scope,
11882 /// Maps string table index to the source location of declaration,11882 /// Maps string table index to the source location of declaration,
11883 /// for the purposes of reporting name shadowing compile errors.11883 /// for the purposes of reporting name shadowing compile errors.
11884 decls: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.Node.Index) = .{},11884 decls: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.Node.Index) = .empty,
11885 node: Ast.Node.Index,11885 node: Ast.Node.Index,
11886 inst: Zir.Inst.Index,11886 inst: Zir.Inst.Index,
11887 maybe_generic: bool,11887 maybe_generic: bool,
...@@ -11891,7 +11891,7 @@ const Scope = struct {...@@ -11891,7 +11891,7 @@ const Scope = struct {
11891 declaring_gz: ?*GenZir,11891 declaring_gz: ?*GenZir,
1189211892
11893 /// Set of captures used by this namespace.11893 /// Set of captures used by this namespace.
11894 captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, void) = .{},11894 captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, void) = .empty,
1189511895
11896 fn deinit(self: *Namespace, gpa: Allocator) void {11896 fn deinit(self: *Namespace, gpa: Allocator) void {
11897 self.decls.deinit(gpa);11897 self.decls.deinit(gpa);
...@@ -13607,9 +13607,9 @@ fn scanContainer(...@@ -13607,9 +13607,9 @@ fn scanContainer(
13607 var sfba_state = std.heap.stackFallback(512, astgen.gpa);13607 var sfba_state = std.heap.stackFallback(512, astgen.gpa);
13608 const sfba = sfba_state.get();13608 const sfba = sfba_state.get();
1360913609
13610 var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{};13610 var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty;
13611 var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{};13611 var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty;
13612 var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .{};13612 var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty;
13613 defer {13613 defer {
13614 names.deinit(sfba);13614 names.deinit(sfba);
13615 test_names.deinit(sfba);13615 test_names.deinit(sfba);
...@@ -13796,7 +13796,7 @@ fn scanContainer(...@@ -13796,7 +13796,7 @@ fn scanContainer(
1379613796
13797 for (names.keys(), names.values()) |name, first| {13797 for (names.keys(), names.values()) |name, first| {
13798 if (first.next == null) continue;13798 if (first.next == null) continue;
13799 var notes: std.ArrayListUnmanaged(u32) = .{};13799 var notes: std.ArrayListUnmanaged(u32) = .empty;
13800 var prev: NameEntry = first;13800 var prev: NameEntry = first;
13801 while (prev.next) |cur| : (prev = cur.*) {13801 while (prev.next) |cur| : (prev = cur.*) {
13802 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate name here", .{}));13802 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate name here", .{}));
...@@ -13808,7 +13808,7 @@ fn scanContainer(...@@ -13808,7 +13808,7 @@ fn scanContainer(
1380813808
13809 for (test_names.keys(), test_names.values()) |name, first| {13809 for (test_names.keys(), test_names.values()) |name, first| {
13810 if (first.next == null) continue;13810 if (first.next == null) continue;
13811 var notes: std.ArrayListUnmanaged(u32) = .{};13811 var notes: std.ArrayListUnmanaged(u32) = .empty;
13812 var prev: NameEntry = first;13812 var prev: NameEntry = first;
13813 while (prev.next) |cur| : (prev = cur.*) {13813 while (prev.next) |cur| : (prev = cur.*) {
13814 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate test here", .{}));13814 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate test here", .{}));
...@@ -13820,7 +13820,7 @@ fn scanContainer(...@@ -13820,7 +13820,7 @@ fn scanContainer(
1382013820
13821 for (decltest_names.keys(), decltest_names.values()) |name, first| {13821 for (decltest_names.keys(), decltest_names.values()) |name, first| {
13822 if (first.next == null) continue;13822 if (first.next == null) continue;
13823 var notes: std.ArrayListUnmanaged(u32) = .{};13823 var notes: std.ArrayListUnmanaged(u32) = .empty;
13824 var prev: NameEntry = first;13824 var prev: NameEntry = first;
13825 while (prev.next) |cur| : (prev = cur.*) {13825 while (prev.next) |cur| : (prev = cur.*) {
13826 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate decltest here", .{}));13826 try notes.append(astgen.arena, try astgen.errNoteTok(cur.tok, "duplicate decltest here", .{}));
...@@ -13949,10 +13949,10 @@ fn lowerAstErrors(astgen: *AstGen) !void {...@@ -13949,10 +13949,10 @@ fn lowerAstErrors(astgen: *AstGen) !void {
13949 const gpa = astgen.gpa;13949 const gpa = astgen.gpa;
13950 const parse_err = tree.errors[0];13950 const parse_err = tree.errors[0];
1395113951
13952 var msg: std.ArrayListUnmanaged(u8) = .{};13952 var msg: std.ArrayListUnmanaged(u8) = .empty;
13953 defer msg.deinit(gpa);13953 defer msg.deinit(gpa);
1395413954
13955 var notes: std.ArrayListUnmanaged(u32) = .{};13955 var notes: std.ArrayListUnmanaged(u32) = .empty;
13956 defer notes.deinit(gpa);13956 defer notes.deinit(gpa);
1395713957
13958 for (tree.errors[1..]) |note| {13958 for (tree.errors[1..]) |note| {
lib/std/zig/ErrorBundle.zig+1-1
...@@ -571,7 +571,7 @@ pub const Wip = struct {...@@ -571,7 +571,7 @@ pub const Wip = struct {
571 if (index == .none) return .none;571 if (index == .none) return .none;
572 const other_sl = other.getSourceLocation(index);572 const other_sl = other.getSourceLocation(index);
573573
574 var ref_traces: std.ArrayListUnmanaged(ReferenceTrace) = .{};574 var ref_traces: std.ArrayListUnmanaged(ReferenceTrace) = .empty;
575 defer ref_traces.deinit(wip.gpa);575 defer ref_traces.deinit(wip.gpa);
576576
577 if (other_sl.reference_trace_len > 0) {577 if (other_sl.reference_trace_len > 0) {
lib/std/zig/WindowsSdk.zig+1-1
...@@ -751,7 +751,7 @@ const MsvcLibDir = struct {...@@ -751,7 +751,7 @@ const MsvcLibDir = struct {
751 defer instances_dir.close();751 defer instances_dir.close();
752752
753 var state_subpath_buf: [std.fs.max_name_bytes + 32]u8 = undefined;753 var state_subpath_buf: [std.fs.max_name_bytes + 32]u8 = undefined;
754 var latest_version_lib_dir = std.ArrayListUnmanaged(u8){};754 var latest_version_lib_dir: std.ArrayListUnmanaged(u8) = .empty;
755 errdefer latest_version_lib_dir.deinit(allocator);755 errdefer latest_version_lib_dir.deinit(allocator);
756756
757 var latest_version: u64 = 0;757 var latest_version: u64 = 0;
lib/std/zig/Zir.zig+2-2
...@@ -3711,7 +3711,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In...@@ -3711,7 +3711,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In
37113711
3712 // `defer` instructions duplicate the same body arbitrarily many times, but we only want to traverse3712 // `defer` instructions duplicate the same body arbitrarily many times, but we only want to traverse
3713 // their contents once per defer. So, we store the extra index of the body here to deduplicate.3713 // their contents once per defer. So, we store the extra index of the body here to deduplicate.
3714 var found_defers: std.AutoHashMapUnmanaged(u32, void) = .{};3714 var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty;
3715 defer found_defers.deinit(gpa);3715 defer found_defers.deinit(gpa);
37163716
3717 try zir.findDeclsBody(gpa, list, &found_defers, bodies.value_body);3717 try zir.findDeclsBody(gpa, list, &found_defers, bodies.value_body);
...@@ -3725,7 +3725,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In...@@ -3725,7 +3725,7 @@ pub fn findDecls(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.In
3725pub fn findDeclsRoot(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.Index)) !void {3725pub fn findDeclsRoot(zir: Zir, gpa: Allocator, list: *std.ArrayListUnmanaged(Inst.Index)) !void {
3726 list.clearRetainingCapacity();3726 list.clearRetainingCapacity();
37273727
3728 var found_defers: std.AutoHashMapUnmanaged(u32, void) = .{};3728 var found_defers: std.AutoHashMapUnmanaged(u32, void) = .empty;
3729 defer found_defers.deinit(gpa);3729 defer found_defers.deinit(gpa);
37303730
3731 try zir.findDeclsInner(gpa, list, &found_defers, .main_struct_inst);3731 try zir.findDeclsInner(gpa, list, &found_defers, .main_struct_inst);
lib/std/zig/render.zig+7-7
...@@ -17,21 +17,21 @@ const Ais = AutoIndentingStream(std.ArrayList(u8).Writer);...@@ -17,21 +17,21 @@ const Ais = AutoIndentingStream(std.ArrayList(u8).Writer);
17pub const Fixups = struct {17pub const Fixups = struct {
18 /// The key is the mut token (`var`/`const`) of the variable declaration18 /// The key is the mut token (`var`/`const`) of the variable declaration
19 /// that should have a `_ = foo;` inserted afterwards.19 /// that should have a `_ = foo;` inserted afterwards.
20 unused_var_decls: std.AutoHashMapUnmanaged(Ast.TokenIndex, void) = .{},20 unused_var_decls: std.AutoHashMapUnmanaged(Ast.TokenIndex, void) = .empty,
21 /// The functions in this unordered set of AST fn decl nodes will render21 /// The functions in this unordered set of AST fn decl nodes will render
22 /// with a function body of `@trap()` instead, with all parameters22 /// with a function body of `@trap()` instead, with all parameters
23 /// discarded.23 /// discarded.
24 gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .{},24 gut_functions: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty,
25 /// These global declarations will be omitted.25 /// These global declarations will be omitted.
26 omit_nodes: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .{},26 omit_nodes: std.AutoHashMapUnmanaged(Ast.Node.Index, void) = .empty,
27 /// These expressions will be replaced with the string value.27 /// These expressions will be replaced with the string value.
28 replace_nodes_with_string: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .{},28 replace_nodes_with_string: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .empty,
29 /// The string value will be inserted directly after the node.29 /// The string value will be inserted directly after the node.
30 append_string_after_node: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .{},30 append_string_after_node: std.AutoHashMapUnmanaged(Ast.Node.Index, []const u8) = .empty,
31 /// These nodes will be replaced with a different node.31 /// These nodes will be replaced with a different node.
32 replace_nodes_with_node: std.AutoHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .{},32 replace_nodes_with_node: std.AutoHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty,
33 /// Change all identifier names matching the key to be value instead.33 /// Change all identifier names matching the key to be value instead.
34 rename_identifiers: std.StringArrayHashMapUnmanaged([]const u8) = .{},34 rename_identifiers: std.StringArrayHashMapUnmanaged([]const u8) = .empty,
3535
36 /// All `@import` builtin calls which refer to a file path will be prefixed36 /// All `@import` builtin calls which refer to a file path will be prefixed
37 /// with this path.37 /// with this path.
lib/std/zig/system/NativePaths.zig+5-5
...@@ -7,11 +7,11 @@ const mem = std.mem;...@@ -7,11 +7,11 @@ const mem = std.mem;
7const NativePaths = @This();7const NativePaths = @This();
88
9arena: Allocator,9arena: Allocator,
10include_dirs: std.ArrayListUnmanaged([]const u8) = .{},10include_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
11lib_dirs: std.ArrayListUnmanaged([]const u8) = .{},11lib_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
12framework_dirs: std.ArrayListUnmanaged([]const u8) = .{},12framework_dirs: std.ArrayListUnmanaged([]const u8) = .empty,
13rpaths: std.ArrayListUnmanaged([]const u8) = .{},13rpaths: std.ArrayListUnmanaged([]const u8) = .empty,
14warnings: std.ArrayListUnmanaged([]const u8) = .{},14warnings: std.ArrayListUnmanaged([]const u8) = .empty,
1515
16pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths {16pub fn detect(arena: Allocator, native_target: std.Target) !NativePaths {
17 var self: NativePaths = .{ .arena = arena };17 var self: NativePaths = .{ .arena = arena };
src/Compilation.zig+23-23
...@@ -95,7 +95,7 @@ native_system_include_paths: []const []const u8,...@@ -95,7 +95,7 @@ native_system_include_paths: []const []const u8,
95/// Corresponds to `-u <symbol>` for ELF/MachO and `/include:<symbol>` for COFF/PE.95/// Corresponds to `-u <symbol>` for ELF/MachO and `/include:<symbol>` for COFF/PE.
96force_undefined_symbols: std.StringArrayHashMapUnmanaged(void),96force_undefined_symbols: std.StringArrayHashMapUnmanaged(void),
9797
98c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .{},98c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .empty,
99win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct {99win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct {
100 pub fn keys(_: @This()) [0]void {100 pub fn keys(_: @This()) [0]void {
101 return .{};101 return .{};
...@@ -106,10 +106,10 @@ win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMa...@@ -106,10 +106,10 @@ win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMa
106 pub fn deinit(_: @This(), _: Allocator) void {}106 pub fn deinit(_: @This(), _: Allocator) void {}
107} = .{},107} = .{},
108108
109link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .{},109link_errors: std.ArrayListUnmanaged(link.File.ErrorMsg) = .empty,
110link_errors_mutex: std.Thread.Mutex = .{},110link_errors_mutex: std.Thread.Mutex = .{},
111link_error_flags: link.File.ErrorFlags = .{},111link_error_flags: link.File.ErrorFlags = .{},
112lld_errors: std.ArrayListUnmanaged(LldError) = .{},112lld_errors: std.ArrayListUnmanaged(LldError) = .empty,
113113
114work_queues: [114work_queues: [
115 len: {115 len: {
...@@ -154,7 +154,7 @@ embed_file_work_queue: std.fifo.LinearFifo(*Zcu.EmbedFile, .Dynamic),...@@ -154,7 +154,7 @@ embed_file_work_queue: std.fifo.LinearFifo(*Zcu.EmbedFile, .Dynamic),
154154
155/// The ErrorMsg memory is owned by the `CObject`, using Compilation's general purpose allocator.155/// The ErrorMsg memory is owned by the `CObject`, using Compilation's general purpose allocator.
156/// This data is accessed by multiple threads and is protected by `mutex`.156/// This data is accessed by multiple threads and is protected by `mutex`.
157failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .{},157failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .empty,
158158
159/// The ErrorBundle memory is owned by the `Win32Resource`, using Compilation's general purpose allocator.159/// The ErrorBundle memory is owned by the `Win32Resource`, using Compilation's general purpose allocator.
160/// This data is accessed by multiple threads and is protected by `mutex`.160/// 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...@@ -166,7 +166,7 @@ failed_win32_resources: if (dev.env.supports(.win32_resource)) std.AutoArrayHash
166} = .{},166} = .{},
167167
168/// Miscellaneous things that can fail.168/// Miscellaneous things that can fail.
169misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .{},169misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .empty,
170170
171/// When this is `true` it means invoking clang as a sub-process is expected to inherit171/// When this is `true` it means invoking clang as a sub-process is expected to inherit
172/// stdin, stdout, stderr, and if it returns non success, to forward the exit code.172/// 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,...@@ -248,7 +248,7 @@ wasi_emulated_libs: []const wasi_libc.CRTFile,
248/// For example `Scrt1.o` and `libc_nonshared.a`. These are populated after building libc from source,248/// For example `Scrt1.o` and `libc_nonshared.a`. These are populated after building libc from source,
249/// The set of needed CRT (C runtime) files differs depending on the target and compilation settings.249/// The set of needed CRT (C runtime) files differs depending on the target and compilation settings.
250/// The key is the basename, and the value is the absolute path to the completed build artifact.250/// The key is the basename, and the value is the absolute path to the completed build artifact.
251crt_files: std.StringHashMapUnmanaged(CRTFile) = .{},251crt_files: std.StringHashMapUnmanaged(CRTFile) = .empty,
252252
253/// How many lines of reference trace should be included per compile error.253/// How many lines of reference trace should be included per compile error.
254/// Null means only show snippet on first error.254/// Null means only show snippet on first error.
...@@ -527,8 +527,8 @@ pub const CObject = struct {...@@ -527,8 +527,8 @@ pub const CObject = struct {
527 }527 }
528528
529 pub const Bundle = struct {529 pub const Bundle = struct {
530 file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{},530 file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty,
531 category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{},531 category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty,
532 diags: []Diag = &.{},532 diags: []Diag = &.{},
533533
534 pub fn destroy(bundle: *Bundle, gpa: Allocator) void {534 pub fn destroy(bundle: *Bundle, gpa: Allocator) void {
...@@ -561,8 +561,8 @@ pub const CObject = struct {...@@ -561,8 +561,8 @@ pub const CObject = struct {
561 category: u32 = 0,561 category: u32 = 0,
562 msg: []const u8 = &.{},562 msg: []const u8 = &.{},
563 src_loc: SrcLoc = .{},563 src_loc: SrcLoc = .{},
564 src_ranges: std.ArrayListUnmanaged(SrcRange) = .{},564 src_ranges: std.ArrayListUnmanaged(SrcRange) = .empty,
565 sub_diags: std.ArrayListUnmanaged(Diag) = .{},565 sub_diags: std.ArrayListUnmanaged(Diag) = .empty,
566566
567 fn deinit(wip_diag: *@This(), allocator: Allocator) void {567 fn deinit(wip_diag: *@This(), allocator: Allocator) void {
568 allocator.free(wip_diag.msg);568 allocator.free(wip_diag.msg);
...@@ -580,19 +580,19 @@ pub const CObject = struct {...@@ -580,19 +580,19 @@ pub const CObject = struct {
580 var bc = BitcodeReader.init(gpa, .{ .reader = reader.any() });580 var bc = BitcodeReader.init(gpa, .{ .reader = reader.any() });
581 defer bc.deinit();581 defer bc.deinit();
582582
583 var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{};583 var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty;
584 errdefer {584 errdefer {
585 for (file_names.values()) |file_name| gpa.free(file_name);585 for (file_names.values()) |file_name| gpa.free(file_name);
586 file_names.deinit(gpa);586 file_names.deinit(gpa);
587 }587 }
588588
589 var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .{};589 var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty;
590 errdefer {590 errdefer {
591 for (category_names.values()) |category_name| gpa.free(category_name);591 for (category_names.values()) |category_name| gpa.free(category_name);
592 category_names.deinit(gpa);592 category_names.deinit(gpa);
593 }593 }
594594
595 var stack: std.ArrayListUnmanaged(WipDiag) = .{};595 var stack: std.ArrayListUnmanaged(WipDiag) = .empty;
596 defer {596 defer {
597 for (stack.items) |*wip_diag| wip_diag.deinit(gpa);597 for (stack.items) |*wip_diag| wip_diag.deinit(gpa);
598 stack.deinit(gpa);598 stack.deinit(gpa);
...@@ -1067,7 +1067,7 @@ pub const CreateOptions = struct {...@@ -1067,7 +1067,7 @@ pub const CreateOptions = struct {
1067 cache_mode: CacheMode = .incremental,1067 cache_mode: CacheMode = .incremental,
1068 lib_dirs: []const []const u8 = &[0][]const u8{},1068 lib_dirs: []const []const u8 = &[0][]const u8{},
1069 rpath_list: []const []const u8 = &[0][]const u8{},1069 rpath_list: []const []const u8 = &[0][]const u8{},
1070 symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{},1070 symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty,
1071 c_source_files: []const CSourceFile = &.{},1071 c_source_files: []const CSourceFile = &.{},
1072 rc_source_files: []const RcSourceFile = &.{},1072 rc_source_files: []const RcSourceFile = &.{},
1073 manifest_file: ?[]const u8 = null,1073 manifest_file: ?[]const u8 = null,
...@@ -1155,7 +1155,7 @@ pub const CreateOptions = struct {...@@ -1155,7 +1155,7 @@ pub const CreateOptions = struct {
1155 skip_linker_dependencies: bool = false,1155 skip_linker_dependencies: bool = false,
1156 hash_style: link.File.Elf.HashStyle = .both,1156 hash_style: link.File.Elf.HashStyle = .both,
1157 entry: Entry = .default,1157 entry: Entry = .default,
1158 force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{},1158 force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty,
1159 stack_size: ?u64 = null,1159 stack_size: ?u64 = null,
1160 image_base: ?u64 = null,1160 image_base: ?u64 = null,
1161 version: ?std.SemanticVersion = null,1161 version: ?std.SemanticVersion = null,
...@@ -1210,7 +1210,7 @@ fn addModuleTableToCacheHash(...@@ -1210,7 +1210,7 @@ fn addModuleTableToCacheHash(
1210 main_mod: *Package.Module,1210 main_mod: *Package.Module,
1211 hash_type: union(enum) { path_bytes, files: *Cache.Manifest },1211 hash_type: union(enum) { path_bytes, files: *Cache.Manifest },
1212) (error{OutOfMemory} || std.process.GetCwdError)!void {1212) (error{OutOfMemory} || std.process.GetCwdError)!void {
1213 var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .{};1213 var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty;
1214 defer seen_table.deinit(gpa);1214 defer seen_table.deinit(gpa);
12151215
1216 // root_mod and main_mod may be the same pointer. In fact they usually are.1216 // root_mod and main_mod may be the same pointer. In fact they usually are.
...@@ -3362,7 +3362,7 @@ pub fn addModuleErrorMsg(...@@ -3362,7 +3362,7 @@ pub fn addModuleErrorMsg(
3362 const file_path = try err_src_loc.file_scope.fullPath(gpa);3362 const file_path = try err_src_loc.file_scope.fullPath(gpa);
3363 defer gpa.free(file_path);3363 defer gpa.free(file_path);
33643364
3365 var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .{};3365 var ref_traces: std.ArrayListUnmanaged(ErrorBundle.ReferenceTrace) = .empty;
3366 defer ref_traces.deinit(gpa);3366 defer ref_traces.deinit(gpa);
33673367
3368 if (module_err_msg.reference_trace_root.unwrap()) |rt_root| {3368 if (module_err_msg.reference_trace_root.unwrap()) |rt_root| {
...@@ -3370,7 +3370,7 @@ pub fn addModuleErrorMsg(...@@ -3370,7 +3370,7 @@ pub fn addModuleErrorMsg(
3370 all_references.* = try mod.resolveReferences();3370 all_references.* = try mod.resolveReferences();
3371 }3371 }
33723372
3373 var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .{};3373 var seen: std.AutoHashMapUnmanaged(InternPool.AnalUnit, void) = .empty;
3374 defer seen.deinit(gpa);3374 defer seen.deinit(gpa);
33753375
3376 const max_references = mod.comp.reference_trace orelse Sema.default_reference_trace_len;3376 const max_references = mod.comp.reference_trace orelse Sema.default_reference_trace_len;
...@@ -3439,7 +3439,7 @@ pub fn addModuleErrorMsg(...@@ -3439,7 +3439,7 @@ pub fn addModuleErrorMsg(
34393439
3440 // De-duplicate error notes. The main use case in mind for this is3440 // De-duplicate error notes. The main use case in mind for this is
3441 // too many "note: called from here" notes when eval branch quota is reached.3441 // too many "note: called from here" notes when eval branch quota is reached.
3442 var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .{};3442 var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .empty;
3443 defer notes.deinit(gpa);3443 defer notes.deinit(gpa);
34443444
3445 for (module_err_msg.notes) |module_note| {3445 for (module_err_msg.notes) |module_note| {
...@@ -3544,7 +3544,7 @@ fn performAllTheWorkInner(...@@ -3544,7 +3544,7 @@ fn performAllTheWorkInner(
3544 comp.job_queued_update_builtin_zig = false;3544 comp.job_queued_update_builtin_zig = false;
3545 if (comp.zcu == null) break :b;3545 if (comp.zcu == null) break :b;
3546 // TODO put all the modules in a flat array to make them easy to iterate.3546 // TODO put all the modules in a flat array to make them easy to iterate.
3547 var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .{};3547 var seen: std.AutoArrayHashMapUnmanaged(*Package.Module, void) = .empty;
3548 defer seen.deinit(comp.gpa);3548 defer seen.deinit(comp.gpa);
3549 try seen.put(comp.gpa, comp.root_mod, {});3549 try seen.put(comp.gpa, comp.root_mod, {});
3550 var i: usize = 0;3550 var i: usize = 0;
...@@ -4026,7 +4026,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {...@@ -4026,7 +4026,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void {
4026 };4026 };
4027 defer tar_file.close();4027 defer tar_file.close();
40284028
4029 var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .{};4029 var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .empty;
4030 defer seen_table.deinit(comp.gpa);4030 defer seen_table.deinit(comp.gpa);
40314031
4032 try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name);4032 try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name);
...@@ -5221,7 +5221,7 @@ fn spawnZigRc(...@@ -5221,7 +5221,7 @@ fn spawnZigRc(
5221 argv: []const []const u8,5221 argv: []const []const u8,
5222 child_progress_node: std.Progress.Node,5222 child_progress_node: std.Progress.Node,
5223) !void {5223) !void {
5224 var node_name: std.ArrayListUnmanaged(u8) = .{};5224 var node_name: std.ArrayListUnmanaged(u8) = .empty;
5225 defer node_name.deinit(arena);5225 defer node_name.deinit(arena);
52265226
5227 var child = std.process.Child.init(argv, arena);5227 var child = std.process.Child.init(argv, arena);
...@@ -5540,7 +5540,7 @@ pub fn addCCArgs(...@@ -5540,7 +5540,7 @@ pub fn addCCArgs(
5540 }5540 }
55415541
5542 {5542 {
5543 var san_arg: std.ArrayListUnmanaged(u8) = .{};5543 var san_arg: std.ArrayListUnmanaged(u8) = .empty;
5544 const prefix = "-fsanitize=";5544 const prefix = "-fsanitize=";
5545 if (mod.sanitize_c) {5545 if (mod.sanitize_c) {
5546 if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix);5546 if (san_arg.items.len == 0) try san_arg.appendSlice(arena, prefix);
src/InternPool.zig+35-17
...@@ -2,20 +2,20 @@...@@ -2,20 +2,20 @@
2//! This data structure is self-contained.2//! This data structure is self-contained.
33
4/// One item per thread, indexed by `tid`, which is dense and unique per thread.4/// One item per thread, indexed by `tid`, which is dense and unique per thread.
5locals: []Local = &.{},5locals: []Local,
6/// Length must be a power of two and represents the number of simultaneous6/// Length must be a power of two and represents the number of simultaneous
7/// writers that can mutate any single sharded data structure.7/// writers that can mutate any single sharded data structure.
8shards: []Shard = &.{},8shards: []Shard,
9/// Key is the error name, index is the error tag value. Index 0 has a length-0 string.9/// Key is the error name, index is the error tag value. Index 0 has a length-0 string.
10global_error_set: GlobalErrorSet = GlobalErrorSet.empty,10global_error_set: GlobalErrorSet,
11/// Cached number of active bits in a `tid`.11/// Cached number of active bits in a `tid`.
12tid_width: if (single_threaded) u0 else std.math.Log2Int(u32) = 0,12tid_width: if (single_threaded) u0 else std.math.Log2Int(u32),
13/// Cached shift amount to put a `tid` in the top bits of a 30-bit value.13/// Cached shift amount to put a `tid` in the top bits of a 30-bit value.
14tid_shift_30: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31,14tid_shift_30: if (single_threaded) u0 else std.math.Log2Int(u32),
15/// Cached shift amount to put a `tid` in the top bits of a 31-bit value.15/// Cached shift amount to put a `tid` in the top bits of a 31-bit value.
16tid_shift_31: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31,16tid_shift_31: if (single_threaded) u0 else std.math.Log2Int(u32),
17/// Cached shift amount to put a `tid` in the top bits of a 32-bit value.17/// Cached shift amount to put a `tid` in the top bits of a 32-bit value.
18tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_threaded) 0 else 31,18tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32),
1919
20/// Dependencies on the source code hash associated with a ZIR instruction.20/// Dependencies on the source code hash associated with a ZIR instruction.
21/// * For a `declaration`, this is the entire declaration body.21/// * 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...@@ -23,36 +23,36 @@ tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32) = if (single_th
23/// * For a `func`, this is the source of the full function signature.23/// * For a `func`, this is the source of the full function signature.
24/// These are also invalidated if tracking fails for this instruction.24/// These are also invalidated if tracking fails for this instruction.
25/// Value is index into `dep_entries` of the first dependency on this hash.25/// Value is index into `dep_entries` of the first dependency on this hash.
26src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{},26src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index),
27/// Dependencies on the value of a Nav.27/// Dependencies on the value of a Nav.
28/// Value is index into `dep_entries` of the first dependency on this Nav value.28/// Value is index into `dep_entries` of the first dependency on this Nav value.
29nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index) = .{},29nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index),
30/// Dependencies on an interned value, either:30/// Dependencies on an interned value, either:
31/// * a runtime function (invalidated when its IES changes)31/// * a runtime function (invalidated when its IES changes)
32/// * a container type requiring resolution (invalidated when the type must be recreated at a new index)32/// * a container type requiring resolution (invalidated when the type must be recreated at a new index)
33/// Value is index into `dep_entries` of the first dependency on this interned value.33/// Value is index into `dep_entries` of the first dependency on this interned value.
34interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index) = .{},34interned_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index),
35/// Dependencies on the full set of names in a ZIR namespace.35/// Dependencies on the full set of names in a ZIR namespace.
36/// Key refers to a `struct_decl`, `union_decl`, etc.36/// Key refers to a `struct_decl`, `union_decl`, etc.
37/// Value is index into `dep_entries` of the first dependency on this namespace.37/// Value is index into `dep_entries` of the first dependency on this namespace.
38namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index) = .{},38namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index),
39/// Dependencies on the (non-)existence of some name in a namespace.39/// Dependencies on the (non-)existence of some name in a namespace.
40/// Value is index into `dep_entries` of the first dependency on this name.40/// Value is index into `dep_entries` of the first dependency on this name.
41namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index) = .{},41namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index),
4242
43/// Given a `Depender`, points to an entry in `dep_entries` whose `depender`43/// Given a `Depender`, points to an entry in `dep_entries` whose `depender`
44/// matches. The `next_dependee` field can be used to iterate all such entries44/// matches. The `next_dependee` field can be used to iterate all such entries
45/// and remove them from the corresponding lists.45/// and remove them from the corresponding lists.
46first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index) = .{},46first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index),
4747
48/// Stores dependency information. The hashmaps declared above are used to look48/// Stores dependency information. The hashmaps declared above are used to look
49/// up entries in this list as required. This is not stored in `extra` so that49/// up entries in this list as required. This is not stored in `extra` so that
50/// we can use `free_dep_entries` to track free indices, since dependencies are50/// we can use `free_dep_entries` to track free indices, since dependencies are
51/// removed frequently.51/// removed frequently.
52dep_entries: std.ArrayListUnmanaged(DepEntry) = .{},52dep_entries: std.ArrayListUnmanaged(DepEntry),
53/// Stores unused indices in `dep_entries` which can be reused without a full53/// Stores unused indices in `dep_entries` which can be reused without a full
54/// garbage collection pass.54/// garbage collection pass.
55free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index) = .{},55free_dep_entries: std.ArrayListUnmanaged(DepEntry.Index),
5656
57/// Whether a multi-threaded intern pool is useful.57/// Whether a multi-threaded intern pool is useful.
58/// Currently `false` until the intern pool is actually accessed58/// Currently `false` until the intern pool is actually accessed
...@@ -62,6 +62,24 @@ const want_multi_threaded = true;...@@ -62,6 +62,24 @@ const want_multi_threaded = true;
62/// Whether a single-threaded intern pool impl is in use.62/// Whether a single-threaded intern pool impl is in use.
63pub const single_threaded = builtin.single_threaded or !want_multi_threaded;63pub const single_threaded = builtin.single_threaded or !want_multi_threaded;
6464
65pub const empty: InternPool = .{
66 .locals = &.{},
67 .shards = &.{},
68 .global_error_set = .empty,
69 .tid_width = 0,
70 .tid_shift_30 = if (single_threaded) 0 else 31,
71 .tid_shift_31 = if (single_threaded) 0 else 31,
72 .tid_shift_32 = if (single_threaded) 0 else 31,
73 .src_hash_deps = .empty,
74 .nav_val_deps = .empty,
75 .interned_deps = .empty,
76 .namespace_deps = .empty,
77 .namespace_name_deps = .empty,
78 .first_dependency = .empty,
79 .dep_entries = .empty,
80 .free_dep_entries = .empty,
81};
82
65/// A `TrackedInst.Index` provides a single, unchanging reference to a ZIR instruction across a whole83/// A `TrackedInst.Index` provides a single, unchanging reference to a ZIR instruction across a whole
66/// compilation. From this index, you can acquire a `TrackedInst`, which containss a reference to both84/// compilation. From this index, you can acquire a `TrackedInst`, which containss a reference to both
67/// the file which the instruction lives in, and the instruction index itself, which is updated on85/// 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 {...@@ -9858,7 +9876,7 @@ fn extraData(extra: Local.Extra, comptime T: type, index: u32) T {
9858test "basic usage" {9876test "basic usage" {
9859 const gpa = std.testing.allocator;9877 const gpa = std.testing.allocator;
98609878
9861 var ip: InternPool = .{};9879 var ip: InternPool = .empty;
9862 defer ip.deinit(gpa);9880 defer ip.deinit(gpa);
98639881
9864 const i32_type = try ip.get(gpa, .main, .{ .int_type = .{9882 const i32_type = try ip.get(gpa, .main, .{ .int_type = .{
...@@ -10791,7 +10809,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator)...@@ -10791,7 +10809,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator)
10791 var bw = std.io.bufferedWriter(std.io.getStdErr().writer());10809 var bw = std.io.bufferedWriter(std.io.getStdErr().writer());
10792 const w = bw.writer();10810 const w = bw.writer();
1079310811
10794 var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .{};10812 var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayListUnmanaged(Index)) = .empty;
10795 for (ip.locals, 0..) |*local, tid| {10813 for (ip.locals, 0..) |*local, tid| {
10796 const items = local.shared.items.view().slice();10814 const items = local.shared.items.view().slice();
10797 const extra_list = local.shared.extra;10815 const extra_list = local.shared.extra;
src/Liveness.zig+9-9
...@@ -94,10 +94,10 @@ fn LivenessPassData(comptime pass: LivenessPass) type {...@@ -94,10 +94,10 @@ fn LivenessPassData(comptime pass: LivenessPass) type {
94 /// body and which we are currently within. Also includes `loop`s which are the target94 /// body and which we are currently within. Also includes `loop`s which are the target
95 /// of a `repeat` instruction, and `loop_switch_br`s which are the target of a95 /// of a `repeat` instruction, and `loop_switch_br`s which are the target of a
96 /// `switch_dispatch` instruction.96 /// `switch_dispatch` instruction.
97 breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{},97 breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty,
9898
99 /// The set of operands for which we have seen at least one usage but not their birth.99 /// The set of operands for which we have seen at least one usage but not their birth.
100 live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{},100 live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty,
101101
102 fn deinit(self: *@This(), gpa: Allocator) void {102 fn deinit(self: *@This(), gpa: Allocator) void {
103 self.breaks.deinit(gpa);103 self.breaks.deinit(gpa);
...@@ -107,15 +107,15 @@ fn LivenessPassData(comptime pass: LivenessPass) type {...@@ -107,15 +107,15 @@ fn LivenessPassData(comptime pass: LivenessPass) type {
107107
108 .main_analysis => struct {108 .main_analysis => struct {
109 /// Every `block` and `loop` currently under analysis.109 /// Every `block` and `loop` currently under analysis.
110 block_scopes: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockScope) = .{},110 block_scopes: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockScope) = .empty,
111111
112 /// The set of instructions currently alive in the current control112 /// The set of instructions currently alive in the current control
113 /// flow branch.113 /// flow branch.
114 live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{},114 live_set: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty,
115115
116 /// The extra data initialized by the `loop_analysis` pass for this pass to consume.116 /// The extra data initialized by the `loop_analysis` pass for this pass to consume.
117 /// Owned by this struct during this pass.117 /// Owned by this struct during this pass.
118 old_extra: std.ArrayListUnmanaged(u32) = .{},118 old_extra: std.ArrayListUnmanaged(u32) = .empty,
119119
120 const BlockScope = struct {120 const BlockScope = struct {
121 /// If this is a `block`, these instructions are alive upon a `br` to this block.121 /// If this is a `block`, these instructions are alive upon a `br` to this block.
...@@ -1710,10 +1710,10 @@ fn analyzeInstCondBr(...@@ -1710,10 +1710,10 @@ fn analyzeInstCondBr(
1710 // Operands which are alive in one branch but not the other need to die at the start of1710 // Operands which are alive in one branch but not the other need to die at the start of
1711 // the peer branch.1711 // the peer branch.
17121712
1713 var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{};1713 var then_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty;
1714 defer then_mirrored_deaths.deinit(gpa);1714 defer then_mirrored_deaths.deinit(gpa);
17151715
1716 var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .{};1716 var else_mirrored_deaths: std.ArrayListUnmanaged(Air.Inst.Index) = .empty;
1717 defer else_mirrored_deaths.deinit(gpa);1717 defer else_mirrored_deaths.deinit(gpa);
17181718
1719 // Note: this invalidates `else_live`, but expands `then_live` to be their union1719 // Note: this invalidates `else_live`, but expands `then_live` to be their union
...@@ -1785,10 +1785,10 @@ fn analyzeInstSwitchBr(...@@ -1785,10 +1785,10 @@ fn analyzeInstSwitchBr(
17851785
1786 switch (pass) {1786 switch (pass) {
1787 .loop_analysis => {1787 .loop_analysis => {
1788 var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{};1788 var old_breaks: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty;
1789 defer old_breaks.deinit(gpa);1789 defer old_breaks.deinit(gpa);
17901790
1791 var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .{};1791 var old_live: std.AutoHashMapUnmanaged(Air.Inst.Index, void) = .empty;
1792 defer old_live.deinit(gpa);1792 defer old_live.deinit(gpa);
17931793
1794 if (is_dispatch_loop) {1794 if (is_dispatch_loop) {
src/Liveness/Verify.zig+2-2
...@@ -4,8 +4,8 @@ gpa: std.mem.Allocator,...@@ -4,8 +4,8 @@ gpa: std.mem.Allocator,
4air: Air,4air: Air,
5liveness: Liveness,5liveness: Liveness,
6live: LiveMap = .{},6live: LiveMap = .{},
7blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{},7blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty,
8loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .{},8loops: std.AutoHashMapUnmanaged(Air.Inst.Index, LiveMap) = .empty,
9intern_pool: *const InternPool,9intern_pool: *const InternPool,
1010
11pub const Error = error{ LivenessInvalid, OutOfMemory };11pub const Error = error{ LivenessInvalid, OutOfMemory };
src/Package/Fetch.zig+4-4
...@@ -91,7 +91,7 @@ pub const JobQueue = struct {...@@ -91,7 +91,7 @@ pub const JobQueue = struct {
91 /// `table` may be missing some tasks such as ones that failed, so this91 /// `table` may be missing some tasks such as ones that failed, so this
92 /// field contains references to all of them.92 /// field contains references to all of them.
93 /// Protected by `mutex`.93 /// Protected by `mutex`.
94 all_fetches: std.ArrayListUnmanaged(*Fetch) = .{},94 all_fetches: std.ArrayListUnmanaged(*Fetch) = .empty,
9595
96 http_client: *std.http.Client,96 http_client: *std.http.Client,
97 thread_pool: *ThreadPool,97 thread_pool: *ThreadPool,
...@@ -1439,7 +1439,7 @@ fn computeHash(...@@ -1439,7 +1439,7 @@ fn computeHash(
14391439
1440 // Track directories which had any files deleted from them so that empty directories1440 // Track directories which had any files deleted from them so that empty directories
1441 // can be deleted.1441 // can be deleted.
1442 var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .{};1442 var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .empty;
1443 defer sus_dirs.deinit(gpa);1443 defer sus_dirs.deinit(gpa);
14441444
1445 var walker = try root_dir.walk(gpa);1445 var walker = try root_dir.walk(gpa);
...@@ -1710,7 +1710,7 @@ fn normalizePath(bytes: []u8) void {...@@ -1710,7 +1710,7 @@ fn normalizePath(bytes: []u8) void {
1710}1710}
17111711
1712const Filter = struct {1712const Filter = struct {
1713 include_paths: std.StringArrayHashMapUnmanaged(void) = .{},1713 include_paths: std.StringArrayHashMapUnmanaged(void) = .empty,
17141714
1715 /// sub_path is relative to the package root.1715 /// sub_path is relative to the package root.
1716 pub fn includePath(self: Filter, sub_path: []const u8) bool {1716 pub fn includePath(self: Filter, sub_path: []const u8) bool {
...@@ -2309,7 +2309,7 @@ const TestFetchBuilder = struct {...@@ -2309,7 +2309,7 @@ const TestFetchBuilder = struct {
2309 var package_dir = try self.packageDir();2309 var package_dir = try self.packageDir();
2310 defer package_dir.close();2310 defer package_dir.close();
23112311
2312 var actual_files: std.ArrayListUnmanaged([]u8) = .{};2312 var actual_files: std.ArrayListUnmanaged([]u8) = .empty;
2313 defer actual_files.deinit(std.testing.allocator);2313 defer actual_files.deinit(std.testing.allocator);
2314 defer for (actual_files.items) |file| std.testing.allocator.free(file);2314 defer for (actual_files.items) |file| std.testing.allocator.free(file);
2315 var walker = try package_dir.walk(std.testing.allocator);2315 var walker = try package_dir.walk(std.testing.allocator);
src/Package/Fetch/git.zig+11-11
...@@ -38,7 +38,7 @@ test parseOid {...@@ -38,7 +38,7 @@ test parseOid {
3838
39pub const Diagnostics = struct {39pub const Diagnostics = struct {
40 allocator: Allocator,40 allocator: Allocator,
41 errors: std.ArrayListUnmanaged(Error) = .{},41 errors: std.ArrayListUnmanaged(Error) = .empty,
4242
43 pub const Error = union(enum) {43 pub const Error = union(enum) {
44 unable_to_create_sym_link: struct {44 unable_to_create_sym_link: struct {
...@@ -263,7 +263,7 @@ const Odb = struct {...@@ -263,7 +263,7 @@ const Odb = struct {
263 fn readObject(odb: *Odb) !Object {263 fn readObject(odb: *Odb) !Object {
264 var base_offset = try odb.pack_file.getPos();264 var base_offset = try odb.pack_file.getPos();
265 var base_header: EntryHeader = undefined;265 var base_header: EntryHeader = undefined;
266 var delta_offsets = std.ArrayListUnmanaged(u64){};266 var delta_offsets: std.ArrayListUnmanaged(u64) = .empty;
267 defer delta_offsets.deinit(odb.allocator);267 defer delta_offsets.deinit(odb.allocator);
268 const base_object = while (true) {268 const base_object = while (true) {
269 if (odb.cache.get(base_offset)) |base_object| break base_object;269 if (odb.cache.get(base_offset)) |base_object| break base_object;
...@@ -361,7 +361,7 @@ const Object = struct {...@@ -361,7 +361,7 @@ const Object = struct {
361/// freed by the caller at any point after inserting it into the cache. Any361/// freed by the caller at any point after inserting it into the cache. Any
362/// objects remaining in the cache will be freed when the cache itself is freed.362/// objects remaining in the cache will be freed when the cache itself is freed.
363const ObjectCache = struct {363const ObjectCache = struct {
364 objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .{},364 objects: std.AutoHashMapUnmanaged(u64, CacheEntry) = .empty,
365 lru_nodes: LruList = .{},365 lru_nodes: LruList = .{},
366 byte_size: usize = 0,366 byte_size: usize = 0,
367367
...@@ -660,7 +660,7 @@ pub const Session = struct {...@@ -660,7 +660,7 @@ pub const Session = struct {
660 upload_pack_uri.query = null;660 upload_pack_uri.query = null;
661 upload_pack_uri.fragment = null;661 upload_pack_uri.fragment = null;
662662
663 var body = std.ArrayListUnmanaged(u8){};663 var body: std.ArrayListUnmanaged(u8) = .empty;
664 defer body.deinit(allocator);664 defer body.deinit(allocator);
665 const body_writer = body.writer(allocator);665 const body_writer = body.writer(allocator);
666 try Packet.write(.{ .data = "command=ls-refs\n" }, body_writer);666 try Packet.write(.{ .data = "command=ls-refs\n" }, body_writer);
...@@ -767,7 +767,7 @@ pub const Session = struct {...@@ -767,7 +767,7 @@ pub const Session = struct {
767 upload_pack_uri.query = null;767 upload_pack_uri.query = null;
768 upload_pack_uri.fragment = null;768 upload_pack_uri.fragment = null;
769769
770 var body = std.ArrayListUnmanaged(u8){};770 var body: std.ArrayListUnmanaged(u8) = .empty;
771 defer body.deinit(allocator);771 defer body.deinit(allocator);
772 const body_writer = body.writer(allocator);772 const body_writer = body.writer(allocator);
773 try Packet.write(.{ .data = "command=fetch\n" }, body_writer);773 try Packet.write(.{ .data = "command=fetch\n" }, body_writer);
...@@ -1044,9 +1044,9 @@ const IndexEntry = struct {...@@ -1044,9 +1044,9 @@ const IndexEntry = struct {
1044pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) !void {1044pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype) !void {
1045 try pack.seekTo(0);1045 try pack.seekTo(0);
10461046
1047 var index_entries = std.AutoHashMapUnmanaged(Oid, IndexEntry){};1047 var index_entries: std.AutoHashMapUnmanaged(Oid, IndexEntry) = .empty;
1048 defer index_entries.deinit(allocator);1048 defer index_entries.deinit(allocator);
1049 var pending_deltas = std.ArrayListUnmanaged(IndexEntry){};1049 var pending_deltas: std.ArrayListUnmanaged(IndexEntry) = .empty;
1050 defer pending_deltas.deinit(allocator);1050 defer pending_deltas.deinit(allocator);
10511051
1052 const pack_checksum = try indexPackFirstPass(allocator, pack, &index_entries, &pending_deltas);1052 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)...@@ -1068,7 +1068,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype)
1068 remaining_deltas = pending_deltas.items.len;1068 remaining_deltas = pending_deltas.items.len;
1069 }1069 }
10701070
1071 var oids = std.ArrayListUnmanaged(Oid){};1071 var oids: std.ArrayListUnmanaged(Oid) = .empty;
1072 defer oids.deinit(allocator);1072 defer oids.deinit(allocator);
1073 try oids.ensureTotalCapacityPrecise(allocator, index_entries.count());1073 try oids.ensureTotalCapacityPrecise(allocator, index_entries.count());
1074 var index_entries_iter = index_entries.iterator();1074 var index_entries_iter = index_entries.iterator();
...@@ -1109,7 +1109,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype)...@@ -1109,7 +1109,7 @@ pub fn indexPack(allocator: Allocator, pack: std.fs.File, index_writer: anytype)
1109 try writer.writeInt(u32, index_entries.get(oid).?.crc32, .big);1109 try writer.writeInt(u32, index_entries.get(oid).?.crc32, .big);
1110 }1110 }
11111111
1112 var big_offsets = std.ArrayListUnmanaged(u64){};1112 var big_offsets: std.ArrayListUnmanaged(u64) = .empty;
1113 defer big_offsets.deinit(allocator);1113 defer big_offsets.deinit(allocator);
1114 for (oids.items) |oid| {1114 for (oids.items) |oid| {
1115 const offset = index_entries.get(oid).?.offset;1115 const offset = index_entries.get(oid).?.offset;
...@@ -1213,7 +1213,7 @@ fn indexPackHashDelta(...@@ -1213,7 +1213,7 @@ fn indexPackHashDelta(
1213 // Figure out the chain of deltas to resolve1213 // Figure out the chain of deltas to resolve
1214 var base_offset = delta.offset;1214 var base_offset = delta.offset;
1215 var base_header: EntryHeader = undefined;1215 var base_header: EntryHeader = undefined;
1216 var delta_offsets = std.ArrayListUnmanaged(u64){};1216 var delta_offsets: std.ArrayListUnmanaged(u64) = .empty;
1217 defer delta_offsets.deinit(allocator);1217 defer delta_offsets.deinit(allocator);
1218 const base_object = while (true) {1218 const base_object = while (true) {
1219 if (cache.get(base_offset)) |base_object| break base_object;1219 if (cache.get(base_offset)) |base_object| break base_object;
...@@ -1447,7 +1447,7 @@ test "packfile indexing and checkout" {...@@ -1447,7 +1447,7 @@ test "packfile indexing and checkout" {
1447 "file8",1447 "file8",
1448 "file9",1448 "file9",
1449 };1449 };
1450 var actual_files: std.ArrayListUnmanaged([]u8) = .{};1450 var actual_files: std.ArrayListUnmanaged([]u8) = .empty;
1451 defer actual_files.deinit(testing.allocator);1451 defer actual_files.deinit(testing.allocator);
1452 defer for (actual_files.items) |file| testing.allocator.free(file);1452 defer for (actual_files.items) |file| testing.allocator.free(file);
1453 var walker = try worktree.dir.walk(testing.allocator);1453 var walker = try worktree.dir.walk(testing.allocator);
src/Sema.zig+21-21
...@@ -13,7 +13,7 @@ gpa: Allocator,...@@ -13,7 +13,7 @@ gpa: Allocator,
13arena: Allocator,13arena: Allocator,
14code: Zir,14code: Zir,
15air_instructions: std.MultiArrayList(Air.Inst) = .{},15air_instructions: std.MultiArrayList(Air.Inst) = .{},
16air_extra: std.ArrayListUnmanaged(u32) = .{},16air_extra: std.ArrayListUnmanaged(u32) = .empty,
17/// Maps ZIR to AIR.17/// Maps ZIR to AIR.
18inst_map: InstMap = .{},18inst_map: InstMap = .{},
19/// The "owner" of a `Sema` represents the root "thing" that is being analyzed.19/// The "owner" of a `Sema` represents the root "thing" that is being analyzed.
...@@ -65,7 +65,7 @@ generic_call_src: LazySrcLoc = LazySrcLoc.unneeded,...@@ -65,7 +65,7 @@ generic_call_src: LazySrcLoc = LazySrcLoc.unneeded,
65/// They are created when an break_inline passes through a runtime condition, because65/// They are created when an break_inline passes through a runtime condition, because
66/// Sema must convert comptime control flow to runtime control flow, which means66/// Sema must convert comptime control flow to runtime control flow, which means
67/// breaking from a block.67/// breaking from a block.
68post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .{},68post_hoc_blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *LabeledBlock) = .empty,
69/// Populated with the last compile error created.69/// Populated with the last compile error created.
70err: ?*Zcu.ErrorMsg = null,70err: ?*Zcu.ErrorMsg = null,
71/// Set to true when analyzing a func type instruction so that nested generic71/// Set to true when analyzing a func type instruction so that nested generic
...@@ -74,12 +74,12 @@ no_partial_func_ty: bool = false,...@@ -74,12 +74,12 @@ no_partial_func_ty: bool = false,
7474
75/// The temporary arena is used for the memory of the `InferredAlloc` values75/// The temporary arena is used for the memory of the `InferredAlloc` values
76/// here so the values can be dropped without any cleanup.76/// here so the values can be dropped without any cleanup.
77unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .{},77unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .empty,
7878
79/// Links every pointer derived from a base `alloc` back to that `alloc`. Used79/// Links every pointer derived from a base `alloc` back to that `alloc`. Used
80/// to detect comptime-known `const`s.80/// to detect comptime-known `const`s.
81/// TODO: ZIR liveness analysis would allow us to remove elements from this map.81/// TODO: ZIR liveness analysis would allow us to remove elements from this map.
82base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{},82base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .empty,
8383
84/// Runtime `alloc`s are placed in this map to track all comptime-known writes84/// Runtime `alloc`s are placed in this map to track all comptime-known writes
85/// before the corresponding `make_ptr_const` instruction.85/// before the corresponding `make_ptr_const` instruction.
...@@ -90,28 +90,28 @@ base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{},...@@ -90,28 +90,28 @@ base_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, Air.Inst.Index) = .{},
90/// is comptime-known, and all stores to the pointer must be applied at comptime90/// is comptime-known, and all stores to the pointer must be applied at comptime
91/// to determine the comptime value.91/// to determine the comptime value.
92/// Backed by gpa.92/// Backed by gpa.
93maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .{},93maybe_comptime_allocs: std.AutoHashMapUnmanaged(Air.Inst.Index, MaybeComptimeAlloc) = .empty,
9494
95/// Comptime-mutable allocs, and any comptime allocs which reference it, are95/// Comptime-mutable allocs, and any comptime allocs which reference it, are
96/// stored as elements of this array.96/// stored as elements of this array.
97/// Pointers to such memory are represented via an index into this array.97/// Pointers to such memory are represented via an index into this array.
98/// Backed by gpa.98/// Backed by gpa.
99comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .{},99comptime_allocs: std.ArrayListUnmanaged(ComptimeAlloc) = .empty,
100100
101/// A list of exports performed by this analysis. After this `Sema` terminates,101/// A list of exports performed by this analysis. After this `Sema` terminates,
102/// these are flushed to `Zcu.single_exports` or `Zcu.multi_exports`.102/// these are flushed to `Zcu.single_exports` or `Zcu.multi_exports`.
103exports: std.ArrayListUnmanaged(Zcu.Export) = .{},103exports: std.ArrayListUnmanaged(Zcu.Export) = .empty,
104104
105/// All references registered so far by this `Sema`. This is a temporary duplicate105/// All references registered so far by this `Sema`. This is a temporary duplicate
106/// of data stored in `Zcu.all_references`. It exists to avoid adding references to106/// of data stored in `Zcu.all_references`. It exists to avoid adding references to
107/// a given `AnalUnit` multiple times.107/// a given `AnalUnit` multiple times.
108references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{},108references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty,
109type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{},109type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty,
110110
111/// All dependencies registered so far by this `Sema`. This is a temporary duplicate111/// All dependencies registered so far by this `Sema`. This is a temporary duplicate
112/// of the main dependency data. It exists to avoid adding dependencies to a given112/// of the main dependency data. It exists to avoid adding dependencies to a given
113/// `AnalUnit` multiple times.113/// `AnalUnit` multiple times.
114dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .{},114dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .empty,
115115
116/// Whether memoization of this call is permitted. Operations with side effects global116/// Whether memoization of this call is permitted. Operations with side effects global
117/// to the `Sema`, such as `@setEvalBranchQuota`, set this to `false`. It is observed117/// to the `Sema`, such as `@setEvalBranchQuota`, set this to `false`. It is observed
...@@ -208,7 +208,7 @@ pub const InferredErrorSet = struct {...@@ -208,7 +208,7 @@ pub const InferredErrorSet = struct {
208 /// are returned from any dependent functions.208 /// are returned from any dependent functions.
209 errors: NameMap = .{},209 errors: NameMap = .{},
210 /// Other inferred error sets which this inferred error set should include.210 /// Other inferred error sets which this inferred error set should include.
211 inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{},211 inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty,
212 /// The regular error set created by resolving this inferred error set.212 /// The regular error set created by resolving this inferred error set.
213 resolved: InternPool.Index = .none,213 resolved: InternPool.Index = .none,
214214
...@@ -508,9 +508,9 @@ pub const Block = struct {...@@ -508,9 +508,9 @@ pub const Block = struct {
508 /// * for a `switch_block[_ref]`, this refers to dummy `br` instructions508 /// * for a `switch_block[_ref]`, this refers to dummy `br` instructions
509 /// which correspond to `switch_continue` ZIR. The switch logic will509 /// which correspond to `switch_continue` ZIR. The switch logic will
510 /// rewrite these to appropriate AIR switch dispatches.510 /// rewrite these to appropriate AIR switch dispatches.
511 extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .{},511 extra_insts: std.ArrayListUnmanaged(Air.Inst.Index) = .empty,
512 /// Same indexes, capacity, length as `extra_insts`.512 /// Same indexes, capacity, length as `extra_insts`.
513 extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .{},513 extra_src_locs: std.ArrayListUnmanaged(LazySrcLoc) = .empty,
514514
515 pub fn deinit(merges: *@This(), allocator: Allocator) void {515 pub fn deinit(merges: *@This(), allocator: Allocator) void {
516 merges.results.deinit(allocator);516 merges.results.deinit(allocator);
...@@ -871,7 +871,7 @@ const InferredAlloc = struct {...@@ -871,7 +871,7 @@ const InferredAlloc = struct {
871 /// is known. These should be rewritten to perform any required coercions871 /// is known. These should be rewritten to perform any required coercions
872 /// when the type is resolved.872 /// when the type is resolved.
873 /// Allocated from `sema.arena`.873 /// Allocated from `sema.arena`.
874 prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .{},874 prongs: std.ArrayListUnmanaged(Air.Inst.Index) = .empty,
875};875};
876876
877const NeededComptimeReason = struct {877const NeededComptimeReason = struct {
...@@ -2908,7 +2908,7 @@ fn createTypeName(...@@ -2908,7 +2908,7 @@ fn createTypeName(
2908 const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse return error.AnalysisFail);2908 const fn_info = sema.code.getFnInfo(ip.funcZirBodyInst(sema.func_index).resolve(ip) orelse return error.AnalysisFail);
2909 const zir_tags = sema.code.instructions.items(.tag);2909 const zir_tags = sema.code.instructions.items(.tag);
29102910
2911 var buf: std.ArrayListUnmanaged(u8) = .{};2911 var buf: std.ArrayListUnmanaged(u8) = .empty;
2912 defer buf.deinit(gpa);2912 defer buf.deinit(gpa);
29132913
2914 const writer = buf.writer(gpa);2914 const writer = buf.writer(gpa);
...@@ -6851,11 +6851,11 @@ fn lookupInNamespace(...@@ -6851,11 +6851,11 @@ fn lookupInNamespace(
68516851
6852 if (observe_usingnamespace and (namespace.pub_usingnamespace.items.len != 0 or namespace.priv_usingnamespace.items.len != 0)) {6852 if (observe_usingnamespace and (namespace.pub_usingnamespace.items.len != 0 or namespace.priv_usingnamespace.items.len != 0)) {
6853 const gpa = sema.gpa;6853 const gpa = sema.gpa;
6854 var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .{};6854 var checked_namespaces: std.AutoArrayHashMapUnmanaged(*Namespace, void) = .empty;
6855 defer checked_namespaces.deinit(gpa);6855 defer checked_namespaces.deinit(gpa);
68566856
6857 // Keep track of name conflicts for error notes.6857 // Keep track of name conflicts for error notes.
6858 var candidates: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{};6858 var candidates: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty;
6859 defer candidates.deinit(gpa);6859 defer candidates.deinit(gpa);
68606860
6861 try checked_namespaces.put(gpa, namespace, {});6861 try checked_namespaces.put(gpa, namespace, {});
...@@ -22754,7 +22754,7 @@ fn reifyUnion(...@@ -22754,7 +22754,7 @@ fn reifyUnion(
22754 break :tag_ty .{ enum_tag_ty.toIntern(), true };22754 break :tag_ty .{ enum_tag_ty.toIntern(), true };
22755 } else tag_ty: {22755 } else tag_ty: {
22756 // We must track field names and set up the tag type ourselves.22756 // We must track field names and set up the tag type ourselves.
22757 var field_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{};22757 var field_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty;
22758 try field_names.ensureTotalCapacity(sema.arena, fields_len);22758 try field_names.ensureTotalCapacity(sema.arena, fields_len);
2275922759
22760 for (field_types, 0..) |*field_ty, field_idx| {22760 for (field_types, 0..) |*field_ty, field_idx| {
...@@ -37075,7 +37075,7 @@ fn unionFields(...@@ -37075,7 +37075,7 @@ fn unionFields(
3707537075
37076 var int_tag_ty: Type = undefined;37076 var int_tag_ty: Type = undefined;
37077 var enum_field_names: []InternPool.NullTerminatedString = &.{};37077 var enum_field_names: []InternPool.NullTerminatedString = &.{};
37078 var enum_field_vals: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{};37078 var enum_field_vals: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty;
37079 var explicit_tags_seen: []bool = &.{};37079 var explicit_tags_seen: []bool = &.{};
37080 if (tag_type_ref != .none) {37080 if (tag_type_ref != .none) {
37081 const tag_ty_src: LazySrcLoc = .{37081 const tag_ty_src: LazySrcLoc = .{
...@@ -37126,8 +37126,8 @@ fn unionFields(...@@ -37126,8 +37126,8 @@ fn unionFields(
37126 enum_field_names = try sema.arena.alloc(InternPool.NullTerminatedString, fields_len);37126 enum_field_names = try sema.arena.alloc(InternPool.NullTerminatedString, fields_len);
37127 }37127 }
3712837128
37129 var field_types: std.ArrayListUnmanaged(InternPool.Index) = .{};37129 var field_types: std.ArrayListUnmanaged(InternPool.Index) = .empty;
37130 var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .{};37130 var field_aligns: std.ArrayListUnmanaged(InternPool.Alignment) = .empty;
3713137131
37132 try field_types.ensureTotalCapacityPrecise(sema.arena, fields_len);37132 try field_types.ensureTotalCapacityPrecise(sema.arena, fields_len);
37133 if (small.any_aligned_fields)37133 if (small.any_aligned_fields)
src/Zcu.zig+45-45
...@@ -76,14 +76,14 @@ local_zir_cache: Compilation.Directory,...@@ -76,14 +76,14 @@ local_zir_cache: Compilation.Directory,
7676
77/// This is where all `Export` values are stored. Not all values here are necessarily valid exports;77/// This is where all `Export` values are stored. Not all values here are necessarily valid exports;
78/// to enumerate all exports, `single_exports` and `multi_exports` must be consulted.78/// to enumerate all exports, `single_exports` and `multi_exports` must be consulted.
79all_exports: std.ArrayListUnmanaged(Export) = .{},79all_exports: std.ArrayListUnmanaged(Export) = .empty,
80/// This is a list of free indices in `all_exports`. These indices may be reused by exports from80/// This is a list of free indices in `all_exports`. These indices may be reused by exports from
81/// future semantic analysis.81/// future semantic analysis.
82free_exports: std.ArrayListUnmanaged(u32) = .{},82free_exports: std.ArrayListUnmanaged(u32) = .empty,
83/// Maps from an `AnalUnit` which performs a single export, to the index into `all_exports` of83/// Maps from an `AnalUnit` which performs a single export, to the index into `all_exports` of
84/// the export it performs. Note that the key is not the `Decl` being exported, but the `AnalUnit`84/// the export it performs. Note that the key is not the `Decl` being exported, but the `AnalUnit`
85/// whose analysis triggered the export.85/// whose analysis triggered the export.
86single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},86single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
87/// Like `single_exports`, but for `AnalUnit`s which perform multiple exports.87/// Like `single_exports`, but for `AnalUnit`s which perform multiple exports.
88/// The exports are `all_exports.items[index..][0..len]`.88/// The exports are `all_exports.items[index..][0..len]`.
89multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {89multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {
...@@ -104,29 +104,29 @@ multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {...@@ -104,29 +104,29 @@ multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {
104/// `Compilation.update` of the process for a given `Compilation`.104/// `Compilation.update` of the process for a given `Compilation`.
105///105///
106/// Indexes correspond 1:1 to `files`.106/// Indexes correspond 1:1 to `files`.
107import_table: std.StringArrayHashMapUnmanaged(File.Index) = .{},107import_table: std.StringArrayHashMapUnmanaged(File.Index) = .empty,
108108
109/// The set of all the files which have been loaded with `@embedFile` in the Module.109/// The set of all the files which have been loaded with `@embedFile` in the Module.
110/// We keep track of this in order to iterate over it and check which files have been110/// We keep track of this in order to iterate over it and check which files have been
111/// modified on the file system when an update is requested, as well as to cache111/// modified on the file system when an update is requested, as well as to cache
112/// `@embedFile` results.112/// `@embedFile` results.
113/// Keys are fully resolved file paths. This table owns the keys and values.113/// Keys are fully resolved file paths. This table owns the keys and values.
114embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .{},114embed_table: std.StringArrayHashMapUnmanaged(*EmbedFile) = .empty,
115115
116/// Stores all Type and Value objects.116/// Stores all Type and Value objects.
117/// The idea is that this will be periodically garbage-collected, but such logic117/// The idea is that this will be periodically garbage-collected, but such logic
118/// is not yet implemented.118/// is not yet implemented.
119intern_pool: InternPool = .{},119intern_pool: InternPool = .empty,
120120
121analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{},121analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty,
122/// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator.122/// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator.
123failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .{},123failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .empty,
124/// This `AnalUnit` failed semantic analysis because it required analysis of another `AnalUnit` which itself failed.124/// This `AnalUnit` failed semantic analysis because it required analysis of another `AnalUnit` which itself failed.
125transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{},125transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty,
126/// This `Nav` succeeded analysis, but failed codegen.126/// This `Nav` succeeded analysis, but failed codegen.
127/// This may be a simple "value" `Nav`, or it may be a function.127/// This may be a simple "value" `Nav`, or it may be a function.
128/// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator.128/// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator.
129failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .{},129failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .empty,
130/// Keep track of one `@compileLog` callsite per `AnalUnit`.130/// Keep track of one `@compileLog` callsite per `AnalUnit`.
131/// The value is the source location of the `@compileLog` call, convertible to a `LazySrcLoc`.131/// The value is the source location of the `@compileLog` call, convertible to a `LazySrcLoc`.
132compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {132compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {
...@@ -141,14 +141,14 @@ compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {...@@ -141,14 +141,14 @@ compile_log_sources: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct {
141}) = .{},141}) = .{},
142/// Using a map here for consistency with the other fields here.142/// Using a map here for consistency with the other fields here.
143/// The ErrorMsg memory is owned by the `File`, using Module's general purpose allocator.143/// The ErrorMsg memory is owned by the `File`, using Module's general purpose allocator.
144failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .{},144failed_files: std.AutoArrayHashMapUnmanaged(*File, ?*ErrorMsg) = .empty,
145/// The ErrorMsg memory is owned by the `EmbedFile`, using Module's general purpose allocator.145/// The ErrorMsg memory is owned by the `EmbedFile`, using Module's general purpose allocator.
146failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .{},146failed_embed_files: std.AutoArrayHashMapUnmanaged(*EmbedFile, *ErrorMsg) = .empty,
147/// Key is index into `all_exports`.147/// Key is index into `all_exports`.
148failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .{},148failed_exports: std.AutoArrayHashMapUnmanaged(u32, *ErrorMsg) = .empty,
149/// If analysis failed due to a cimport error, the corresponding Clang errors149/// If analysis failed due to a cimport error, the corresponding Clang errors
150/// are stored here.150/// are stored here.
151cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .{},151cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .empty,
152152
153/// Maximum amount of distinct error values, set by --error-limit153/// Maximum amount of distinct error values, set by --error-limit
154error_limit: ErrorInt,154error_limit: ErrorInt,
...@@ -156,19 +156,19 @@ error_limit: ErrorInt,...@@ -156,19 +156,19 @@ error_limit: ErrorInt,
156/// Value is the number of PO dependencies of this AnalUnit.156/// Value is the number of PO dependencies of this AnalUnit.
157/// This value will decrease as we perform semantic analysis to learn what is outdated.157/// This value will decrease as we perform semantic analysis to learn what is outdated.
158/// If any of these PO deps is outdated, this value will be moved to `outdated`.158/// If any of these PO deps is outdated, this value will be moved to `outdated`.
159potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},159potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
160/// Value is the number of PO dependencies of this AnalUnit.160/// Value is the number of PO dependencies of this AnalUnit.
161/// Once this value drops to 0, the AnalUnit is a candidate for re-analysis.161/// Once this value drops to 0, the AnalUnit is a candidate for re-analysis.
162outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},162outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
163/// This contains all `AnalUnit`s in `outdated` whose PO dependency count is 0.163/// This contains all `AnalUnit`s in `outdated` whose PO dependency count is 0.
164/// Such `AnalUnit`s are ready for immediate re-analysis.164/// Such `AnalUnit`s are ready for immediate re-analysis.
165/// See `findOutdatedToAnalyze` for details.165/// See `findOutdatedToAnalyze` for details.
166outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .{},166outdated_ready: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty,
167/// This contains a list of AnalUnit whose analysis or codegen failed, but the167/// This contains a list of AnalUnit whose analysis or codegen failed, but the
168/// failure was something like running out of disk space, and trying again may168/// failure was something like running out of disk space, and trying again may
169/// succeed. On the next update, we will flush this list, marking all members of169/// succeed. On the next update, we will flush this list, marking all members of
170/// it as outdated.170/// it as outdated.
171retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .{},171retryable_failures: std.ArrayListUnmanaged(AnalUnit) = .empty,
172172
173/// These are the modules which we initially queue for analysis in `Compilation.update`.173/// These are the modules which we initially queue for analysis in `Compilation.update`.
174/// `resolveReferences` will use these as the root of its reachability traversal.174/// `resolveReferences` will use these as the root of its reachability traversal.
...@@ -184,31 +184,31 @@ stage1_flags: packed struct {...@@ -184,31 +184,31 @@ stage1_flags: packed struct {
184 reserved: u2 = 0,184 reserved: u2 = 0,
185} = .{},185} = .{},
186186
187compile_log_text: std.ArrayListUnmanaged(u8) = .{},187compile_log_text: std.ArrayListUnmanaged(u8) = .empty,
188188
189test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .{},189test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty,
190190
191global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .{},191global_assembly: std.AutoArrayHashMapUnmanaged(InternPool.Cau.Index, []u8) = .empty,
192192
193/// Key is the `AnalUnit` *performing* the reference. This representation allows193/// Key is the `AnalUnit` *performing* the reference. This representation allows
194/// incremental updates to quickly delete references caused by a specific `AnalUnit`.194/// incremental updates to quickly delete references caused by a specific `AnalUnit`.
195/// Value is index into `all_references` of the first reference triggered by the unit.195/// Value is index into `all_references` of the first reference triggered by the unit.
196/// The `next` field on the `Reference` forms a linked list of all references196/// The `next` field on the `Reference` forms a linked list of all references
197/// triggered by the key `AnalUnit`.197/// triggered by the key `AnalUnit`.
198reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},198reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
199all_references: std.ArrayListUnmanaged(Reference) = .{},199all_references: std.ArrayListUnmanaged(Reference) = .empty,
200/// Freelist of indices in `all_references`.200/// Freelist of indices in `all_references`.
201free_references: std.ArrayListUnmanaged(u32) = .{},201free_references: std.ArrayListUnmanaged(u32) = .empty,
202202
203/// Key is the `AnalUnit` *performing* the reference. This representation allows203/// Key is the `AnalUnit` *performing* the reference. This representation allows
204/// incremental updates to quickly delete references caused by a specific `AnalUnit`.204/// incremental updates to quickly delete references caused by a specific `AnalUnit`.
205/// Value is index into `all_type_reference` of the first reference triggered by the unit.205/// Value is index into `all_type_reference` of the first reference triggered by the unit.
206/// The `next` field on the `TypeReference` forms a linked list of all type references206/// The `next` field on the `TypeReference` forms a linked list of all type references
207/// triggered by the key `AnalUnit`.207/// triggered by the key `AnalUnit`.
208type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .{},208type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty,
209all_type_references: std.ArrayListUnmanaged(TypeReference) = .{},209all_type_references: std.ArrayListUnmanaged(TypeReference) = .empty,
210/// Freelist of indices in `all_type_references`.210/// Freelist of indices in `all_type_references`.
211free_type_references: std.ArrayListUnmanaged(u32) = .{},211free_type_references: std.ArrayListUnmanaged(u32) = .empty,
212212
213panic_messages: [PanicId.len]InternPool.Nav.Index.Optional = .{.none} ** PanicId.len,213panic_messages: [PanicId.len]InternPool.Nav.Index.Optional = .{.none} ** PanicId.len,
214/// The panic function body.214/// The panic function body.
...@@ -338,16 +338,16 @@ pub const Namespace = struct {...@@ -338,16 +338,16 @@ pub const Namespace = struct {
338 /// Will be a struct, enum, union, or opaque.338 /// Will be a struct, enum, union, or opaque.
339 owner_type: InternPool.Index,339 owner_type: InternPool.Index,
340 /// Members of the namespace which are marked `pub`.340 /// Members of the namespace which are marked `pub`.
341 pub_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .{},341 pub_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty,
342 /// Members of the namespace which are *not* marked `pub`.342 /// Members of the namespace which are *not* marked `pub`.
343 priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .{},343 priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty,
344 /// All `usingnamespace` declarations in this namespace which are marked `pub`.344 /// All `usingnamespace` declarations in this namespace which are marked `pub`.
345 pub_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{},345 pub_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty,
346 /// All `usingnamespace` declarations in this namespace which are *not* marked `pub`.346 /// All `usingnamespace` declarations in this namespace which are *not* marked `pub`.
347 priv_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .{},347 priv_usingnamespace: std.ArrayListUnmanaged(InternPool.Nav.Index) = .empty,
348 /// All `comptime` and `test` declarations in this namespace. We store these purely so that348 /// All `comptime` and `test` declarations in this namespace. We store these purely so that
349 /// incremental compilation can re-use the existing `Cau`s when a namespace changes.349 /// incremental compilation can re-use the existing `Cau`s when a namespace changes.
350 other_decls: std.ArrayListUnmanaged(InternPool.Cau.Index) = .{},350 other_decls: std.ArrayListUnmanaged(InternPool.Cau.Index) = .empty,
351351
352 pub const Index = InternPool.NamespaceIndex;352 pub const Index = InternPool.NamespaceIndex;
353 pub const OptionalIndex = InternPool.OptionalNamespaceIndex;353 pub const OptionalIndex = InternPool.OptionalNamespaceIndex;
...@@ -451,7 +451,7 @@ pub const File = struct {...@@ -451,7 +451,7 @@ pub const File = struct {
451 /// Whether this file is a part of multiple packages. This is an error condition which will be reported after AstGen.451 /// Whether this file is a part of multiple packages. This is an error condition which will be reported after AstGen.
452 multi_pkg: bool = false,452 multi_pkg: bool = false,
453 /// List of references to this file, used for multi-package errors.453 /// List of references to this file, used for multi-package errors.
454 references: std.ArrayListUnmanaged(File.Reference) = .{},454 references: std.ArrayListUnmanaged(File.Reference) = .empty,
455455
456 /// The most recent successful ZIR for this file, with no errors.456 /// The most recent successful ZIR for this file, with no errors.
457 /// This is only populated when a previously successful ZIR457 /// This is only populated when a previously successful ZIR
...@@ -2551,13 +2551,13 @@ pub fn mapOldZirToNew(...@@ -2551,13 +2551,13 @@ pub fn mapOldZirToNew(
2551 old_inst: Zir.Inst.Index,2551 old_inst: Zir.Inst.Index,
2552 new_inst: Zir.Inst.Index,2552 new_inst: Zir.Inst.Index,
2553 };2553 };
2554 var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .{};2554 var match_stack: std.ArrayListUnmanaged(MatchedZirDecl) = .empty;
2555 defer match_stack.deinit(gpa);2555 defer match_stack.deinit(gpa);
25562556
2557 // Used as temporary buffers for namespace declaration instructions2557 // Used as temporary buffers for namespace declaration instructions
2558 var old_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};2558 var old_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
2559 defer old_decls.deinit(gpa);2559 defer old_decls.deinit(gpa);
2560 var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};2560 var new_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
2561 defer new_decls.deinit(gpa);2561 defer new_decls.deinit(gpa);
25622562
2563 // Map the main struct inst (and anything in its fields)2563 // Map the main struct inst (and anything in its fields)
...@@ -2582,19 +2582,19 @@ pub fn mapOldZirToNew(...@@ -2582,19 +2582,19 @@ pub fn mapOldZirToNew(
2582 try inst_map.put(gpa, match_item.old_inst, match_item.new_inst);2582 try inst_map.put(gpa, match_item.old_inst, match_item.new_inst);
25832583
2584 // Maps decl name to `declaration` instruction.2584 // Maps decl name to `declaration` instruction.
2585 var named_decls: std.StringHashMapUnmanaged(Zir.Inst.Index) = .{};2585 var named_decls: std.StringHashMapUnmanaged(Zir.Inst.Index) = .empty;
2586 defer named_decls.deinit(gpa);2586 defer named_decls.deinit(gpa);
2587 // Maps test name to `declaration` instruction.2587 // Maps test name to `declaration` instruction.
2588 var named_tests: std.StringHashMapUnmanaged(Zir.Inst.Index) = .{};2588 var named_tests: std.StringHashMapUnmanaged(Zir.Inst.Index) = .empty;
2589 defer named_tests.deinit(gpa);2589 defer named_tests.deinit(gpa);
2590 // All unnamed tests, in order, for a best-effort match.2590 // All unnamed tests, in order, for a best-effort match.
2591 var unnamed_tests: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};2591 var unnamed_tests: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
2592 defer unnamed_tests.deinit(gpa);2592 defer unnamed_tests.deinit(gpa);
2593 // All comptime declarations, in order, for a best-effort match.2593 // All comptime declarations, in order, for a best-effort match.
2594 var comptime_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};2594 var comptime_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
2595 defer comptime_decls.deinit(gpa);2595 defer comptime_decls.deinit(gpa);
2596 // All usingnamespace declarations, in order, for a best-effort match.2596 // All usingnamespace declarations, in order, for a best-effort match.
2597 var usingnamespace_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .{};2597 var usingnamespace_decls: std.ArrayListUnmanaged(Zir.Inst.Index) = .empty;
2598 defer usingnamespace_decls.deinit(gpa);2598 defer usingnamespace_decls.deinit(gpa);
25992599
2600 {2600 {
...@@ -3154,12 +3154,12 @@ pub fn resolveReferences(zcu: *Zcu) !std.AutoHashMapUnmanaged(AnalUnit, ?Resolve...@@ -3154,12 +3154,12 @@ pub fn resolveReferences(zcu: *Zcu) !std.AutoHashMapUnmanaged(AnalUnit, ?Resolve
3154 const comp = zcu.comp;3154 const comp = zcu.comp;
3155 const ip = &zcu.intern_pool;3155 const ip = &zcu.intern_pool;
31563156
3157 var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{};3157 var result: std.AutoHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty;
3158 errdefer result.deinit(gpa);3158 errdefer result.deinit(gpa);
31593159
3160 var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .{};3160 var checked_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty;
3161 var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .{};3161 var type_queue: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .empty;
3162 var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .{};3162 var unit_queue: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty;
3163 defer {3163 defer {
3164 checked_types.deinit(gpa);3164 checked_types.deinit(gpa);
3165 type_queue.deinit(gpa);3165 type_queue.deinit(gpa);
src/Zcu/PerThread.zig+6-6
...@@ -320,7 +320,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void {...@@ -320,7 +320,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void {
320 const gpa = zcu.gpa;320 const gpa = zcu.gpa;
321321
322 // We need to visit every updated File for every TrackedInst in InternPool.322 // We need to visit every updated File for every TrackedInst in InternPool.
323 var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .{};323 var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .empty;
324 defer cleanupUpdatedFiles(gpa, &updated_files);324 defer cleanupUpdatedFiles(gpa, &updated_files);
325 for (zcu.import_table.values()) |file_index| {325 for (zcu.import_table.values()) |file_index| {
326 const file = zcu.fileByIndex(file_index);326 const file = zcu.fileByIndex(file_index);
...@@ -399,7 +399,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void {...@@ -399,7 +399,7 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void {
399 };399 };
400 if (!has_namespace) continue;400 if (!has_namespace) continue;
401401
402 var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{};402 var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty;
403 defer old_names.deinit(zcu.gpa);403 defer old_names.deinit(zcu.gpa);
404 {404 {
405 var it = old_zir.declIterator(old_inst);405 var it = old_zir.declIterator(old_inst);
...@@ -1721,7 +1721,7 @@ pub fn scanNamespace(...@@ -1721,7 +1721,7 @@ pub fn scanNamespace(
1721 // For incremental updates, `scanDecl` wants to look up existing decls by their ZIR index rather1721 // For incremental updates, `scanDecl` wants to look up existing decls by their ZIR index rather
1722 // than their name. We'll build an efficient mapping now, then discard the current `decls`.1722 // than their name. We'll build an efficient mapping now, then discard the current `decls`.
1723 // We map to the `Cau`, since not every declaration has a `Nav`.1723 // We map to the `Cau`, since not every declaration has a `Nav`.
1724 var existing_by_inst: std.AutoHashMapUnmanaged(InternPool.TrackedInst.Index, InternPool.Cau.Index) = .{};1724 var existing_by_inst: std.AutoHashMapUnmanaged(InternPool.TrackedInst.Index, InternPool.Cau.Index) = .empty;
1725 defer existing_by_inst.deinit(gpa);1725 defer existing_by_inst.deinit(gpa);
17261726
1727 try existing_by_inst.ensureTotalCapacity(gpa, @intCast(1727 try existing_by_inst.ensureTotalCapacity(gpa, @intCast(
...@@ -1761,7 +1761,7 @@ pub fn scanNamespace(...@@ -1761,7 +1761,7 @@ pub fn scanNamespace(
1761 }1761 }
1762 }1762 }
17631763
1764 var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{};1764 var seen_decls: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty;
1765 defer seen_decls.deinit(gpa);1765 defer seen_decls.deinit(gpa);
17661766
1767 namespace.pub_decls.clearRetainingCapacity();1767 namespace.pub_decls.clearRetainingCapacity();
...@@ -2293,8 +2293,8 @@ pub fn processExports(pt: Zcu.PerThread) !void {...@@ -2293,8 +2293,8 @@ pub fn processExports(pt: Zcu.PerThread) !void {
2293 const gpa = zcu.gpa;2293 const gpa = zcu.gpa;
22942294
2295 // First, construct a mapping of every exported value and Nav to the indices of all its different exports.2295 // First, construct a mapping of every exported value and Nav to the indices of all its different exports.
2296 var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .{};2296 var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayListUnmanaged(u32)) = .empty;
2297 var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .{};2297 var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayListUnmanaged(u32)) = .empty;
2298 defer {2298 defer {
2299 for (nav_exports.values()) |*exports| {2299 for (nav_exports.values()) |*exports| {
2300 exports.deinit(gpa);2300 exports.deinit(gpa);
src/arch/aarch64/CodeGen.zig+6-6
...@@ -62,7 +62,7 @@ stack_align: u32,...@@ -62,7 +62,7 @@ stack_align: u32,
62/// MIR Instructions62/// MIR Instructions
63mir_instructions: std.MultiArrayList(Mir.Inst) = .{},63mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
64/// MIR extra data64/// MIR extra data
65mir_extra: std.ArrayListUnmanaged(u32) = .{},65mir_extra: std.ArrayListUnmanaged(u32) = .empty,
6666
67/// Byte offset within the source file of the ending curly.67/// Byte offset within the source file of the ending curly.
68end_di_line: u32,68end_di_line: u32,
...@@ -71,13 +71,13 @@ end_di_column: u32,...@@ -71,13 +71,13 @@ end_di_column: u32,
71/// The value is an offset into the `Function` `code` from the beginning.71/// The value is an offset into the `Function` `code` from the beginning.
72/// To perform the reloc, write 32-bit signed little-endian integer72/// To perform the reloc, write 32-bit signed little-endian integer
73/// which is a relative jump, based on the address following the reloc.73/// which is a relative jump, based on the address following the reloc.
74exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},74exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty,
7575
76/// We postpone the creation of debug info for function args and locals76/// We postpone the creation of debug info for function args and locals
77/// until after all Mir instructions have been generated. Only then we77/// until after all Mir instructions have been generated. Only then we
78/// will know saved_regs_stack_space which is necessary in order to78/// will know saved_regs_stack_space which is necessary in order to
79/// calculate the right stack offsest with respect to the `.fp` register.79/// calculate the right stack offsest with respect to the `.fp` register.
80dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},80dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty,
8181
82/// Whenever there is a runtime branch, we push a Branch onto this stack,82/// Whenever there is a runtime branch, we push a Branch onto this stack,
83/// and pop it off when the runtime branch joins. This provides an "overlay"83/// and pop it off when the runtime branch joins. This provides an "overlay"
...@@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},...@@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},
89branch_stack: *std.ArrayList(Branch),89branch_stack: *std.ArrayList(Branch),
9090
91// Key is the block instruction91// Key is the block instruction
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
9393
94register_manager: RegisterManager = .{},94register_manager: RegisterManager = .{},
95/// Maps offset to what is stored there.95/// Maps offset to what is stored there.
96stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{},96stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty,
97/// Tracks the current instruction allocated to the compare flags97/// Tracks the current instruction allocated to the compare flags
98compare_flags_inst: ?Air.Inst.Index = null,98compare_flags_inst: ?Air.Inst.Index = null,
9999
...@@ -247,7 +247,7 @@ const DbgInfoReloc = struct {...@@ -247,7 +247,7 @@ const DbgInfoReloc = struct {
247};247};
248248
249const Branch = struct {249const Branch = struct {
250 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{},250 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty,
251251
252 fn deinit(self: *Branch, gpa: Allocator) void {252 fn deinit(self: *Branch, gpa: Allocator) void {
253 self.inst_table.deinit(gpa);253 self.inst_table.deinit(gpa);
src/arch/aarch64/Emit.zig+4-4
...@@ -33,18 +33,18 @@ prev_di_pc: usize,...@@ -33,18 +33,18 @@ prev_di_pc: usize,
33saved_regs_stack_space: u32,33saved_regs_stack_space: u32,
3434
35/// The branch type of every branch35/// The branch type of every branch
36branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{},36branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty,
3737
38/// For every forward branch, maps the target instruction to a list of38/// For every forward branch, maps the target instruction to a list of
39/// branches which branch to this target instruction39/// branches which branch to this target instruction
40branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{},40branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty,
4141
42/// For backward branches: stores the code offset of the target42/// For backward branches: stores the code offset of the target
43/// instruction43/// instruction
44///44///
45/// For forward branches: stores the code offset of the branch45/// For forward branches: stores the code offset of the branch
46/// instruction46/// instruction
47code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},47code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
4848
49/// The final stack frame size of the function (already aligned to the49/// The final stack frame size of the function (already aligned to the
50/// respective stack alignment). Does not include prologue stack space.50/// respective stack alignment). Does not include prologue stack space.
...@@ -346,7 +346,7 @@ fn lowerBranches(emit: *Emit) !void {...@@ -346,7 +346,7 @@ fn lowerBranches(emit: *Emit) !void {
346 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {346 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {
347 try origin_list.append(gpa, inst);347 try origin_list.append(gpa, inst);
348 } else {348 } else {
349 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{};349 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty;
350 try origin_list.append(gpa, inst);350 try origin_list.append(gpa, inst);
351 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);351 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);
352 }352 }
src/arch/arm/CodeGen.zig+6-6
...@@ -62,7 +62,7 @@ stack_align: u32,...@@ -62,7 +62,7 @@ stack_align: u32,
62/// MIR Instructions62/// MIR Instructions
63mir_instructions: std.MultiArrayList(Mir.Inst) = .{},63mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
64/// MIR extra data64/// MIR extra data
65mir_extra: std.ArrayListUnmanaged(u32) = .{},65mir_extra: std.ArrayListUnmanaged(u32) = .empty,
6666
67/// Byte offset within the source file of the ending curly.67/// Byte offset within the source file of the ending curly.
68end_di_line: u32,68end_di_line: u32,
...@@ -71,13 +71,13 @@ end_di_column: u32,...@@ -71,13 +71,13 @@ end_di_column: u32,
71/// The value is an offset into the `Function` `code` from the beginning.71/// The value is an offset into the `Function` `code` from the beginning.
72/// To perform the reloc, write 32-bit signed little-endian integer72/// To perform the reloc, write 32-bit signed little-endian integer
73/// which is a relative jump, based on the address following the reloc.73/// which is a relative jump, based on the address following the reloc.
74exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},74exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty,
7575
76/// We postpone the creation of debug info for function args and locals76/// We postpone the creation of debug info for function args and locals
77/// until after all Mir instructions have been generated. Only then we77/// until after all Mir instructions have been generated. Only then we
78/// will know saved_regs_stack_space which is necessary in order to78/// will know saved_regs_stack_space which is necessary in order to
79/// calculate the right stack offsest with respect to the `.fp` register.79/// calculate the right stack offsest with respect to the `.fp` register.
80dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},80dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .empty,
8181
82/// Whenever there is a runtime branch, we push a Branch onto this stack,82/// Whenever there is a runtime branch, we push a Branch onto this stack,
83/// and pop it off when the runtime branch joins. This provides an "overlay"83/// and pop it off when the runtime branch joins. This provides an "overlay"
...@@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},...@@ -89,11 +89,11 @@ dbg_info_relocs: std.ArrayListUnmanaged(DbgInfoReloc) = .{},
89branch_stack: *std.ArrayList(Branch),89branch_stack: *std.ArrayList(Branch),
9090
91// Key is the block instruction91// Key is the block instruction
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
9393
94register_manager: RegisterManager = .{},94register_manager: RegisterManager = .{},
95/// Maps offset to what is stored there.95/// Maps offset to what is stored there.
96stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{},96stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty,
97/// Tracks the current instruction allocated to the compare flags97/// Tracks the current instruction allocated to the compare flags
98cpsr_flags_inst: ?Air.Inst.Index = null,98cpsr_flags_inst: ?Air.Inst.Index = null,
9999
...@@ -168,7 +168,7 @@ const MCValue = union(enum) {...@@ -168,7 +168,7 @@ const MCValue = union(enum) {
168};168};
169169
170const Branch = struct {170const Branch = struct {
171 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{},171 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty,
172172
173 fn deinit(self: *Branch, gpa: Allocator) void {173 fn deinit(self: *Branch, gpa: Allocator) void {
174 self.inst_table.deinit(gpa);174 self.inst_table.deinit(gpa);
src/arch/arm/Emit.zig+4-4
...@@ -40,16 +40,16 @@ saved_regs_stack_space: u32,...@@ -40,16 +40,16 @@ saved_regs_stack_space: u32,
40stack_size: u32,40stack_size: u32,
4141
42/// The branch type of every branch42/// The branch type of every branch
43branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{},43branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty,
44/// For every forward branch, maps the target instruction to a list of44/// For every forward branch, maps the target instruction to a list of
45/// branches which branch to this target instruction45/// branches which branch to this target instruction
46branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{},46branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty,
47/// For backward branches: stores the code offset of the target47/// For backward branches: stores the code offset of the target
48/// instruction48/// instruction
49///49///
50/// For forward branches: stores the code offset of the branch50/// For forward branches: stores the code offset of the branch
51/// instruction51/// instruction
52code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},52code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
5353
54const InnerError = error{54const InnerError = error{
55 OutOfMemory,55 OutOfMemory,
...@@ -264,7 +264,7 @@ fn lowerBranches(emit: *Emit) !void {...@@ -264,7 +264,7 @@ fn lowerBranches(emit: *Emit) !void {
264 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {264 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {
265 try origin_list.append(gpa, inst);265 try origin_list.append(gpa, inst);
266 } else {266 } else {
267 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{};267 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty;
268 try origin_list.append(gpa, inst);268 try origin_list.append(gpa, inst);
269 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);269 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);
270 }270 }
src/arch/riscv64/CodeGen.zig+7-7
...@@ -81,7 +81,7 @@ scope_generation: u32,...@@ -81,7 +81,7 @@ scope_generation: u32,
81/// The value is an offset into the `Function` `code` from the beginning.81/// The value is an offset into the `Function` `code` from the beginning.
82/// To perform the reloc, write 32-bit signed little-endian integer82/// To perform the reloc, write 32-bit signed little-endian integer
83/// which is a relative jump, based on the address following the reloc.83/// which is a relative jump, based on the address following the reloc.
84exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},84exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty,
8585
86/// Whenever there is a runtime branch, we push a Branch onto this stack,86/// Whenever there is a runtime branch, we push a Branch onto this stack,
87/// and pop it off when the runtime branch joins. This provides an "overlay"87/// and pop it off when the runtime branch joins. This provides an "overlay"
...@@ -97,14 +97,14 @@ avl: ?u64,...@@ -97,14 +97,14 @@ avl: ?u64,
97vtype: ?bits.VType,97vtype: ?bits.VType,
9898
99// Key is the block instruction99// Key is the block instruction
100blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},100blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
101register_manager: RegisterManager = .{},101register_manager: RegisterManager = .{},
102102
103const_tracking: ConstTrackingMap = .{},103const_tracking: ConstTrackingMap = .{},
104inst_tracking: InstTrackingMap = .{},104inst_tracking: InstTrackingMap = .{},
105105
106frame_allocs: std.MultiArrayList(FrameAlloc) = .{},106frame_allocs: std.MultiArrayList(FrameAlloc) = .{},
107free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{},107free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty,
108frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{},108frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{},
109109
110loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct {110loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct {
...@@ -342,7 +342,7 @@ const MCValue = union(enum) {...@@ -342,7 +342,7 @@ const MCValue = union(enum) {
342};342};
343343
344const Branch = struct {344const Branch = struct {
345 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{},345 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty,
346346
347 fn deinit(func: *Branch, gpa: Allocator) void {347 fn deinit(func: *Branch, gpa: Allocator) void {
348 func.inst_table.deinit(gpa);348 func.inst_table.deinit(gpa);
...@@ -621,7 +621,7 @@ const FrameAlloc = struct {...@@ -621,7 +621,7 @@ const FrameAlloc = struct {
621};621};
622622
623const BlockData = struct {623const BlockData = struct {
624 relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},624 relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
625 state: State,625 state: State,
626626
627 fn deinit(bd: *BlockData, gpa: Allocator) void {627 fn deinit(bd: *BlockData, gpa: Allocator) void {
...@@ -6193,7 +6193,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {...@@ -6193,7 +6193,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {
61936193
6194 const Label = struct {6194 const Label = struct {
6195 target: Mir.Inst.Index = undefined,6195 target: Mir.Inst.Index = undefined,
6196 pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},6196 pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
61976197
6198 const Kind = enum { definition, reference };6198 const Kind = enum { definition, reference };
61996199
...@@ -6217,7 +6217,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {...@@ -6217,7 +6217,7 @@ fn airAsm(func: *Func, inst: Air.Inst.Index) !void {
6217 return name.len > 0;6217 return name.len > 0;
6218 }6218 }
6219 };6219 };
6220 var labels: std.StringHashMapUnmanaged(Label) = .{};6220 var labels: std.StringHashMapUnmanaged(Label) = .empty;
6221 defer {6221 defer {
6222 var label_it = labels.valueIterator();6222 var label_it = labels.valueIterator();
6223 while (label_it.next()) |label| label.pending_relocs.deinit(func.gpa);6223 while (label_it.next()) |label| label.pending_relocs.deinit(func.gpa);
src/arch/riscv64/Emit.zig+2-2
...@@ -10,8 +10,8 @@ prev_di_column: u32,...@@ -10,8 +10,8 @@ prev_di_column: u32,
10/// Relative to the beginning of `code`.10/// Relative to the beginning of `code`.
11prev_di_pc: usize,11prev_di_pc: usize,
1212
13code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},13code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
14relocs: std.ArrayListUnmanaged(Reloc) = .{},14relocs: std.ArrayListUnmanaged(Reloc) = .empty,
1515
16pub const Error = Lower.Error || error{16pub const Error = Lower.Error || error{
17 EmitFail,17 EmitFail,
src/arch/sparc64/CodeGen.zig+5-5
...@@ -68,7 +68,7 @@ stack_align: Alignment,...@@ -68,7 +68,7 @@ stack_align: Alignment,
68/// MIR Instructions68/// MIR Instructions
69mir_instructions: std.MultiArrayList(Mir.Inst) = .{},69mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
70/// MIR extra data70/// MIR extra data
71mir_extra: std.ArrayListUnmanaged(u32) = .{},71mir_extra: std.ArrayListUnmanaged(u32) = .empty,
7272
73/// Byte offset within the source file of the ending curly.73/// Byte offset within the source file of the ending curly.
74end_di_line: u32,74end_di_line: u32,
...@@ -77,7 +77,7 @@ end_di_column: u32,...@@ -77,7 +77,7 @@ end_di_column: u32,
77/// The value is an offset into the `Function` `code` from the beginning.77/// The value is an offset into the `Function` `code` from the beginning.
78/// To perform the reloc, write 32-bit signed little-endian integer78/// To perform the reloc, write 32-bit signed little-endian integer
79/// which is a relative jump, based on the address following the reloc.79/// which is a relative jump, based on the address following the reloc.
80exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},80exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .empty,
8181
82/// Whenever there is a runtime branch, we push a Branch onto this stack,82/// Whenever there is a runtime branch, we push a Branch onto this stack,
83/// and pop it off when the runtime branch joins. This provides an "overlay"83/// and pop it off when the runtime branch joins. This provides an "overlay"
...@@ -89,12 +89,12 @@ exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},...@@ -89,12 +89,12 @@ exitlude_jump_relocs: std.ArrayListUnmanaged(usize) = .{},
89branch_stack: *std.ArrayList(Branch),89branch_stack: *std.ArrayList(Branch),
9090
91// Key is the block instruction91// Key is the block instruction
92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},92blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
9393
94register_manager: RegisterManager = .{},94register_manager: RegisterManager = .{},
9595
96/// Maps offset to what is stored there.96/// Maps offset to what is stored there.
97stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .{},97stack: std.AutoHashMapUnmanaged(u32, StackAllocation) = .empty,
9898
99/// Tracks the current instruction allocated to the condition flags99/// Tracks the current instruction allocated to the condition flags
100condition_flags_inst: ?Air.Inst.Index = null,100condition_flags_inst: ?Air.Inst.Index = null,
...@@ -201,7 +201,7 @@ const MCValue = union(enum) {...@@ -201,7 +201,7 @@ const MCValue = union(enum) {
201};201};
202202
203const Branch = struct {203const Branch = struct {
204 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .{},204 inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty,
205205
206 fn deinit(self: *Branch, gpa: Allocator) void {206 fn deinit(self: *Branch, gpa: Allocator) void {
207 self.inst_table.deinit(gpa);207 self.inst_table.deinit(gpa);
src/arch/sparc64/Emit.zig+4-4
...@@ -30,16 +30,16 @@ prev_di_column: u32,...@@ -30,16 +30,16 @@ prev_di_column: u32,
30prev_di_pc: usize,30prev_di_pc: usize,
3131
32/// The branch type of every branch32/// The branch type of every branch
33branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .{},33branch_types: std.AutoHashMapUnmanaged(Mir.Inst.Index, BranchType) = .empty,
34/// For every forward branch, maps the target instruction to a list of34/// For every forward branch, maps the target instruction to a list of
35/// branches which branch to this target instruction35/// branches which branch to this target instruction
36branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .{},36branch_forward_origins: std.AutoHashMapUnmanaged(Mir.Inst.Index, std.ArrayListUnmanaged(Mir.Inst.Index)) = .empty,
37/// For backward branches: stores the code offset of the target37/// For backward branches: stores the code offset of the target
38/// instruction38/// instruction
39///39///
40/// For forward branches: stores the code offset of the branch40/// For forward branches: stores the code offset of the branch
41/// instruction41/// instruction
42code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},42code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
4343
44const InnerError = error{44const InnerError = error{
45 OutOfMemory,45 OutOfMemory,
...@@ -571,7 +571,7 @@ fn lowerBranches(emit: *Emit) !void {...@@ -571,7 +571,7 @@ fn lowerBranches(emit: *Emit) !void {
571 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {571 if (emit.branch_forward_origins.getPtr(target_inst)) |origin_list| {
572 try origin_list.append(gpa, inst);572 try origin_list.append(gpa, inst);
573 } else {573 } else {
574 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .{};574 var origin_list: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty;
575 try origin_list.append(gpa, inst);575 try origin_list.append(gpa, inst);
576 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);576 try emit.branch_forward_origins.put(gpa, target_inst, origin_list);
577 }577 }
src/arch/wasm/CodeGen.zig+9-9
...@@ -654,7 +654,7 @@ func_index: InternPool.Index,...@@ -654,7 +654,7 @@ func_index: InternPool.Index,
654/// When we return from a branch, the branch will be popped from this list,654/// When we return from a branch, the branch will be popped from this list,
655/// which means branches can only contain references from within its own branch,655/// which means branches can only contain references from within its own branch,
656/// or a branch higher (lower index) in the tree.656/// or a branch higher (lower index) in the tree.
657branches: std.ArrayListUnmanaged(Branch) = .{},657branches: std.ArrayListUnmanaged(Branch) = .empty,
658/// Table to save `WValue`'s generated by an `Air.Inst`658/// Table to save `WValue`'s generated by an `Air.Inst`
659// values: ValueTable,659// values: ValueTable,
660/// Mapping from Air.Inst.Index to block ids660/// Mapping from Air.Inst.Index to block ids
...@@ -663,7 +663,7 @@ blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, struct {...@@ -663,7 +663,7 @@ blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, struct {
663 value: WValue,663 value: WValue,
664}) = .{},664}) = .{},
665/// Maps `loop` instructions to their label. `br` to here repeats the loop.665/// Maps `loop` instructions to their label. `br` to here repeats the loop.
666loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .{},666loops: std.AutoHashMapUnmanaged(Air.Inst.Index, u32) = .empty,
667/// `bytes` contains the wasm bytecode belonging to the 'code' section.667/// `bytes` contains the wasm bytecode belonging to the 'code' section.
668code: *ArrayList(u8),668code: *ArrayList(u8),
669/// The index the next local generated will have669/// The index the next local generated will have
...@@ -681,7 +681,7 @@ locals: std.ArrayListUnmanaged(u8),...@@ -681,7 +681,7 @@ locals: std.ArrayListUnmanaged(u8),
681/// List of simd128 immediates. Each value is stored as an array of bytes.681/// List of simd128 immediates. Each value is stored as an array of bytes.
682/// This list will only be populated for 128bit-simd values when the target features682/// This list will only be populated for 128bit-simd values when the target features
683/// are enabled also.683/// are enabled also.
684simd_immediates: std.ArrayListUnmanaged([16]u8) = .{},684simd_immediates: std.ArrayListUnmanaged([16]u8) = .empty,
685/// The Target we're emitting (used to call intInfo)685/// The Target we're emitting (used to call intInfo)
686target: *const std.Target,686target: *const std.Target,
687/// Represents the wasm binary file that is being linked.687/// Represents the wasm binary file that is being linked.
...@@ -690,7 +690,7 @@ pt: Zcu.PerThread,...@@ -690,7 +690,7 @@ pt: Zcu.PerThread,
690/// List of MIR Instructions690/// List of MIR Instructions
691mir_instructions: std.MultiArrayList(Mir.Inst) = .{},691mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
692/// Contains extra data for MIR692/// Contains extra data for MIR
693mir_extra: std.ArrayListUnmanaged(u32) = .{},693mir_extra: std.ArrayListUnmanaged(u32) = .empty,
694/// When a function is executing, we store the the current stack pointer's value within this local.694/// When a function is executing, we store the the current stack pointer's value within this local.
695/// This value is then used to restore the stack pointer to the original value at the return of the function.695/// This value is then used to restore the stack pointer to the original value at the return of the function.
696initial_stack_value: WValue = .none,696initial_stack_value: WValue = .none,
...@@ -717,19 +717,19 @@ stack_alignment: Alignment = .@"16",...@@ -717,19 +717,19 @@ stack_alignment: Alignment = .@"16",
717// allows us to re-use locals that are no longer used. e.g. a temporary local.717// allows us to re-use locals that are no longer used. e.g. a temporary local.
718/// A list of indexes which represents a local of valtype `i32`.718/// A list of indexes which represents a local of valtype `i32`.
719/// It is illegal to store a non-i32 valtype in this list.719/// It is illegal to store a non-i32 valtype in this list.
720free_locals_i32: std.ArrayListUnmanaged(u32) = .{},720free_locals_i32: std.ArrayListUnmanaged(u32) = .empty,
721/// A list of indexes which represents a local of valtype `i64`.721/// A list of indexes which represents a local of valtype `i64`.
722/// It is illegal to store a non-i64 valtype in this list.722/// It is illegal to store a non-i64 valtype in this list.
723free_locals_i64: std.ArrayListUnmanaged(u32) = .{},723free_locals_i64: std.ArrayListUnmanaged(u32) = .empty,
724/// A list of indexes which represents a local of valtype `f32`.724/// A list of indexes which represents a local of valtype `f32`.
725/// It is illegal to store a non-f32 valtype in this list.725/// It is illegal to store a non-f32 valtype in this list.
726free_locals_f32: std.ArrayListUnmanaged(u32) = .{},726free_locals_f32: std.ArrayListUnmanaged(u32) = .empty,
727/// A list of indexes which represents a local of valtype `f64`.727/// A list of indexes which represents a local of valtype `f64`.
728/// It is illegal to store a non-f64 valtype in this list.728/// It is illegal to store a non-f64 valtype in this list.
729free_locals_f64: std.ArrayListUnmanaged(u32) = .{},729free_locals_f64: std.ArrayListUnmanaged(u32) = .empty,
730/// A list of indexes which represents a local of valtype `v127`.730/// A list of indexes which represents a local of valtype `v127`.
731/// It is illegal to store a non-v128 valtype in this list.731/// It is illegal to store a non-v128 valtype in this list.
732free_locals_v128: std.ArrayListUnmanaged(u32) = .{},732free_locals_v128: std.ArrayListUnmanaged(u32) = .empty,
733733
734/// When in debug mode, this tracks if no `finishAir` was missed.734/// When in debug mode, this tracks if no `finishAir` was missed.
735/// Forgetting to call `finishAir` will cause the result to not be735/// Forgetting to call `finishAir` will cause the result to not be
src/arch/x86_64/CodeGen.zig+7-7
...@@ -78,7 +78,7 @@ eflags_inst: ?Air.Inst.Index = null,...@@ -78,7 +78,7 @@ eflags_inst: ?Air.Inst.Index = null,
78/// MIR Instructions78/// MIR Instructions
79mir_instructions: std.MultiArrayList(Mir.Inst) = .{},79mir_instructions: std.MultiArrayList(Mir.Inst) = .{},
80/// MIR extra data80/// MIR extra data
81mir_extra: std.ArrayListUnmanaged(u32) = .{},81mir_extra: std.ArrayListUnmanaged(u32) = .empty,
8282
83/// Byte offset within the source file of the ending curly.83/// Byte offset within the source file of the ending curly.
84end_di_line: u32,84end_di_line: u32,
...@@ -87,13 +87,13 @@ end_di_column: u32,...@@ -87,13 +87,13 @@ end_di_column: u32,
87/// The value is an offset into the `Function` `code` from the beginning.87/// The value is an offset into the `Function` `code` from the beginning.
88/// To perform the reloc, write 32-bit signed little-endian integer88/// To perform the reloc, write 32-bit signed little-endian integer
89/// which is a relative jump, based on the address following the reloc.89/// which is a relative jump, based on the address following the reloc.
90exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},90exitlude_jump_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
9191
92const_tracking: ConstTrackingMap = .{},92const_tracking: ConstTrackingMap = .{},
93inst_tracking: InstTrackingMap = .{},93inst_tracking: InstTrackingMap = .{},
9494
95// Key is the block instruction95// Key is the block instruction
96blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},96blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
9797
98register_manager: RegisterManager = .{},98register_manager: RegisterManager = .{},
9999
...@@ -101,7 +101,7 @@ register_manager: RegisterManager = .{},...@@ -101,7 +101,7 @@ register_manager: RegisterManager = .{},
101scope_generation: u32 = 0,101scope_generation: u32 = 0,
102102
103frame_allocs: std.MultiArrayList(FrameAlloc) = .{},103frame_allocs: std.MultiArrayList(FrameAlloc) = .{},
104free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .{},104free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty,
105frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{},105frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{},
106106
107loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct {107loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct {
...@@ -799,7 +799,7 @@ const StackAllocation = struct {...@@ -799,7 +799,7 @@ const StackAllocation = struct {
799};799};
800800
801const BlockData = struct {801const BlockData = struct {
802 relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},802 relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
803 state: State,803 state: State,
804804
805 fn deinit(self: *BlockData, gpa: Allocator) void {805 fn deinit(self: *BlockData, gpa: Allocator) void {
...@@ -14248,7 +14248,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -14248,7 +14248,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
1424814248
14249 const Label = struct {14249 const Label = struct {
14250 target: Mir.Inst.Index = undefined,14250 target: Mir.Inst.Index = undefined,
14251 pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .{},14251 pending_relocs: std.ArrayListUnmanaged(Mir.Inst.Index) = .empty,
1425214252
14253 const Kind = enum { definition, reference };14253 const Kind = enum { definition, reference };
1425414254
...@@ -14272,7 +14272,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -14272,7 +14272,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
14272 return name.len > 0;14272 return name.len > 0;
14273 }14273 }
14274 };14274 };
14275 var labels: std.StringHashMapUnmanaged(Label) = .{};14275 var labels: std.StringHashMapUnmanaged(Label) = .empty;
14276 defer {14276 defer {
14277 var label_it = labels.valueIterator();14277 var label_it = labels.valueIterator();
14278 while (label_it.next()) |label| label.pending_relocs.deinit(self.gpa);14278 while (label_it.next()) |label| label.pending_relocs.deinit(self.gpa);
src/arch/x86_64/Emit.zig+2-2
...@@ -11,8 +11,8 @@ prev_di_column: u32,...@@ -11,8 +11,8 @@ prev_di_column: u32,
11/// Relative to the beginning of `code`.11/// Relative to the beginning of `code`.
12prev_di_pc: usize,12prev_di_pc: usize,
1313
14code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .{},14code_offset_mapping: std.AutoHashMapUnmanaged(Mir.Inst.Index, usize) = .empty,
15relocs: std.ArrayListUnmanaged(Reloc) = .{},15relocs: std.ArrayListUnmanaged(Reloc) = .empty,
1616
17pub const Error = Lower.Error || error{17pub const Error = Lower.Error || error{
18 EmitFail,18 EmitFail,
src/codegen/c.zig+4-4
...@@ -304,14 +304,14 @@ pub const Function = struct {...@@ -304,14 +304,14 @@ pub const Function = struct {
304 air: Air,304 air: Air,
305 liveness: Liveness,305 liveness: Liveness,
306 value_map: CValueMap,306 value_map: CValueMap,
307 blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .{},307 blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, BlockData) = .empty,
308 next_arg_index: usize = 0,308 next_arg_index: usize = 0,
309 next_block_index: usize = 0,309 next_block_index: usize = 0,
310 object: Object,310 object: Object,
311 lazy_fns: LazyFnMap,311 lazy_fns: LazyFnMap,
312 func_index: InternPool.Index,312 func_index: InternPool.Index,
313 /// All the locals, to be emitted at the top of the function.313 /// All the locals, to be emitted at the top of the function.
314 locals: std.ArrayListUnmanaged(Local) = .{},314 locals: std.ArrayListUnmanaged(Local) = .empty,
315 /// Which locals are available for reuse, based on Type.315 /// Which locals are available for reuse, based on Type.
316 free_locals_map: LocalsMap = .{},316 free_locals_map: LocalsMap = .{},
317 /// Locals which will not be freed by Liveness. This is used after a317 /// Locals which will not be freed by Liveness. This is used after a
...@@ -320,10 +320,10 @@ pub const Function = struct {...@@ -320,10 +320,10 @@ pub const Function = struct {
320 /// of variable declarations at the top of a function, sorted descending320 /// of variable declarations at the top of a function, sorted descending
321 /// by type alignment.321 /// by type alignment.
322 /// The value is whether the alloc needs to be emitted in the header.322 /// The value is whether the alloc needs to be emitted in the header.
323 allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .{},323 allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .empty,
324 /// Maps from `loop_switch_br` instructions to the allocated local used324 /// Maps from `loop_switch_br` instructions to the allocated local used
325 /// for the switch cond. Dispatches should set this local to the new cond.325 /// for the switch cond. Dispatches should set this local to the new cond.
326 loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .{},326 loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .empty,
327327
328 fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue {328 fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue {
329 const gop = try f.value_map.getOrPut(ref);329 const gop = try f.value_map.getOrPut(ref);
src/codegen/llvm.zig+9-9
...@@ -1500,7 +1500,7 @@ pub const Object = struct {...@@ -1500,7 +1500,7 @@ pub const Object = struct {
1500 // instructions. Depending on the calling convention, this list is not necessarily1500 // instructions. Depending on the calling convention, this list is not necessarily
1501 // a bijection with the actual LLVM parameters of the function.1501 // a bijection with the actual LLVM parameters of the function.
1502 const gpa = o.gpa;1502 const gpa = o.gpa;
1503 var args: std.ArrayListUnmanaged(Builder.Value) = .{};1503 var args: std.ArrayListUnmanaged(Builder.Value) = .empty;
1504 defer args.deinit(gpa);1504 defer args.deinit(gpa);
15051505
1506 {1506 {
...@@ -2497,7 +2497,7 @@ pub const Object = struct {...@@ -2497,7 +2497,7 @@ pub const Object = struct {
24972497
2498 switch (ip.indexToKey(ty.toIntern())) {2498 switch (ip.indexToKey(ty.toIntern())) {
2499 .anon_struct_type => |tuple| {2499 .anon_struct_type => |tuple| {
2500 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{};2500 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty;
2501 defer fields.deinit(gpa);2501 defer fields.deinit(gpa);
25022502
2503 try fields.ensureUnusedCapacity(gpa, tuple.types.len);2503 try fields.ensureUnusedCapacity(gpa, tuple.types.len);
...@@ -2574,7 +2574,7 @@ pub const Object = struct {...@@ -2574,7 +2574,7 @@ pub const Object = struct {
25742574
2575 const struct_type = zcu.typeToStruct(ty).?;2575 const struct_type = zcu.typeToStruct(ty).?;
25762576
2577 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{};2577 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty;
2578 defer fields.deinit(gpa);2578 defer fields.deinit(gpa);
25792579
2580 try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len);2580 try fields.ensureUnusedCapacity(gpa, struct_type.field_types.len);
...@@ -2667,7 +2667,7 @@ pub const Object = struct {...@@ -2667,7 +2667,7 @@ pub const Object = struct {
2667 return debug_union_type;2667 return debug_union_type;
2668 }2668 }
26692669
2670 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .{};2670 var fields: std.ArrayListUnmanaged(Builder.Metadata) = .empty;
2671 defer fields.deinit(gpa);2671 defer fields.deinit(gpa);
26722672
2673 try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len);2673 try fields.ensureUnusedCapacity(gpa, union_type.loadTagType(ip).names.len);
...@@ -3412,7 +3412,7 @@ pub const Object = struct {...@@ -3412,7 +3412,7 @@ pub const Object = struct {
3412 return int_ty;3412 return int_ty;
3413 }3413 }
34143414
3415 var llvm_field_types = std.ArrayListUnmanaged(Builder.Type){};3415 var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty;
3416 defer llvm_field_types.deinit(o.gpa);3416 defer llvm_field_types.deinit(o.gpa);
3417 // Although we can estimate how much capacity to add, these cannot be3417 // Although we can estimate how much capacity to add, these cannot be
3418 // relied upon because of the recursive calls to lowerType below.3418 // relied upon because of the recursive calls to lowerType below.
...@@ -3481,7 +3481,7 @@ pub const Object = struct {...@@ -3481,7 +3481,7 @@ pub const Object = struct {
3481 return ty;3481 return ty;
3482 },3482 },
3483 .anon_struct_type => |anon_struct_type| {3483 .anon_struct_type => |anon_struct_type| {
3484 var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .{};3484 var llvm_field_types: std.ArrayListUnmanaged(Builder.Type) = .empty;
3485 defer llvm_field_types.deinit(o.gpa);3485 defer llvm_field_types.deinit(o.gpa);
3486 // Although we can estimate how much capacity to add, these cannot be3486 // Although we can estimate how much capacity to add, these cannot be
3487 // relied upon because of the recursive calls to lowerType below.3487 // relied upon because of the recursive calls to lowerType below.
...@@ -3672,7 +3672,7 @@ pub const Object = struct {...@@ -3672,7 +3672,7 @@ pub const Object = struct {
3672 const target = zcu.getTarget();3672 const target = zcu.getTarget();
3673 const ret_ty = try lowerFnRetTy(o, fn_info);3673 const ret_ty = try lowerFnRetTy(o, fn_info);
36743674
3675 var llvm_params = std.ArrayListUnmanaged(Builder.Type){};3675 var llvm_params: std.ArrayListUnmanaged(Builder.Type) = .empty;
3676 defer llvm_params.deinit(o.gpa);3676 defer llvm_params.deinit(o.gpa);
36773677
3678 if (firstParamSRet(fn_info, zcu, target)) {3678 if (firstParamSRet(fn_info, zcu, target)) {
...@@ -7438,7 +7438,7 @@ pub const FuncGen = struct {...@@ -7438,7 +7438,7 @@ pub const FuncGen = struct {
7438 const inputs: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra_i..][0..extra.data.inputs_len]);7438 const inputs: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra_i..][0..extra.data.inputs_len]);
7439 extra_i += inputs.len;7439 extra_i += inputs.len;
74407440
7441 var llvm_constraints: std.ArrayListUnmanaged(u8) = .{};7441 var llvm_constraints: std.ArrayListUnmanaged(u8) = .empty;
7442 defer llvm_constraints.deinit(self.gpa);7442 defer llvm_constraints.deinit(self.gpa);
74437443
7444 var arena_allocator = std.heap.ArenaAllocator.init(self.gpa);7444 var arena_allocator = std.heap.ArenaAllocator.init(self.gpa);
...@@ -7466,7 +7466,7 @@ pub const FuncGen = struct {...@@ -7466,7 +7466,7 @@ pub const FuncGen = struct {
7466 var llvm_param_i: usize = 0;7466 var llvm_param_i: usize = 0;
7467 var total_i: u16 = 0;7467 var total_i: u16 = 0;
74687468
7469 var name_map: std.StringArrayHashMapUnmanaged(u16) = .{};7469 var name_map: std.StringArrayHashMapUnmanaged(u16) = .empty;
7470 try name_map.ensureUnusedCapacity(arena, max_param_count);7470 try name_map.ensureUnusedCapacity(arena, max_param_count);
74717471
7472 var rw_extra_i = extra_i;7472 var rw_extra_i = extra_i;
src/codegen/llvm/Builder.zig+6-6
...@@ -3994,7 +3994,7 @@ pub const Function = struct {...@@ -3994,7 +3994,7 @@ pub const Function = struct {
3994 names: [*]const String = &[0]String{},3994 names: [*]const String = &[0]String{},
3995 value_indices: [*]const u32 = &[0]u32{},3995 value_indices: [*]const u32 = &[0]u32{},
3996 strip: bool,3996 strip: bool,
3997 debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{},3997 debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty,
3998 debug_values: []const Instruction.Index = &.{},3998 debug_values: []const Instruction.Index = &.{},
3999 extra: []const u32 = &.{},3999 extra: []const u32 = &.{},
40004000
...@@ -6166,7 +6166,7 @@ pub const WipFunction = struct {...@@ -6166,7 +6166,7 @@ pub const WipFunction = struct {
6166 const value_indices = try gpa.alloc(u32, final_instructions_len);6166 const value_indices = try gpa.alloc(u32, final_instructions_len);
6167 errdefer gpa.free(value_indices);6167 errdefer gpa.free(value_indices);
61686168
6169 var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .{};6169 var debug_locations: std.AutoHashMapUnmanaged(Instruction.Index, DebugLocation) = .empty;
6170 errdefer debug_locations.deinit(gpa);6170 errdefer debug_locations.deinit(gpa);
6171 try debug_locations.ensureUnusedCapacity(gpa, @intCast(self.debug_locations.count()));6171 try debug_locations.ensureUnusedCapacity(gpa, @intCast(self.debug_locations.count()));
61726172
...@@ -9557,7 +9557,7 @@ pub fn printUnbuffered(...@@ -9557,7 +9557,7 @@ pub fn printUnbuffered(
9557 }9557 }
9558 }9558 }
95599559
9560 var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .{};9560 var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .empty;
9561 defer attribute_groups.deinit(self.gpa);9561 defer attribute_groups.deinit(self.gpa);
95629562
9563 for (0.., self.functions.items) |function_i, function| {9563 for (0.., self.functions.items) |function_i, function| {
...@@ -13133,7 +13133,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co...@@ -13133,7 +13133,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
13133 // Write LLVM IR magic13133 // Write LLVM IR magic
13134 try bitcode.writeBits(ir.MAGIC, 32);13134 try bitcode.writeBits(ir.MAGIC, 32);
1313513135
13136 var record: std.ArrayListUnmanaged(u64) = .{};13136 var record: std.ArrayListUnmanaged(u64) = .empty;
13137 defer record.deinit(self.gpa);13137 defer record.deinit(self.gpa);
1313813138
13139 // IDENTIFICATION_BLOCK13139 // IDENTIFICATION_BLOCK
...@@ -13524,7 +13524,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co...@@ -13524,7 +13524,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
13524 try paramattr_block.end();13524 try paramattr_block.end();
13525 }13525 }
1352613526
13527 var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .{};13527 var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .empty;
13528 defer globals.deinit(self.gpa);13528 defer globals.deinit(self.gpa);
13529 try globals.ensureUnusedCapacity(13529 try globals.ensureUnusedCapacity(
13530 self.gpa,13530 self.gpa,
...@@ -13587,7 +13587,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co...@@ -13587,7 +13587,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
1358713587
13588 // Globals13588 // Globals
13589 {13589 {
13590 var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .{};13590 var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .empty;
13591 defer section_map.deinit(self.gpa);13591 defer section_map.deinit(self.gpa);
13592 try section_map.ensureUnusedCapacity(self.gpa, globals.count());13592 try section_map.ensureUnusedCapacity(self.gpa, globals.count());
1359313593
src/codegen/spirv.zig+10-10
...@@ -79,7 +79,7 @@ const ControlFlow = union(enum) {...@@ -79,7 +79,7 @@ const ControlFlow = union(enum) {
79 selection: struct {79 selection: struct {
80 /// In order to know which merges we still need to do, we need to keep80 /// In order to know which merges we still need to do, we need to keep
81 /// a stack of those.81 /// a stack of those.
82 merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .{},82 merge_stack: std.ArrayListUnmanaged(SelectionMerge) = .empty,
83 },83 },
84 /// For a `loop` type block, we can early-exit the block by84 /// For a `loop` type block, we can early-exit the block by
85 /// jumping to the loop exit node, and we don't need to generate85 /// jumping to the loop exit node, and we don't need to generate
...@@ -87,7 +87,7 @@ const ControlFlow = union(enum) {...@@ -87,7 +87,7 @@ const ControlFlow = union(enum) {
87 loop: struct {87 loop: struct {
88 /// The next block to jump to can be determined from any number88 /// The next block to jump to can be determined from any number
89 /// of conditions that jump to the loop exit.89 /// of conditions that jump to the loop exit.
90 merges: std.ArrayListUnmanaged(Incoming) = .{},90 merges: std.ArrayListUnmanaged(Incoming) = .empty,
91 /// The label id of the loop's merge block.91 /// The label id of the loop's merge block.
92 merge_block: IdRef,92 merge_block: IdRef,
93 },93 },
...@@ -102,10 +102,10 @@ const ControlFlow = union(enum) {...@@ -102,10 +102,10 @@ const ControlFlow = union(enum) {
102 };102 };
103 /// The stack of (structured) blocks that we are currently in. This determines103 /// The stack of (structured) blocks that we are currently in. This determines
104 /// how exits from the current block must be handled.104 /// how exits from the current block must be handled.
105 block_stack: std.ArrayListUnmanaged(*Structured.Block) = .{},105 block_stack: std.ArrayListUnmanaged(*Structured.Block) = .empty,
106 /// Maps `block` inst indices to the variable that the block's result106 /// Maps `block` inst indices to the variable that the block's result
107 /// value must be written to.107 /// value must be written to.
108 block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .{},108 block_results: std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef) = .empty,
109 };109 };
110110
111 const Unstructured = struct {111 const Unstructured = struct {
...@@ -116,12 +116,12 @@ const ControlFlow = union(enum) {...@@ -116,12 +116,12 @@ const ControlFlow = union(enum) {
116116
117 const Block = struct {117 const Block = struct {
118 label: ?IdRef = null,118 label: ?IdRef = null,
119 incoming_blocks: std.ArrayListUnmanaged(Incoming) = .{},119 incoming_blocks: std.ArrayListUnmanaged(Incoming) = .empty,
120 };120 };
121121
122 /// We need to keep track of result ids for block labels, as well as the 'incoming'122 /// We need to keep track of result ids for block labels, as well as the 'incoming'
123 /// blocks for a block.123 /// blocks for a block.
124 blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .{},124 blocks: std.AutoHashMapUnmanaged(Air.Inst.Index, *Block) = .empty,
125 };125 };
126126
127 structured: Structured,127 structured: Structured,
...@@ -153,10 +153,10 @@ pub const Object = struct {...@@ -153,10 +153,10 @@ pub const Object = struct {
153153
154 /// The Zig module that this object file is generated for.154 /// The Zig module that this object file is generated for.
155 /// A map of Zig decl indices to SPIR-V decl indices.155 /// A map of Zig decl indices to SPIR-V decl indices.
156 nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, SpvModule.Decl.Index) = .{},156 nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, SpvModule.Decl.Index) = .empty,
157157
158 /// A map of Zig InternPool indices for anonymous decls to SPIR-V decl indices.158 /// A map of Zig InternPool indices for anonymous decls to SPIR-V decl indices.
159 uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .{},159 uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, StorageClass }, SpvModule.Decl.Index) = .empty,
160160
161 /// A map that maps AIR intern pool indices to SPIR-V result-ids.161 /// A map that maps AIR intern pool indices to SPIR-V result-ids.
162 intern_map: InternMap = .{},162 intern_map: InternMap = .{},
...@@ -300,7 +300,7 @@ const NavGen = struct {...@@ -300,7 +300,7 @@ const NavGen = struct {
300300
301 /// An array of function argument result-ids. Each index corresponds with the301 /// An array of function argument result-ids. Each index corresponds with the
302 /// function argument of the same index.302 /// function argument of the same index.
303 args: std.ArrayListUnmanaged(IdRef) = .{},303 args: std.ArrayListUnmanaged(IdRef) = .empty,
304304
305 /// A counter to keep track of how many `arg` instructions we've seen yet.305 /// A counter to keep track of how many `arg` instructions we've seen yet.
306 next_arg_index: u32 = 0,306 next_arg_index: u32 = 0,
...@@ -6270,7 +6270,7 @@ const NavGen = struct {...@@ -6270,7 +6270,7 @@ const NavGen = struct {
6270 }6270 }
6271 }6271 }
62726272
6273 var incoming_structured_blocks = std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming){};6273 var incoming_structured_blocks: std.ArrayListUnmanaged(ControlFlow.Structured.Block.Incoming) = .empty;
6274 defer incoming_structured_blocks.deinit(self.gpa);6274 defer incoming_structured_blocks.deinit(self.gpa);
62756275
6276 if (self.control_flow == .structured) {6276 if (self.control_flow == .structured) {
src/codegen/spirv/Assembler.zig+5-5
...@@ -148,7 +148,7 @@ const AsmValueMap = std.StringArrayHashMapUnmanaged(AsmValue);...@@ -148,7 +148,7 @@ const AsmValueMap = std.StringArrayHashMapUnmanaged(AsmValue);
148gpa: Allocator,148gpa: Allocator,
149149
150/// A list of errors that occured during processing the assembly.150/// A list of errors that occured during processing the assembly.
151errors: std.ArrayListUnmanaged(ErrorMsg) = .{},151errors: std.ArrayListUnmanaged(ErrorMsg) = .empty,
152152
153/// The source code that is being assembled.153/// The source code that is being assembled.
154src: []const u8,154src: []const u8,
...@@ -161,7 +161,7 @@ spv: *SpvModule,...@@ -161,7 +161,7 @@ spv: *SpvModule,
161func: *SpvModule.Fn,161func: *SpvModule.Fn,
162162
163/// `self.src` tokenized.163/// `self.src` tokenized.
164tokens: std.ArrayListUnmanaged(Token) = .{},164tokens: std.ArrayListUnmanaged(Token) = .empty,
165165
166/// The token that is next during parsing.166/// The token that is next during parsing.
167current_token: u32 = 0,167current_token: u32 = 0,
...@@ -172,9 +172,9 @@ inst: struct {...@@ -172,9 +172,9 @@ inst: struct {
172 /// The opcode of the current instruction.172 /// The opcode of the current instruction.
173 opcode: Opcode = undefined,173 opcode: Opcode = undefined,
174 /// Operands of the current instruction.174 /// Operands of the current instruction.
175 operands: std.ArrayListUnmanaged(Operand) = .{},175 operands: std.ArrayListUnmanaged(Operand) = .empty,
176 /// This is where string data resides. Strings are zero-terminated.176 /// This is where string data resides. Strings are zero-terminated.
177 string_bytes: std.ArrayListUnmanaged(u8) = .{},177 string_bytes: std.ArrayListUnmanaged(u8) = .empty,
178178
179 /// Return a reference to the result of this instruction, if any.179 /// Return a reference to the result of this instruction, if any.
180 fn result(self: @This()) ?AsmValue.Ref {180 fn result(self: @This()) ?AsmValue.Ref {
...@@ -196,7 +196,7 @@ value_map: AsmValueMap = .{},...@@ -196,7 +196,7 @@ value_map: AsmValueMap = .{},
196/// This set is used to quickly transform from an opcode name to the196/// This set is used to quickly transform from an opcode name to the
197/// index in its instruction set. The index of the key is the197/// index in its instruction set. The index of the key is the
198/// index in `spec.InstructionSet.core.instructions()`.198/// index in `spec.InstructionSet.core.instructions()`.
199instruction_map: std.StringArrayHashMapUnmanaged(void) = .{},199instruction_map: std.StringArrayHashMapUnmanaged(void) = .empty,
200200
201/// Free the resources owned by this assembler.201/// Free the resources owned by this assembler.
202pub fn deinit(self: *Assembler) void {202pub fn deinit(self: *Assembler) void {
src/codegen/spirv/Module.zig+10-10
...@@ -35,7 +35,7 @@ pub const Fn = struct {...@@ -35,7 +35,7 @@ pub const Fn = struct {
35 /// the end of this function definition.35 /// the end of this function definition.
36 body: Section = .{},36 body: Section = .{},
37 /// The decl dependencies that this function depends on.37 /// The decl dependencies that this function depends on.
38 decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .{},38 decl_deps: std.AutoArrayHashMapUnmanaged(Decl.Index, void) = .empty,
3939
40 /// Reset this function without deallocating resources, so that40 /// Reset this function without deallocating resources, so that
41 /// it may be used to emit code for another function.41 /// it may be used to emit code for another function.
...@@ -141,7 +141,7 @@ sections: struct {...@@ -141,7 +141,7 @@ sections: struct {
141next_result_id: Word,141next_result_id: Word,
142142
143/// Cache for results of OpString instructions.143/// Cache for results of OpString instructions.
144strings: std.StringArrayHashMapUnmanaged(IdRef) = .{},144strings: std.StringArrayHashMapUnmanaged(IdRef) = .empty,
145145
146/// Some types shouldn't be emitted more than one time, but cannot be caught by146/// Some types shouldn't be emitted more than one time, but cannot be caught by
147/// the `intern_map` during codegen. Sometimes, IDs are compared to check if147/// the `intern_map` during codegen. Sometimes, IDs are compared to check if
...@@ -154,27 +154,27 @@ strings: std.StringArrayHashMapUnmanaged(IdRef) = .{},...@@ -154,27 +154,27 @@ strings: std.StringArrayHashMapUnmanaged(IdRef) = .{},
154cache: struct {154cache: struct {
155 bool_type: ?IdRef = null,155 bool_type: ?IdRef = null,
156 void_type: ?IdRef = null,156 void_type: ?IdRef = null,
157 int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .{},157 int_types: std.AutoHashMapUnmanaged(std.builtin.Type.Int, IdRef) = .empty,
158 float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .{},158 float_types: std.AutoHashMapUnmanaged(std.builtin.Type.Float, IdRef) = .empty,
159 // This cache is required so that @Vector(X, u1) in direct representation has the159 // This cache is required so that @Vector(X, u1) in direct representation has the
160 // same ID as @Vector(X, bool) in indirect representation.160 // same ID as @Vector(X, bool) in indirect representation.
161 vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .{},161 vector_types: std.AutoHashMapUnmanaged(struct { IdRef, u32 }, IdRef) = .empty,
162162
163 builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .{},163 builtins: std.AutoHashMapUnmanaged(struct { IdRef, spec.BuiltIn }, Decl.Index) = .empty,
164} = .{},164} = .{},
165165
166/// Set of Decls, referred to by Decl.Index.166/// Set of Decls, referred to by Decl.Index.
167decls: std.ArrayListUnmanaged(Decl) = .{},167decls: std.ArrayListUnmanaged(Decl) = .empty,
168168
169/// List of dependencies, per decl. This list holds all the dependencies, sliced by the169/// List of dependencies, per decl. This list holds all the dependencies, sliced by the
170/// begin_dep and end_dep in `self.decls`.170/// begin_dep and end_dep in `self.decls`.
171decl_deps: std.ArrayListUnmanaged(Decl.Index) = .{},171decl_deps: std.ArrayListUnmanaged(Decl.Index) = .empty,
172172
173/// The list of entry points that should be exported from this module.173/// The list of entry points that should be exported from this module.
174entry_points: std.ArrayListUnmanaged(EntryPoint) = .{},174entry_points: std.ArrayListUnmanaged(EntryPoint) = .empty,
175175
176/// The list of extended instruction sets that should be imported.176/// The list of extended instruction sets that should be imported.
177extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .{},177extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .empty,
178178
179pub fn init(gpa: Allocator) Module {179pub fn init(gpa: Allocator) Module {
180 return .{180 return .{
src/codegen/spirv/Section.zig+1-1
...@@ -15,7 +15,7 @@ const Opcode = spec.Opcode;...@@ -15,7 +15,7 @@ const Opcode = spec.Opcode;
1515
16/// The instructions in this section. Memory is owned by the Module16/// The instructions in this section. Memory is owned by the Module
17/// externally associated to this Section.17/// externally associated to this Section.
18instructions: std.ArrayListUnmanaged(Word) = .{},18instructions: std.ArrayListUnmanaged(Word) = .empty,
1919
20pub fn deinit(section: *Section, allocator: Allocator) void {20pub fn deinit(section: *Section, allocator: Allocator) void {
21 section.instructions.deinit(allocator);21 section.instructions.deinit(allocator);
src/link/C.zig+15-15
...@@ -26,34 +26,34 @@ base: link.File,...@@ -26,34 +26,34 @@ base: link.File,
26/// This linker backend does not try to incrementally link output C source code.26/// This linker backend does not try to incrementally link output C source code.
27/// Instead, it tracks all declarations in this table, and iterates over it27/// Instead, it tracks all declarations in this table, and iterates over it
28/// in the flush function, stitching pre-rendered pieces of C code together.28/// in the flush function, stitching pre-rendered pieces of C code together.
29navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .{},29navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvBlock) = .empty,
30/// All the string bytes of rendered C code, all squished into one array.30/// All the string bytes of rendered C code, all squished into one array.
31/// While in progress, a separate buffer is used, and then when finished, the31/// While in progress, a separate buffer is used, and then when finished, the
32/// buffer is copied into this one.32/// buffer is copied into this one.
33string_bytes: std.ArrayListUnmanaged(u8) = .{},33string_bytes: std.ArrayListUnmanaged(u8) = .empty,
34/// Tracks all the anonymous decls that are used by all the decls so they can34/// Tracks all the anonymous decls that are used by all the decls so they can
35/// be rendered during flush().35/// be rendered during flush().
36uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .{},36uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, AvBlock) = .empty,
37/// Sparse set of uavs that are overaligned. Underaligned anon decls are37/// Sparse set of uavs that are overaligned. Underaligned anon decls are
38/// lowered the same as ABI-aligned anon decls. The keys here are a subset of38/// lowered the same as ABI-aligned anon decls. The keys here are a subset of
39/// the keys of `uavs`.39/// the keys of `uavs`.
40aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .{},40aligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .empty,
4141
42exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .{},42exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ExportedBlock) = .empty,
43exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .{},43exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ExportedBlock) = .empty,
4444
45/// Optimization, `updateDecl` reuses this buffer rather than creating a new45/// Optimization, `updateDecl` reuses this buffer rather than creating a new
46/// one with every call.46/// one with every call.
47fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{},47fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty,
48/// Optimization, `updateDecl` reuses this buffer rather than creating a new48/// Optimization, `updateDecl` reuses this buffer rather than creating a new
49/// one with every call.49/// one with every call.
50code_buf: std.ArrayListUnmanaged(u8) = .{},50code_buf: std.ArrayListUnmanaged(u8) = .empty,
51/// Optimization, `flush` reuses this buffer rather than creating a new51/// Optimization, `flush` reuses this buffer rather than creating a new
52/// one with every call.52/// one with every call.
53lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .{},53lazy_fwd_decl_buf: std.ArrayListUnmanaged(u8) = .empty,
54/// Optimization, `flush` reuses this buffer rather than creating a new54/// Optimization, `flush` reuses this buffer rather than creating a new
55/// one with every call.55/// one with every call.
56lazy_code_buf: std.ArrayListUnmanaged(u8) = .{},56lazy_code_buf: std.ArrayListUnmanaged(u8) = .empty,
5757
58/// A reference into `string_bytes`.58/// A reference into `string_bytes`.
59const String = extern struct {59const String = extern struct {
...@@ -469,7 +469,7 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:...@@ -469,7 +469,7 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:
469 // `CType`s, forward decls, and non-functions first.469 // `CType`s, forward decls, and non-functions first.
470470
471 {471 {
472 var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .{};472 var export_names: std.AutoHashMapUnmanaged(InternPool.NullTerminatedString, void) = .empty;
473 defer export_names.deinit(gpa);473 defer export_names.deinit(gpa);
474 try export_names.ensureTotalCapacity(gpa, @intCast(zcu.single_exports.count()));474 try export_names.ensureTotalCapacity(gpa, @intCast(zcu.single_exports.count()));
475 for (zcu.single_exports.values()) |export_index| {475 for (zcu.single_exports.values()) |export_index| {
...@@ -559,16 +559,16 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:...@@ -559,16 +559,16 @@ pub fn flushModule(self: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node:
559559
560const Flush = struct {560const Flush = struct {
561 ctype_pool: codegen.CType.Pool,561 ctype_pool: codegen.CType.Pool,
562 ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .{},562 ctype_global_from_decl_map: std.ArrayListUnmanaged(codegen.CType) = .empty,
563 ctypes_buf: std.ArrayListUnmanaged(u8) = .{},563 ctypes_buf: std.ArrayListUnmanaged(u8) = .empty,
564564
565 lazy_ctype_pool: codegen.CType.Pool,565 lazy_ctype_pool: codegen.CType.Pool,
566 lazy_fns: LazyFns = .{},566 lazy_fns: LazyFns = .{},
567567
568 asm_buf: std.ArrayListUnmanaged(u8) = .{},568 asm_buf: std.ArrayListUnmanaged(u8) = .empty,
569569
570 /// We collect a list of buffers to write, and write them all at once with pwritev 😎570 /// We collect a list of buffers to write, and write them all at once with pwritev 😎
571 all_buffers: std.ArrayListUnmanaged(std.posix.iovec_const) = .{},571 all_buffers: std.ArrayListUnmanaged(std.posix.iovec_const) = .empty,
572 /// Keeps track of the total bytes of `all_buffers`.572 /// Keeps track of the total bytes of `all_buffers`.
573 file_size: u64 = 0,573 file_size: u64 = 0,
574574
src/link/Coff.zig+13-13
...@@ -26,7 +26,7 @@ repro: bool,...@@ -26,7 +26,7 @@ repro: bool,
26ptr_width: PtrWidth,26ptr_width: PtrWidth,
27page_size: u32,27page_size: u32,
2828
29objects: std.ArrayListUnmanaged(Object) = .{},29objects: std.ArrayListUnmanaged(Object) = .empty,
3030
31sections: std.MultiArrayList(Section) = .{},31sections: std.MultiArrayList(Section) = .{},
32data_directories: [coff.IMAGE_NUMBEROF_DIRECTORY_ENTRIES]coff.ImageDataDirectory,32data_directories: [coff.IMAGE_NUMBEROF_DIRECTORY_ENTRIES]coff.ImageDataDirectory,
...@@ -38,14 +38,14 @@ data_section_index: ?u16 = null,...@@ -38,14 +38,14 @@ data_section_index: ?u16 = null,
38reloc_section_index: ?u16 = null,38reloc_section_index: ?u16 = null,
39idata_section_index: ?u16 = null,39idata_section_index: ?u16 = null,
4040
41locals: std.ArrayListUnmanaged(coff.Symbol) = .{},41locals: std.ArrayListUnmanaged(coff.Symbol) = .empty,
42globals: std.ArrayListUnmanaged(SymbolWithLoc) = .{},42globals: std.ArrayListUnmanaged(SymbolWithLoc) = .empty,
43resolver: std.StringHashMapUnmanaged(u32) = .{},43resolver: std.StringHashMapUnmanaged(u32) = .empty,
44unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .{},44unresolved: std.AutoArrayHashMapUnmanaged(u32, bool) = .empty,
45need_got_table: std.AutoHashMapUnmanaged(u32, void) = .{},45need_got_table: std.AutoHashMapUnmanaged(u32, void) = .empty,
4646
47locals_free_list: std.ArrayListUnmanaged(u32) = .{},47locals_free_list: std.ArrayListUnmanaged(u32) = .empty,
48globals_free_list: std.ArrayListUnmanaged(u32) = .{},48globals_free_list: std.ArrayListUnmanaged(u32) = .empty,
4949
50strtab: StringTable = .{},50strtab: StringTable = .{},
51strtab_offset: ?u32 = null,51strtab_offset: ?u32 = null,
...@@ -56,7 +56,7 @@ got_table: TableSection(SymbolWithLoc) = .{},...@@ -56,7 +56,7 @@ got_table: TableSection(SymbolWithLoc) = .{},
5656
57/// A table of ImportTables partitioned by the library name.57/// A table of ImportTables partitioned by the library name.
58/// Key is an offset into the interning string table `temp_strtab`.58/// Key is an offset into the interning string table `temp_strtab`.
59import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .{},59import_tables: std.AutoArrayHashMapUnmanaged(u32, ImportTable) = .empty,
6060
61got_table_count_dirty: bool = true,61got_table_count_dirty: bool = true,
62got_table_contents_dirty: bool = true,62got_table_contents_dirty: bool = true,
...@@ -69,10 +69,10 @@ lazy_syms: LazySymbolTable = .{},...@@ -69,10 +69,10 @@ lazy_syms: LazySymbolTable = .{},
69navs: NavTable = .{},69navs: NavTable = .{},
7070
71/// List of atoms that are either synthetic or map directly to the Zig source program.71/// List of atoms that are either synthetic or map directly to the Zig source program.
72atoms: std.ArrayListUnmanaged(Atom) = .{},72atoms: std.ArrayListUnmanaged(Atom) = .empty,
7373
74/// Table of atoms indexed by the symbol index.74/// Table of atoms indexed by the symbol index.
75atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{},75atom_by_index_table: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty,
7676
77uavs: UavTable = .{},77uavs: UavTable = .{},
7878
...@@ -131,7 +131,7 @@ const Section = struct {...@@ -131,7 +131,7 @@ const Section = struct {
131 /// overcapacity can be negative. A simple way to have negative overcapacity is to131 /// overcapacity can be negative. A simple way to have negative overcapacity is to
132 /// allocate a fresh atom, which will have ideal capacity, and then grow it132 /// allocate a fresh atom, which will have ideal capacity, and then grow it
133 /// by 1 byte. It will then have -1 overcapacity.133 /// by 1 byte. It will then have -1 overcapacity.
134 free_list: std.ArrayListUnmanaged(Atom.Index) = .{},134 free_list: std.ArrayListUnmanaged(Atom.Index) = .empty,
135};135};
136136
137const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata);137const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata);
...@@ -148,7 +148,7 @@ const AvMetadata = struct {...@@ -148,7 +148,7 @@ const AvMetadata = struct {
148 atom: Atom.Index,148 atom: Atom.Index,
149 section: u16,149 section: u16,
150 /// A list of all exports aliases of this Decl.150 /// A list of all exports aliases of this Decl.
151 exports: std.ArrayListUnmanaged(u32) = .{},151 exports: std.ArrayListUnmanaged(u32) = .empty,
152152
153 fn deinit(m: *AvMetadata, allocator: Allocator) void {153 fn deinit(m: *AvMetadata, allocator: Allocator) void {
154 m.exports.deinit(allocator);154 m.exports.deinit(allocator);
src/link/Coff/ImportTable.zig+3-3
...@@ -26,9 +26,9 @@...@@ -26,9 +26,9 @@
26//! DLL#2 name26//! DLL#2 name
27//! --- END27//! --- END
2828
29entries: std.ArrayListUnmanaged(SymbolWithLoc) = .{},29entries: std.ArrayListUnmanaged(SymbolWithLoc) = .empty,
30free_list: std.ArrayListUnmanaged(u32) = .{},30free_list: std.ArrayListUnmanaged(u32) = .empty,
31lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .{},31lookup: std.AutoHashMapUnmanaged(SymbolWithLoc, u32) = .empty,
3232
33pub fn deinit(itab: *ImportTable, allocator: Allocator) void {33pub fn deinit(itab: *ImportTable, allocator: Allocator) void {
34 itab.entries.deinit(allocator);34 itab.entries.deinit(allocator);
src/link/Elf.zig+19-19
...@@ -39,11 +39,11 @@ files: std.MultiArrayList(File.Entry) = .{},...@@ -39,11 +39,11 @@ files: std.MultiArrayList(File.Entry) = .{},
39/// Long-lived list of all file descriptors.39/// Long-lived list of all file descriptors.
40/// We store them globally rather than per actual File so that we can re-use40/// We store them globally rather than per actual File so that we can re-use
41/// one file handle per every object file within an archive.41/// one file handle per every object file within an archive.
42file_handles: std.ArrayListUnmanaged(File.Handle) = .{},42file_handles: std.ArrayListUnmanaged(File.Handle) = .empty,
43zig_object_index: ?File.Index = null,43zig_object_index: ?File.Index = null,
44linker_defined_index: ?File.Index = null,44linker_defined_index: ?File.Index = null,
45objects: std.ArrayListUnmanaged(File.Index) = .{},45objects: std.ArrayListUnmanaged(File.Index) = .empty,
46shared_objects: std.ArrayListUnmanaged(File.Index) = .{},46shared_objects: std.ArrayListUnmanaged(File.Index) = .empty,
4747
48/// List of all output sections and their associated metadata.48/// List of all output sections and their associated metadata.
49sections: std.MultiArrayList(Section) = .{},49sections: std.MultiArrayList(Section) = .{},
...@@ -52,7 +52,7 @@ shdr_table_offset: ?u64 = null,...@@ -52,7 +52,7 @@ shdr_table_offset: ?u64 = null,
5252
53/// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write.53/// Stored in native-endian format, depending on target endianness needs to be bswapped on read/write.
54/// Same order as in the file.54/// Same order as in the file.
55phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .{},55phdrs: std.ArrayListUnmanaged(elf.Elf64_Phdr) = .empty,
5656
57/// Special program headers57/// Special program headers
58/// PT_PHDR58/// PT_PHDR
...@@ -77,23 +77,23 @@ page_size: u32,...@@ -77,23 +77,23 @@ page_size: u32,
77default_sym_version: elf.Elf64_Versym,77default_sym_version: elf.Elf64_Versym,
7878
79/// .shstrtab buffer79/// .shstrtab buffer
80shstrtab: std.ArrayListUnmanaged(u8) = .{},80shstrtab: std.ArrayListUnmanaged(u8) = .empty,
81/// .symtab buffer81/// .symtab buffer
82symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{},82symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty,
83/// .strtab buffer83/// .strtab buffer
84strtab: std.ArrayListUnmanaged(u8) = .{},84strtab: std.ArrayListUnmanaged(u8) = .empty,
85/// Dynamic symbol table. Only populated and emitted when linking dynamically.85/// Dynamic symbol table. Only populated and emitted when linking dynamically.
86dynsym: DynsymSection = .{},86dynsym: DynsymSection = .{},
87/// .dynstrtab buffer87/// .dynstrtab buffer
88dynstrtab: std.ArrayListUnmanaged(u8) = .{},88dynstrtab: std.ArrayListUnmanaged(u8) = .empty,
89/// Version symbol table. Only populated and emitted when linking dynamically.89/// Version symbol table. Only populated and emitted when linking dynamically.
90versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{},90versym: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty,
91/// .verneed section91/// .verneed section
92verneed: VerneedSection = .{},92verneed: VerneedSection = .{},
93/// .got section93/// .got section
94got: GotSection = .{},94got: GotSection = .{},
95/// .rela.dyn section95/// .rela.dyn section
96rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{},96rela_dyn: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty,
97/// .dynamic section97/// .dynamic section
98dynamic: DynamicSection = .{},98dynamic: DynamicSection = .{},
99/// .hash section99/// .hash section
...@@ -109,10 +109,10 @@ plt_got: PltGotSection = .{},...@@ -109,10 +109,10 @@ plt_got: PltGotSection = .{},
109/// .copyrel section109/// .copyrel section
110copy_rel: CopyRelSection = .{},110copy_rel: CopyRelSection = .{},
111/// .rela.plt section111/// .rela.plt section
112rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{},112rela_plt: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty,
113/// SHT_GROUP sections113/// SHT_GROUP sections
114/// Applies only to a relocatable.114/// Applies only to a relocatable.
115comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .{},115comdat_group_sections: std.ArrayListUnmanaged(ComdatGroupSection) = .empty,
116116
117copy_rel_section_index: ?u32 = null,117copy_rel_section_index: ?u32 = null,
118dynamic_section_index: ?u32 = null,118dynamic_section_index: ?u32 = null,
...@@ -143,10 +143,10 @@ has_text_reloc: bool = false,...@@ -143,10 +143,10 @@ has_text_reloc: bool = false,
143num_ifunc_dynrelocs: usize = 0,143num_ifunc_dynrelocs: usize = 0,
144144
145/// List of range extension thunks.145/// List of range extension thunks.
146thunks: std.ArrayListUnmanaged(Thunk) = .{},146thunks: std.ArrayListUnmanaged(Thunk) = .empty,
147147
148/// List of output merge sections with deduped contents.148/// List of output merge sections with deduped contents.
149merge_sections: std.ArrayListUnmanaged(MergeSection) = .{},149merge_sections: std.ArrayListUnmanaged(MergeSection) = .empty,
150150
151first_eflags: ?elf.Elf64_Word = null,151first_eflags: ?elf.Elf64_Word = null,
152152
...@@ -5487,9 +5487,9 @@ pub const Ref = struct {...@@ -5487,9 +5487,9 @@ pub const Ref = struct {
5487};5487};
54885488
5489pub const SymbolResolver = struct {5489pub const SymbolResolver = struct {
5490 keys: std.ArrayListUnmanaged(Key) = .{},5490 keys: std.ArrayListUnmanaged(Key) = .empty,
5491 values: std.ArrayListUnmanaged(Ref) = .{},5491 values: std.ArrayListUnmanaged(Ref) = .empty,
5492 table: std.AutoArrayHashMapUnmanaged(void, void) = .{},5492 table: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
54935493
5494 const Result = struct {5494 const Result = struct {
5495 found_existing: bool,5495 found_existing: bool,
...@@ -5586,7 +5586,7 @@ const Section = struct {...@@ -5586,7 +5586,7 @@ const Section = struct {
5586 /// List of atoms contributing to this section.5586 /// List of atoms contributing to this section.
5587 /// TODO currently this is only used for relocations tracking in relocatable mode5587 /// TODO currently this is only used for relocations tracking in relocatable mode
5588 /// but will be merged with atom_list_2.5588 /// but will be merged with atom_list_2.
5589 atom_list: std.ArrayListUnmanaged(Ref) = .{},5589 atom_list: std.ArrayListUnmanaged(Ref) = .empty,
55905590
5591 /// List of atoms contributing to this section.5591 /// List of atoms contributing to this section.
5592 /// This can be used by sections that require special handling such as init/fini array, etc.5592 /// This can be used by sections that require special handling such as init/fini array, etc.
...@@ -5610,7 +5610,7 @@ const Section = struct {...@@ -5610,7 +5610,7 @@ const Section = struct {
5610 /// overcapacity can be negative. A simple way to have negative overcapacity is to5610 /// overcapacity can be negative. A simple way to have negative overcapacity is to
5611 /// allocate a fresh text block, which will have ideal capacity, and then grow it5611 /// allocate a fresh text block, which will have ideal capacity, and then grow it
5612 /// by 1 byte. It will then have -1 overcapacity.5612 /// by 1 byte. It will then have -1 overcapacity.
5613 free_list: std.ArrayListUnmanaged(Ref) = .{},5613 free_list: std.ArrayListUnmanaged(Ref) = .empty,
5614};5614};
56155615
5616fn defaultEntrySymbolName(cpu_arch: std.Target.Cpu.Arch) []const u8 {5616fn defaultEntrySymbolName(cpu_arch: std.Target.Cpu.Arch) []const u8 {
src/link/Elf/Archive.zig+4-4
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1objects: std.ArrayListUnmanaged(Object) = .{},1objects: std.ArrayListUnmanaged(Object) = .empty,
2strtab: std.ArrayListUnmanaged(u8) = .{},2strtab: std.ArrayListUnmanaged(u8) = .empty,
33
4pub fn isArchive(path: []const u8) !bool {4pub fn isArchive(path: []const u8) !bool {
5 const file = try std.fs.cwd().openFile(path, .{});5 const file = try std.fs.cwd().openFile(path, .{});
...@@ -127,7 +127,7 @@ const strtab_delimiter = '\n';...@@ -127,7 +127,7 @@ const strtab_delimiter = '\n';
127pub const max_member_name_len = 15;127pub const max_member_name_len = 15;
128128
129pub const ArSymtab = struct {129pub const ArSymtab = struct {
130 symtab: std.ArrayListUnmanaged(Entry) = .{},130 symtab: std.ArrayListUnmanaged(Entry) = .empty,
131 strtab: StringTable = .{},131 strtab: StringTable = .{},
132132
133 pub fn deinit(ar: *ArSymtab, allocator: Allocator) void {133 pub fn deinit(ar: *ArSymtab, allocator: Allocator) void {
...@@ -241,7 +241,7 @@ pub const ArSymtab = struct {...@@ -241,7 +241,7 @@ pub const ArSymtab = struct {
241};241};
242242
243pub const ArStrtab = struct {243pub const ArStrtab = struct {
244 buffer: std.ArrayListUnmanaged(u8) = .{},244 buffer: std.ArrayListUnmanaged(u8) = .empty,
245245
246 pub fn deinit(ar: *ArStrtab, allocator: Allocator) void {246 pub fn deinit(ar: *ArStrtab, allocator: Allocator) void {
247 ar.buffer.deinit(allocator);247 ar.buffer.deinit(allocator);
src/link/Elf/AtomList.zig+1-1
...@@ -2,7 +2,7 @@ value: i64 = 0,...@@ -2,7 +2,7 @@ value: i64 = 0,
2size: u64 = 0,2size: u64 = 0,
3alignment: Atom.Alignment = .@"1",3alignment: Atom.Alignment = .@"1",
4output_section_index: u32 = 0,4output_section_index: u32 = 0,
5atoms: std.ArrayListUnmanaged(Elf.Ref) = .{},5atoms: std.ArrayListUnmanaged(Elf.Ref) = .empty,
66
7pub fn deinit(list: *AtomList, allocator: Allocator) void {7pub fn deinit(list: *AtomList, allocator: Allocator) void {
8 list.atoms.deinit(allocator);8 list.atoms.deinit(allocator);
src/link/Elf/LdScript.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1path: []const u8,1path: []const u8,
2cpu_arch: ?std.Target.Cpu.Arch = null,2cpu_arch: ?std.Target.Cpu.Arch = null,
3args: std.ArrayListUnmanaged(Elf.SystemLib) = .{},3args: std.ArrayListUnmanaged(Elf.SystemLib) = .empty,
44
5pub fn deinit(scr: *LdScript, allocator: Allocator) void {5pub fn deinit(scr: *LdScript, allocator: Allocator) void {
6 scr.args.deinit(allocator);6 scr.args.deinit(allocator);
src/link/Elf/LinkerDefined.zig+6-6
...@@ -1,11 +1,11 @@...@@ -1,11 +1,11 @@
1index: File.Index,1index: File.Index,
22
3symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{},3symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty,
4strtab: std.ArrayListUnmanaged(u8) = .{},4strtab: std.ArrayListUnmanaged(u8) = .empty,
55
6symbols: std.ArrayListUnmanaged(Symbol) = .{},6symbols: std.ArrayListUnmanaged(Symbol) = .empty,
7symbols_extra: std.ArrayListUnmanaged(u32) = .{},7symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
8symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{},8symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty,
99
10entry_index: ?Symbol.Index = null,10entry_index: ?Symbol.Index = null,
11dynamic_index: ?Symbol.Index = null,11dynamic_index: ?Symbol.Index = null,
...@@ -24,7 +24,7 @@ dso_handle_index: ?Symbol.Index = null,...@@ -24,7 +24,7 @@ dso_handle_index: ?Symbol.Index = null,
24rela_iplt_start_index: ?Symbol.Index = null,24rela_iplt_start_index: ?Symbol.Index = null,
25rela_iplt_end_index: ?Symbol.Index = null,25rela_iplt_end_index: ?Symbol.Index = null,
26global_pointer_index: ?Symbol.Index = null,26global_pointer_index: ?Symbol.Index = null,
27start_stop_indexes: std.ArrayListUnmanaged(u32) = .{},27start_stop_indexes: std.ArrayListUnmanaged(u32) = .empty,
2828
29output_symtab_ctx: Elf.SymtabCtx = .{},29output_symtab_ctx: Elf.SymtabCtx = .{},
3030
src/link/Elf/Object.zig+17-17
...@@ -4,29 +4,29 @@ file_handle: File.HandleIndex,...@@ -4,29 +4,29 @@ file_handle: File.HandleIndex,
4index: File.Index,4index: File.Index,
55
6header: ?elf.Elf64_Ehdr = null,6header: ?elf.Elf64_Ehdr = null,
7shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{},7shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty,
88
9symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{},9symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty,
10strtab: std.ArrayListUnmanaged(u8) = .{},10strtab: std.ArrayListUnmanaged(u8) = .empty,
11first_global: ?Symbol.Index = null,11first_global: ?Symbol.Index = null,
12symbols: std.ArrayListUnmanaged(Symbol) = .{},12symbols: std.ArrayListUnmanaged(Symbol) = .empty,
13symbols_extra: std.ArrayListUnmanaged(u32) = .{},13symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
14symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{},14symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty,
15relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .{},15relocs: std.ArrayListUnmanaged(elf.Elf64_Rela) = .empty,
1616
17atoms: std.ArrayListUnmanaged(Atom) = .{},17atoms: std.ArrayListUnmanaged(Atom) = .empty,
18atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},18atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
19atoms_extra: std.ArrayListUnmanaged(u32) = .{},19atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
2020
21comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .{},21comdat_groups: std.ArrayListUnmanaged(Elf.ComdatGroup) = .empty,
22comdat_group_data: std.ArrayListUnmanaged(u32) = .{},22comdat_group_data: std.ArrayListUnmanaged(u32) = .empty,
2323
24input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .{},24input_merge_sections: std.ArrayListUnmanaged(InputMergeSection) = .empty,
25input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .{},25input_merge_sections_indexes: std.ArrayListUnmanaged(InputMergeSection.Index) = .empty,
2626
27fdes: std.ArrayListUnmanaged(Fde) = .{},27fdes: std.ArrayListUnmanaged(Fde) = .empty,
28cies: std.ArrayListUnmanaged(Cie) = .{},28cies: std.ArrayListUnmanaged(Cie) = .empty,
29eh_frame_data: std.ArrayListUnmanaged(u8) = .{},29eh_frame_data: std.ArrayListUnmanaged(u8) = .empty,
3030
31alive: bool = true,31alive: bool = true,
32num_dynrelocs: u32 = 0,32num_dynrelocs: u32 = 0,
src/link/Elf/SharedObject.zig+9-9
...@@ -2,20 +2,20 @@ path: []const u8,...@@ -2,20 +2,20 @@ path: []const u8,
2index: File.Index,2index: File.Index,
33
4header: ?elf.Elf64_Ehdr = null,4header: ?elf.Elf64_Ehdr = null,
5shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .{},5shdrs: std.ArrayListUnmanaged(elf.Elf64_Shdr) = .empty,
66
7symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .{},7symtab: std.ArrayListUnmanaged(elf.Elf64_Sym) = .empty,
8strtab: std.ArrayListUnmanaged(u8) = .{},8strtab: std.ArrayListUnmanaged(u8) = .empty,
9/// Version symtab contains version strings of the symbols if present.9/// Version symtab contains version strings of the symbols if present.
10versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .{},10versyms: std.ArrayListUnmanaged(elf.Elf64_Versym) = .empty,
11verstrings: std.ArrayListUnmanaged(u32) = .{},11verstrings: std.ArrayListUnmanaged(u32) = .empty,
1212
13symbols: std.ArrayListUnmanaged(Symbol) = .{},13symbols: std.ArrayListUnmanaged(Symbol) = .empty,
14symbols_extra: std.ArrayListUnmanaged(u32) = .{},14symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
15symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{},15symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty,
1616
17aliases: ?std.ArrayListUnmanaged(u32) = null,17aliases: ?std.ArrayListUnmanaged(u32) = null,
18dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .{},18dynamic_table: std.ArrayListUnmanaged(elf.Elf64_Dyn) = .empty,
1919
20needed: bool,20needed: bool,
21alive: bool,21alive: bool,
src/link/Elf/Thunk.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1value: i64 = 0,1value: i64 = 0,
2output_section_index: u32 = 0,2output_section_index: u32 = 0,
3symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .{},3symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .empty,
4output_symtab_ctx: Elf.SymtabCtx = .{},4output_symtab_ctx: Elf.SymtabCtx = .{},
55
6pub fn deinit(thunk: *Thunk, allocator: Allocator) void {6pub fn deinit(thunk: *Thunk, allocator: Allocator) void {
src/link/Elf/ZigObject.zig+13-13
...@@ -3,24 +3,24 @@...@@ -3,24 +3,24 @@
3//! and any relocations that may have been emitted.3//! and any relocations that may have been emitted.
4//! Think about this as fake in-memory Object file for the Zig module.4//! Think about this as fake in-memory Object file for the Zig module.
55
6data: std.ArrayListUnmanaged(u8) = .{},6data: std.ArrayListUnmanaged(u8) = .empty,
7/// Externally owned memory.7/// Externally owned memory.
8path: []const u8,8path: []const u8,
9index: File.Index,9index: File.Index,
1010
11symtab: std.MultiArrayList(ElfSym) = .{},11symtab: std.MultiArrayList(ElfSym) = .{},
12strtab: StringTable = .{},12strtab: StringTable = .{},
13symbols: std.ArrayListUnmanaged(Symbol) = .{},13symbols: std.ArrayListUnmanaged(Symbol) = .empty,
14symbols_extra: std.ArrayListUnmanaged(u32) = .{},14symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
15symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .{},15symbols_resolver: std.ArrayListUnmanaged(Elf.SymbolResolver.Index) = .empty,
16local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{},16local_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty,
17global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{},17global_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty,
18globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{},18globals_lookup: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty,
1919
20atoms: std.ArrayListUnmanaged(Atom) = .{},20atoms: std.ArrayListUnmanaged(Atom) = .empty,
21atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},21atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
22atoms_extra: std.ArrayListUnmanaged(u32) = .{},22atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
23relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .{},23relocs: std.ArrayListUnmanaged(std.ArrayListUnmanaged(elf.Elf64_Rela)) = .empty,
2424
25num_dynrelocs: u32 = 0,25num_dynrelocs: u32 = 0,
2626
...@@ -2313,7 +2313,7 @@ const LazySymbolMetadata = struct {...@@ -2313,7 +2313,7 @@ const LazySymbolMetadata = struct {
2313const AvMetadata = struct {2313const AvMetadata = struct {
2314 symbol_index: Symbol.Index,2314 symbol_index: Symbol.Index,
2315 /// A list of all exports aliases of this Av.2315 /// A list of all exports aliases of this Av.
2316 exports: std.ArrayListUnmanaged(Symbol.Index) = .{},2316 exports: std.ArrayListUnmanaged(Symbol.Index) = .empty,
2317 /// Set to true if the AV has been initialized and allocated.2317 /// Set to true if the AV has been initialized and allocated.
2318 allocated: bool = false,2318 allocated: bool = false,
23192319
src/link/Elf/merge_section.zig+7-7
...@@ -7,15 +7,15 @@ pub const MergeSection = struct {...@@ -7,15 +7,15 @@ pub const MergeSection = struct {
7 type: u32 = 0,7 type: u32 = 0,
8 flags: u64 = 0,8 flags: u64 = 0,
9 output_section_index: u32 = 0,9 output_section_index: u32 = 0,
10 bytes: std.ArrayListUnmanaged(u8) = .{},10 bytes: std.ArrayListUnmanaged(u8) = .empty,
11 table: std.HashMapUnmanaged(11 table: std.HashMapUnmanaged(
12 String,12 String,
13 MergeSubsection.Index,13 MergeSubsection.Index,
14 IndexContext,14 IndexContext,
15 std.hash_map.default_max_load_percentage,15 std.hash_map.default_max_load_percentage,
16 ) = .{},16 ) = .{},
17 subsections: std.ArrayListUnmanaged(MergeSubsection) = .{},17 subsections: std.ArrayListUnmanaged(MergeSubsection) = .empty,
18 finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{},18 finalized_subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty,
1919
20 pub fn deinit(msec: *MergeSection, allocator: Allocator) void {20 pub fn deinit(msec: *MergeSection, allocator: Allocator) void {
21 msec.bytes.deinit(allocator);21 msec.bytes.deinit(allocator);
...@@ -276,10 +276,10 @@ pub const MergeSubsection = struct {...@@ -276,10 +276,10 @@ pub const MergeSubsection = struct {
276pub const InputMergeSection = struct {276pub const InputMergeSection = struct {
277 merge_section_index: MergeSection.Index = 0,277 merge_section_index: MergeSection.Index = 0,
278 atom_index: Atom.Index = 0,278 atom_index: Atom.Index = 0,
279 offsets: std.ArrayListUnmanaged(u32) = .{},279 offsets: std.ArrayListUnmanaged(u32) = .empty,
280 subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .{},280 subsections: std.ArrayListUnmanaged(MergeSubsection.Index) = .empty,
281 bytes: std.ArrayListUnmanaged(u8) = .{},281 bytes: std.ArrayListUnmanaged(u8) = .empty,
282 strings: std.ArrayListUnmanaged(String) = .{},282 strings: std.ArrayListUnmanaged(String) = .empty,
283283
284 pub fn deinit(imsec: *InputMergeSection, allocator: Allocator) void {284 pub fn deinit(imsec: *InputMergeSection, allocator: Allocator) void {
285 imsec.offsets.deinit(allocator);285 imsec.offsets.deinit(allocator);
src/link/Elf/synthetic_sections.zig+9-9
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1pub const DynamicSection = struct {1pub const DynamicSection = struct {
2 soname: ?u32 = null,2 soname: ?u32 = null,
3 needed: std.ArrayListUnmanaged(u32) = .{},3 needed: std.ArrayListUnmanaged(u32) = .empty,
4 rpath: u32 = 0,4 rpath: u32 = 0,
55
6 pub fn deinit(dt: *DynamicSection, allocator: Allocator) void {6 pub fn deinit(dt: *DynamicSection, allocator: Allocator) void {
...@@ -226,7 +226,7 @@ pub const DynamicSection = struct {...@@ -226,7 +226,7 @@ pub const DynamicSection = struct {
226};226};
227227
228pub const GotSection = struct {228pub const GotSection = struct {
229 entries: std.ArrayListUnmanaged(Entry) = .{},229 entries: std.ArrayListUnmanaged(Entry) = .empty,
230 output_symtab_ctx: Elf.SymtabCtx = .{},230 output_symtab_ctx: Elf.SymtabCtx = .{},
231 tlsld_index: ?u32 = null,231 tlsld_index: ?u32 = null,
232 flags: Flags = .{},232 flags: Flags = .{},
...@@ -629,7 +629,7 @@ pub const GotSection = struct {...@@ -629,7 +629,7 @@ pub const GotSection = struct {
629};629};
630630
631pub const PltSection = struct {631pub const PltSection = struct {
632 symbols: std.ArrayListUnmanaged(Elf.Ref) = .{},632 symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty,
633 output_symtab_ctx: Elf.SymtabCtx = .{},633 output_symtab_ctx: Elf.SymtabCtx = .{},
634634
635 pub fn deinit(plt: *PltSection, allocator: Allocator) void {635 pub fn deinit(plt: *PltSection, allocator: Allocator) void {
...@@ -883,7 +883,7 @@ pub const GotPltSection = struct {...@@ -883,7 +883,7 @@ pub const GotPltSection = struct {
883};883};
884884
885pub const PltGotSection = struct {885pub const PltGotSection = struct {
886 symbols: std.ArrayListUnmanaged(Elf.Ref) = .{},886 symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty,
887 output_symtab_ctx: Elf.SymtabCtx = .{},887 output_symtab_ctx: Elf.SymtabCtx = .{},
888888
889 pub fn deinit(plt_got: *PltGotSection, allocator: Allocator) void {889 pub fn deinit(plt_got: *PltGotSection, allocator: Allocator) void {
...@@ -994,7 +994,7 @@ pub const PltGotSection = struct {...@@ -994,7 +994,7 @@ pub const PltGotSection = struct {
994};994};
995995
996pub const CopyRelSection = struct {996pub const CopyRelSection = struct {
997 symbols: std.ArrayListUnmanaged(Elf.Ref) = .{},997 symbols: std.ArrayListUnmanaged(Elf.Ref) = .empty,
998998
999 pub fn deinit(copy_rel: *CopyRelSection, allocator: Allocator) void {999 pub fn deinit(copy_rel: *CopyRelSection, allocator: Allocator) void {
1000 copy_rel.symbols.deinit(allocator);1000 copy_rel.symbols.deinit(allocator);
...@@ -1072,7 +1072,7 @@ pub const CopyRelSection = struct {...@@ -1072,7 +1072,7 @@ pub const CopyRelSection = struct {
1072};1072};
10731073
1074pub const DynsymSection = struct {1074pub const DynsymSection = struct {
1075 entries: std.ArrayListUnmanaged(Entry) = .{},1075 entries: std.ArrayListUnmanaged(Entry) = .empty,
10761076
1077 pub const Entry = struct {1077 pub const Entry = struct {
1078 /// Ref of the symbol which gets privilege of getting a dynamic treatment1078 /// Ref of the symbol which gets privilege of getting a dynamic treatment
...@@ -1156,7 +1156,7 @@ pub const DynsymSection = struct {...@@ -1156,7 +1156,7 @@ pub const DynsymSection = struct {
1156};1156};
11571157
1158pub const HashSection = struct {1158pub const HashSection = struct {
1159 buffer: std.ArrayListUnmanaged(u8) = .{},1159 buffer: std.ArrayListUnmanaged(u8) = .empty,
11601160
1161 pub fn deinit(hs: *HashSection, allocator: Allocator) void {1161 pub fn deinit(hs: *HashSection, allocator: Allocator) void {
1162 hs.buffer.deinit(allocator);1162 hs.buffer.deinit(allocator);
...@@ -1320,8 +1320,8 @@ pub const GnuHashSection = struct {...@@ -1320,8 +1320,8 @@ pub const GnuHashSection = struct {
1320};1320};
13211321
1322pub const VerneedSection = struct {1322pub const VerneedSection = struct {
1323 verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .{},1323 verneed: std.ArrayListUnmanaged(elf.Elf64_Verneed) = .empty,
1324 vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .{},1324 vernaux: std.ArrayListUnmanaged(elf.Elf64_Vernaux) = .empty,
1325 index: elf.Elf64_Versym = elf.VER_NDX_GLOBAL + 1,1325 index: elf.Elf64_Versym = elf.VER_NDX_GLOBAL + 1,
13261326
1327 pub fn deinit(vern: *VerneedSection, allocator: Allocator) void {1327 pub fn deinit(vern: *VerneedSection, allocator: Allocator) void {
src/link/MachO.zig+21-21
...@@ -13,21 +13,21 @@ files: std.MultiArrayList(File.Entry) = .{},...@@ -13,21 +13,21 @@ files: std.MultiArrayList(File.Entry) = .{},
13/// Long-lived list of all file descriptors.13/// Long-lived list of all file descriptors.
14/// We store them globally rather than per actual File so that we can re-use14/// We store them globally rather than per actual File so that we can re-use
15/// one file handle per every object file within an archive.15/// one file handle per every object file within an archive.
16file_handles: std.ArrayListUnmanaged(File.Handle) = .{},16file_handles: std.ArrayListUnmanaged(File.Handle) = .empty,
17zig_object: ?File.Index = null,17zig_object: ?File.Index = null,
18internal_object: ?File.Index = null,18internal_object: ?File.Index = null,
19objects: std.ArrayListUnmanaged(File.Index) = .{},19objects: std.ArrayListUnmanaged(File.Index) = .empty,
20dylibs: std.ArrayListUnmanaged(File.Index) = .{},20dylibs: std.ArrayListUnmanaged(File.Index) = .empty,
2121
22segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{},22segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty,
23sections: std.MultiArrayList(Section) = .{},23sections: std.MultiArrayList(Section) = .{},
2424
25resolver: SymbolResolver = .{},25resolver: SymbolResolver = .{},
26/// This table will be populated after `scanRelocs` has run.26/// This table will be populated after `scanRelocs` has run.
27/// Key is symbol index.27/// Key is symbol index.
28undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .{},28undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(Ref)) = .empty,
29undefs_mutex: std.Thread.Mutex = .{},29undefs_mutex: std.Thread.Mutex = .{},
30dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .{},30dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayListUnmanaged(File.Index)) = .empty,
31dupes_mutex: std.Thread.Mutex = .{},31dupes_mutex: std.Thread.Mutex = .{},
3232
33dyld_info_cmd: macho.dyld_info_command = .{},33dyld_info_cmd: macho.dyld_info_command = .{},
...@@ -52,11 +52,11 @@ eh_frame_sect_index: ?u8 = null,...@@ -52,11 +52,11 @@ eh_frame_sect_index: ?u8 = null,
52unwind_info_sect_index: ?u8 = null,52unwind_info_sect_index: ?u8 = null,
53objc_stubs_sect_index: ?u8 = null,53objc_stubs_sect_index: ?u8 = null,
5454
55thunks: std.ArrayListUnmanaged(Thunk) = .{},55thunks: std.ArrayListUnmanaged(Thunk) = .empty,
5656
57/// Output synthetic sections57/// Output synthetic sections
58symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{},58symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty,
59strtab: std.ArrayListUnmanaged(u8) = .{},59strtab: std.ArrayListUnmanaged(u8) = .empty,
60indsymtab: Indsymtab = .{},60indsymtab: Indsymtab = .{},
61got: GotSection = .{},61got: GotSection = .{},
62stubs: StubsSection = .{},62stubs: StubsSection = .{},
...@@ -4041,19 +4041,19 @@ const default_entry_symbol_name = "_main";...@@ -4041,19 +4041,19 @@ const default_entry_symbol_name = "_main";
4041const Section = struct {4041const Section = struct {
4042 header: macho.section_64,4042 header: macho.section_64,
4043 segment_id: u8,4043 segment_id: u8,
4044 atoms: std.ArrayListUnmanaged(Ref) = .{},4044 atoms: std.ArrayListUnmanaged(Ref) = .empty,
4045 free_list: std.ArrayListUnmanaged(Atom.Index) = .{},4045 free_list: std.ArrayListUnmanaged(Atom.Index) = .empty,
4046 last_atom_index: Atom.Index = 0,4046 last_atom_index: Atom.Index = 0,
4047 thunks: std.ArrayListUnmanaged(Thunk.Index) = .{},4047 thunks: std.ArrayListUnmanaged(Thunk.Index) = .empty,
4048 out: std.ArrayListUnmanaged(u8) = .{},4048 out: std.ArrayListUnmanaged(u8) = .empty,
4049 relocs: std.ArrayListUnmanaged(macho.relocation_info) = .{},4049 relocs: std.ArrayListUnmanaged(macho.relocation_info) = .empty,
4050};4050};
40514051
4052pub const LiteralPool = struct {4052pub const LiteralPool = struct {
4053 table: std.AutoArrayHashMapUnmanaged(void, void) = .{},4053 table: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
4054 keys: std.ArrayListUnmanaged(Key) = .{},4054 keys: std.ArrayListUnmanaged(Key) = .empty,
4055 values: std.ArrayListUnmanaged(MachO.Ref) = .{},4055 values: std.ArrayListUnmanaged(MachO.Ref) = .empty,
4056 data: std.ArrayListUnmanaged(u8) = .{},4056 data: std.ArrayListUnmanaged(u8) = .empty,
40574057
4058 pub fn deinit(lp: *LiteralPool, allocator: Allocator) void {4058 pub fn deinit(lp: *LiteralPool, allocator: Allocator) void {
4059 lp.table.deinit(allocator);4059 lp.table.deinit(allocator);
...@@ -4480,9 +4480,9 @@ pub const Ref = struct {...@@ -4480,9 +4480,9 @@ pub const Ref = struct {
4480};4480};
44814481
4482pub const SymbolResolver = struct {4482pub const SymbolResolver = struct {
4483 keys: std.ArrayListUnmanaged(Key) = .{},4483 keys: std.ArrayListUnmanaged(Key) = .empty,
4484 values: std.ArrayListUnmanaged(Ref) = .{},4484 values: std.ArrayListUnmanaged(Ref) = .empty,
4485 table: std.AutoArrayHashMapUnmanaged(void, void) = .{},4485 table: std.AutoArrayHashMapUnmanaged(void, void) = .empty,
44864486
4487 const Result = struct {4487 const Result = struct {
4488 found_existing: bool,4488 found_existing: bool,
src/link/MachO/Archive.zig+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1objects: std.ArrayListUnmanaged(Object) = .{},1objects: std.ArrayListUnmanaged(Object) = .empty,
22
3pub fn deinit(self: *Archive, allocator: Allocator) void {3pub fn deinit(self: *Archive, allocator: Allocator) void {
4 self.objects.deinit(allocator);4 self.objects.deinit(allocator);
...@@ -181,7 +181,7 @@ pub const ar_hdr = extern struct {...@@ -181,7 +181,7 @@ pub const ar_hdr = extern struct {
181};181};
182182
183pub const ArSymtab = struct {183pub const ArSymtab = struct {
184 entries: std.ArrayListUnmanaged(Entry) = .{},184 entries: std.ArrayListUnmanaged(Entry) = .empty,
185 strtab: StringTable = .{},185 strtab: StringTable = .{},
186186
187 pub fn deinit(ar: *ArSymtab, allocator: Allocator) void {187 pub fn deinit(ar: *ArSymtab, allocator: Allocator) void {
src/link/MachO/CodeSignature.zig+1-1
...@@ -53,7 +53,7 @@ const CodeDirectory = struct {...@@ -53,7 +53,7 @@ const CodeDirectory = struct {
53 inner: macho.CodeDirectory,53 inner: macho.CodeDirectory,
54 ident: []const u8,54 ident: []const u8,
55 special_slots: [n_special_slots][hash_size]u8,55 special_slots: [n_special_slots][hash_size]u8,
56 code_slots: std.ArrayListUnmanaged([hash_size]u8) = .{},56 code_slots: std.ArrayListUnmanaged([hash_size]u8) = .empty,
5757
58 const n_special_slots: usize = 7;58 const n_special_slots: usize = 7;
5959
src/link/MachO/DebugSymbols.zig+5-5
...@@ -4,8 +4,8 @@ file: fs.File,...@@ -4,8 +4,8 @@ file: fs.File,
4symtab_cmd: macho.symtab_command = .{},4symtab_cmd: macho.symtab_command = .{},
5uuid_cmd: macho.uuid_command = .{ .uuid = [_]u8{0} ** 16 },5uuid_cmd: macho.uuid_command = .{ .uuid = [_]u8{0} ** 16 },
66
7segments: std.ArrayListUnmanaged(macho.segment_command_64) = .{},7segments: std.ArrayListUnmanaged(macho.segment_command_64) = .empty,
8sections: std.ArrayListUnmanaged(macho.section_64) = .{},8sections: std.ArrayListUnmanaged(macho.section_64) = .empty,
99
10dwarf_segment_cmd_index: ?u8 = null,10dwarf_segment_cmd_index: ?u8 = null,
11linkedit_segment_cmd_index: ?u8 = null,11linkedit_segment_cmd_index: ?u8 = null,
...@@ -19,11 +19,11 @@ debug_line_str_section_index: ?u8 = null,...@@ -19,11 +19,11 @@ debug_line_str_section_index: ?u8 = null,
19debug_loclists_section_index: ?u8 = null,19debug_loclists_section_index: ?u8 = null,
20debug_rnglists_section_index: ?u8 = null,20debug_rnglists_section_index: ?u8 = null,
2121
22relocs: std.ArrayListUnmanaged(Reloc) = .{},22relocs: std.ArrayListUnmanaged(Reloc) = .empty,
2323
24/// Output synthetic sections24/// Output synthetic sections
25symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{},25symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty,
26strtab: std.ArrayListUnmanaged(u8) = .{},26strtab: std.ArrayListUnmanaged(u8) = .empty,
2727
28pub const Reloc = struct {28pub const Reloc = struct {
29 type: enum {29 type: enum {
src/link/MachO/Dylib.zig+7-7
...@@ -6,15 +6,15 @@ file_handle: File.HandleIndex,...@@ -6,15 +6,15 @@ file_handle: File.HandleIndex,
6tag: enum { dylib, tbd },6tag: enum { dylib, tbd },
77
8exports: std.MultiArrayList(Export) = .{},8exports: std.MultiArrayList(Export) = .{},
9strtab: std.ArrayListUnmanaged(u8) = .{},9strtab: std.ArrayListUnmanaged(u8) = .empty,
10id: ?Id = null,10id: ?Id = null,
11ordinal: u16 = 0,11ordinal: u16 = 0,
1212
13symbols: std.ArrayListUnmanaged(Symbol) = .{},13symbols: std.ArrayListUnmanaged(Symbol) = .empty,
14symbols_extra: std.ArrayListUnmanaged(u32) = .{},14symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
15globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{},15globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty,
16dependents: std.ArrayListUnmanaged(Id) = .{},16dependents: std.ArrayListUnmanaged(Id) = .empty,
17rpaths: std.StringArrayHashMapUnmanaged(void) = .{},17rpaths: std.StringArrayHashMapUnmanaged(void) = .empty,
18umbrella: File.Index,18umbrella: File.Index,
19platform: ?MachO.Platform = null,19platform: ?MachO.Platform = null,
2020
...@@ -742,7 +742,7 @@ pub const TargetMatcher = struct {...@@ -742,7 +742,7 @@ pub const TargetMatcher = struct {
742 allocator: Allocator,742 allocator: Allocator,
743 cpu_arch: std.Target.Cpu.Arch,743 cpu_arch: std.Target.Cpu.Arch,
744 platform: macho.PLATFORM,744 platform: macho.PLATFORM,
745 target_strings: std.ArrayListUnmanaged([]const u8) = .{},745 target_strings: std.ArrayListUnmanaged([]const u8) = .empty,
746746
747 pub fn init(allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM) !TargetMatcher {747 pub fn init(allocator: Allocator, cpu_arch: std.Target.Cpu.Arch, platform: macho.PLATFORM) !TargetMatcher {
748 var self = TargetMatcher{748 var self = TargetMatcher{
src/link/MachO/InternalObject.zig+13-13
...@@ -1,19 +1,19 @@...@@ -1,19 +1,19 @@
1index: File.Index,1index: File.Index,
22
3sections: std.MultiArrayList(Section) = .{},3sections: std.MultiArrayList(Section) = .{},
4atoms: std.ArrayListUnmanaged(Atom) = .{},4atoms: std.ArrayListUnmanaged(Atom) = .empty,
5atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},5atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
6atoms_extra: std.ArrayListUnmanaged(u32) = .{},6atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
7symtab: std.ArrayListUnmanaged(macho.nlist_64) = .{},7symtab: std.ArrayListUnmanaged(macho.nlist_64) = .empty,
8strtab: std.ArrayListUnmanaged(u8) = .{},8strtab: std.ArrayListUnmanaged(u8) = .empty,
9symbols: std.ArrayListUnmanaged(Symbol) = .{},9symbols: std.ArrayListUnmanaged(Symbol) = .empty,
10symbols_extra: std.ArrayListUnmanaged(u32) = .{},10symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
11globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{},11globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty,
1212
13objc_methnames: std.ArrayListUnmanaged(u8) = .{},13objc_methnames: std.ArrayListUnmanaged(u8) = .empty,
14objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64),14objc_selrefs: [@sizeOf(u64)]u8 = [_]u8{0} ** @sizeOf(u64),
1515
16force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .{},16force_undefined: std.ArrayListUnmanaged(Symbol.Index) = .empty,
17entry_index: ?Symbol.Index = null,17entry_index: ?Symbol.Index = null,
18dyld_stub_binder_index: ?Symbol.Index = null,18dyld_stub_binder_index: ?Symbol.Index = null,
19dyld_private_index: ?Symbol.Index = null,19dyld_private_index: ?Symbol.Index = null,
...@@ -21,7 +21,7 @@ objc_msg_send_index: ?Symbol.Index = null,...@@ -21,7 +21,7 @@ objc_msg_send_index: ?Symbol.Index = null,
21mh_execute_header_index: ?Symbol.Index = null,21mh_execute_header_index: ?Symbol.Index = null,
22mh_dylib_header_index: ?Symbol.Index = null,22mh_dylib_header_index: ?Symbol.Index = null,
23dso_handle_index: ?Symbol.Index = null,23dso_handle_index: ?Symbol.Index = null,
24boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .{},24boundary_symbols: std.ArrayListUnmanaged(Symbol.Index) = .empty,
2525
26output_symtab_ctx: MachO.SymtabCtx = .{},26output_symtab_ctx: MachO.SymtabCtx = .{},
2727
...@@ -849,7 +849,7 @@ fn formatSymtab(...@@ -849,7 +849,7 @@ fn formatSymtab(
849849
850const Section = struct {850const Section = struct {
851 header: macho.section_64,851 header: macho.section_64,
852 relocs: std.ArrayListUnmanaged(Relocation) = .{},852 relocs: std.ArrayListUnmanaged(Relocation) = .empty,
853 extra: Extra = .{},853 extra: Extra = .{},
854854
855 const Extra = packed struct {855 const Extra = packed struct {
src/link/MachO/Object.zig+17-17
...@@ -9,27 +9,27 @@ in_archive: ?InArchive = null,...@@ -9,27 +9,27 @@ in_archive: ?InArchive = null,
9header: ?macho.mach_header_64 = null,9header: ?macho.mach_header_64 = null,
10sections: std.MultiArrayList(Section) = .{},10sections: std.MultiArrayList(Section) = .{},
11symtab: std.MultiArrayList(Nlist) = .{},11symtab: std.MultiArrayList(Nlist) = .{},
12strtab: std.ArrayListUnmanaged(u8) = .{},12strtab: std.ArrayListUnmanaged(u8) = .empty,
1313
14symbols: std.ArrayListUnmanaged(Symbol) = .{},14symbols: std.ArrayListUnmanaged(Symbol) = .empty,
15symbols_extra: std.ArrayListUnmanaged(u32) = .{},15symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
16globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{},16globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty,
17atoms: std.ArrayListUnmanaged(Atom) = .{},17atoms: std.ArrayListUnmanaged(Atom) = .empty,
18atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},18atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
19atoms_extra: std.ArrayListUnmanaged(u32) = .{},19atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
2020
21platform: ?MachO.Platform = null,21platform: ?MachO.Platform = null,
22compile_unit: ?CompileUnit = null,22compile_unit: ?CompileUnit = null,
23stab_files: std.ArrayListUnmanaged(StabFile) = .{},23stab_files: std.ArrayListUnmanaged(StabFile) = .empty,
2424
25eh_frame_sect_index: ?u8 = null,25eh_frame_sect_index: ?u8 = null,
26compact_unwind_sect_index: ?u8 = null,26compact_unwind_sect_index: ?u8 = null,
27cies: std.ArrayListUnmanaged(Cie) = .{},27cies: std.ArrayListUnmanaged(Cie) = .empty,
28fdes: std.ArrayListUnmanaged(Fde) = .{},28fdes: std.ArrayListUnmanaged(Fde) = .empty,
29eh_frame_data: std.ArrayListUnmanaged(u8) = .{},29eh_frame_data: std.ArrayListUnmanaged(u8) = .empty,
30unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .{},30unwind_records: std.ArrayListUnmanaged(UnwindInfo.Record) = .empty,
31unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .{},31unwind_records_indexes: std.ArrayListUnmanaged(UnwindInfo.Record.Index) = .empty,
32data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .{},32data_in_code: std.ArrayListUnmanaged(macho.data_in_code_entry) = .empty,
3333
34alive: bool = true,34alive: bool = true,
35hidden: bool = false,35hidden: bool = false,
...@@ -2675,8 +2675,8 @@ fn formatPath(...@@ -2675,8 +2675,8 @@ fn formatPath(
26752675
2676const Section = struct {2676const Section = struct {
2677 header: macho.section_64,2677 header: macho.section_64,
2678 subsections: std.ArrayListUnmanaged(Subsection) = .{},2678 subsections: std.ArrayListUnmanaged(Subsection) = .empty,
2679 relocs: std.ArrayListUnmanaged(Relocation) = .{},2679 relocs: std.ArrayListUnmanaged(Relocation) = .empty,
2680};2680};
26812681
2682const Subsection = struct {2682const Subsection = struct {
...@@ -2692,7 +2692,7 @@ pub const Nlist = struct {...@@ -2692,7 +2692,7 @@ pub const Nlist = struct {
26922692
2693const StabFile = struct {2693const StabFile = struct {
2694 comp_dir: u32,2694 comp_dir: u32,
2695 stabs: std.ArrayListUnmanaged(Stab) = .{},2695 stabs: std.ArrayListUnmanaged(Stab) = .empty,
26962696
2697 fn getCompDir(sf: StabFile, object: Object) [:0]const u8 {2697 fn getCompDir(sf: StabFile, object: Object) [:0]const u8 {
2698 const nlist = object.symtab.items(.nlist)[sf.comp_dir];2698 const nlist = object.symtab.items(.nlist)[sf.comp_dir];
src/link/MachO/Thunk.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1value: u64 = 0,1value: u64 = 0,
2out_n_sect: u8 = 0,2out_n_sect: u8 = 0,
3symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .{},3symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .empty,
4output_symtab_ctx: MachO.SymtabCtx = .{},4output_symtab_ctx: MachO.SymtabCtx = .{},
55
6pub fn deinit(thunk: *Thunk, allocator: Allocator) void {6pub fn deinit(thunk: *Thunk, allocator: Allocator) void {
src/link/MachO/UnwindInfo.zig+4-4
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1/// List of all unwind records gathered from all objects and sorted1/// List of all unwind records gathered from all objects and sorted
2/// by allocated relative function address within the section.2/// by allocated relative function address within the section.
3records: std.ArrayListUnmanaged(Record.Ref) = .{},3records: std.ArrayListUnmanaged(Record.Ref) = .empty,
44
5/// List of all personalities referenced by either unwind info entries5/// List of all personalities referenced by either unwind info entries
6/// or __eh_frame entries.6/// or __eh_frame entries.
...@@ -12,11 +12,11 @@ common_encodings: [max_common_encodings]Encoding = undefined,...@@ -12,11 +12,11 @@ common_encodings: [max_common_encodings]Encoding = undefined,
12common_encodings_count: u7 = 0,12common_encodings_count: u7 = 0,
1313
14/// List of record indexes containing an LSDA pointer.14/// List of record indexes containing an LSDA pointer.
15lsdas: std.ArrayListUnmanaged(u32) = .{},15lsdas: std.ArrayListUnmanaged(u32) = .empty,
16lsdas_lookup: std.ArrayListUnmanaged(u32) = .{},16lsdas_lookup: std.ArrayListUnmanaged(u32) = .empty,
1717
18/// List of second level pages.18/// List of second level pages.
19pages: std.ArrayListUnmanaged(Page) = .{},19pages: std.ArrayListUnmanaged(Page) = .empty,
2020
21pub fn deinit(info: *UnwindInfo, allocator: Allocator) void {21pub fn deinit(info: *UnwindInfo, allocator: Allocator) void {
22 info.records.deinit(allocator);22 info.records.deinit(allocator);
src/link/MachO/ZigObject.zig+9-9
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1data: std.ArrayListUnmanaged(u8) = .{},1data: std.ArrayListUnmanaged(u8) = .empty,
2/// Externally owned memory.2/// Externally owned memory.
3path: []const u8,3path: []const u8,
4index: File.Index,4index: File.Index,
...@@ -6,15 +6,15 @@ index: File.Index,...@@ -6,15 +6,15 @@ index: File.Index,
6symtab: std.MultiArrayList(Nlist) = .{},6symtab: std.MultiArrayList(Nlist) = .{},
7strtab: StringTable = .{},7strtab: StringTable = .{},
88
9symbols: std.ArrayListUnmanaged(Symbol) = .{},9symbols: std.ArrayListUnmanaged(Symbol) = .empty,
10symbols_extra: std.ArrayListUnmanaged(u32) = .{},10symbols_extra: std.ArrayListUnmanaged(u32) = .empty,
11globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .{},11globals: std.ArrayListUnmanaged(MachO.SymbolResolver.Index) = .empty,
12/// Maps string index (so name) into nlist index for the global symbol defined within this12/// Maps string index (so name) into nlist index for the global symbol defined within this
13/// module.13/// module.
14globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .{},14globals_lookup: std.AutoHashMapUnmanaged(u32, u32) = .empty,
15atoms: std.ArrayListUnmanaged(Atom) = .{},15atoms: std.ArrayListUnmanaged(Atom) = .empty,
16atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .{},16atoms_indexes: std.ArrayListUnmanaged(Atom.Index) = .empty,
17atoms_extra: std.ArrayListUnmanaged(u32) = .{},17atoms_extra: std.ArrayListUnmanaged(u32) = .empty,
1818
19/// Table of tracked LazySymbols.19/// Table of tracked LazySymbols.
20lazy_syms: LazySymbolTable = .{},20lazy_syms: LazySymbolTable = .{},
...@@ -1786,7 +1786,7 @@ fn formatAtoms(...@@ -1786,7 +1786,7 @@ fn formatAtoms(
1786const AvMetadata = struct {1786const AvMetadata = struct {
1787 symbol_index: Symbol.Index,1787 symbol_index: Symbol.Index,
1788 /// A list of all exports aliases of this Av.1788 /// A list of all exports aliases of this Av.
1789 exports: std.ArrayListUnmanaged(Symbol.Index) = .{},1789 exports: std.ArrayListUnmanaged(Symbol.Index) = .empty,
17901790
1791 fn @"export"(m: AvMetadata, zig_object: *ZigObject, name: []const u8) ?*u32 {1791 fn @"export"(m: AvMetadata, zig_object: *ZigObject, name: []const u8) ?*u32 {
1792 for (m.exports.items) |*exp| {1792 for (m.exports.items) |*exp| {
src/link/MachO/dyld_info/Rebase.zig+2-2
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1entries: std.ArrayListUnmanaged(Entry) = .{},1entries: std.ArrayListUnmanaged(Entry) = .empty,
2buffer: std.ArrayListUnmanaged(u8) = .{},2buffer: std.ArrayListUnmanaged(u8) = .empty,
33
4pub const Entry = struct {4pub const Entry = struct {
5 offset: u64,5 offset: u64,
src/link/MachO/dyld_info/Trie.zig+3-3
...@@ -31,9 +31,9 @@...@@ -31,9 +31,9 @@
3131
32/// The root node of the trie.32/// The root node of the trie.
33root: ?Node.Index = null,33root: ?Node.Index = null,
34buffer: std.ArrayListUnmanaged(u8) = .{},34buffer: std.ArrayListUnmanaged(u8) = .empty,
35nodes: std.MultiArrayList(Node) = .{},35nodes: std.MultiArrayList(Node) = .{},
36edges: std.ArrayListUnmanaged(Edge) = .{},36edges: std.ArrayListUnmanaged(Edge) = .empty,
3737
38/// Insert a symbol into the trie, updating the prefixes in the process.38/// Insert a symbol into the trie, updating the prefixes in the process.
39/// This operation may change the layout of the trie by splicing edges in39/// This operation may change the layout of the trie by splicing edges in
...@@ -317,7 +317,7 @@ const Node = struct {...@@ -317,7 +317,7 @@ const Node = struct {
317 trie_offset: u32 = 0,317 trie_offset: u32 = 0,
318318
319 /// List of all edges originating from this node.319 /// List of all edges originating from this node.
320 edges: std.ArrayListUnmanaged(Edge.Index) = .{},320 edges: std.ArrayListUnmanaged(Edge.Index) = .empty,
321321
322 const Index = u32;322 const Index = u32;
323};323};
src/link/MachO/dyld_info/bind.zig+7-7
...@@ -17,8 +17,8 @@ pub const Entry = struct {...@@ -17,8 +17,8 @@ pub const Entry = struct {
17};17};
1818
19pub const Bind = struct {19pub const Bind = struct {
20 entries: std.ArrayListUnmanaged(Entry) = .{},20 entries: std.ArrayListUnmanaged(Entry) = .empty,
21 buffer: std.ArrayListUnmanaged(u8) = .{},21 buffer: std.ArrayListUnmanaged(u8) = .empty,
2222
23 const Self = @This();23 const Self = @This();
2424
...@@ -269,8 +269,8 @@ pub const Bind = struct {...@@ -269,8 +269,8 @@ pub const Bind = struct {
269};269};
270270
271pub const WeakBind = struct {271pub const WeakBind = struct {
272 entries: std.ArrayListUnmanaged(Entry) = .{},272 entries: std.ArrayListUnmanaged(Entry) = .empty,
273 buffer: std.ArrayListUnmanaged(u8) = .{},273 buffer: std.ArrayListUnmanaged(u8) = .empty,
274274
275 const Self = @This();275 const Self = @This();
276276
...@@ -511,9 +511,9 @@ pub const WeakBind = struct {...@@ -511,9 +511,9 @@ pub const WeakBind = struct {
511};511};
512512
513pub const LazyBind = struct {513pub const LazyBind = struct {
514 entries: std.ArrayListUnmanaged(Entry) = .{},514 entries: std.ArrayListUnmanaged(Entry) = .empty,
515 buffer: std.ArrayListUnmanaged(u8) = .{},515 buffer: std.ArrayListUnmanaged(u8) = .empty,
516 offsets: std.ArrayListUnmanaged(u32) = .{},516 offsets: std.ArrayListUnmanaged(u32) = .empty,
517517
518 const Self = @This();518 const Self = @This();
519519
src/link/MachO/synthetic.zig+5-5
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1pub const GotSection = struct {1pub const GotSection = struct {
2 symbols: std.ArrayListUnmanaged(MachO.Ref) = .{},2 symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty,
33
4 pub const Index = u32;4 pub const Index = u32;
55
...@@ -68,7 +68,7 @@ pub const GotSection = struct {...@@ -68,7 +68,7 @@ pub const GotSection = struct {
68};68};
6969
70pub const StubsSection = struct {70pub const StubsSection = struct {
71 symbols: std.ArrayListUnmanaged(MachO.Ref) = .{},71 symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty,
7272
73 pub const Index = u32;73 pub const Index = u32;
7474
...@@ -316,7 +316,7 @@ pub const LaSymbolPtrSection = struct {...@@ -316,7 +316,7 @@ pub const LaSymbolPtrSection = struct {
316};316};
317317
318pub const TlvPtrSection = struct {318pub const TlvPtrSection = struct {
319 symbols: std.ArrayListUnmanaged(MachO.Ref) = .{},319 symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty,
320320
321 pub const Index = u32;321 pub const Index = u32;
322322
...@@ -388,7 +388,7 @@ pub const TlvPtrSection = struct {...@@ -388,7 +388,7 @@ pub const TlvPtrSection = struct {
388};388};
389389
390pub const ObjcStubsSection = struct {390pub const ObjcStubsSection = struct {
391 symbols: std.ArrayListUnmanaged(MachO.Ref) = .{},391 symbols: std.ArrayListUnmanaged(MachO.Ref) = .empty,
392392
393 pub fn deinit(objc: *ObjcStubsSection, allocator: Allocator) void {393 pub fn deinit(objc: *ObjcStubsSection, allocator: Allocator) void {
394 objc.symbols.deinit(allocator);394 objc.symbols.deinit(allocator);
...@@ -548,7 +548,7 @@ pub const Indsymtab = struct {...@@ -548,7 +548,7 @@ pub const Indsymtab = struct {
548};548};
549549
550pub const DataInCode = struct {550pub const DataInCode = struct {
551 entries: std.ArrayListUnmanaged(Entry) = .{},551 entries: std.ArrayListUnmanaged(Entry) = .empty,
552552
553 pub fn deinit(dice: *DataInCode, allocator: Allocator) void {553 pub fn deinit(dice: *DataInCode, allocator: Allocator) void {
554 dice.entries.deinit(allocator);554 dice.entries.deinit(allocator);
src/link/Plan9.zig+12-12
...@@ -34,13 +34,13 @@ bases: Bases,...@@ -34,13 +34,13 @@ bases: Bases,
34/// Does not represent the order or amount of symbols in the file34/// Does not represent the order or amount of symbols in the file
35/// it is just useful for storing symbols. Some other symbols are in35/// it is just useful for storing symbols. Some other symbols are in
36/// file_segments.36/// file_segments.
37syms: std.ArrayListUnmanaged(aout.Sym) = .{},37syms: std.ArrayListUnmanaged(aout.Sym) = .empty,
3838
39/// The plan9 a.out format requires segments of39/// The plan9 a.out format requires segments of
40/// filenames to be deduplicated, so we use this map to40/// filenames to be deduplicated, so we use this map to
41/// de duplicate it. The value is the value of the path41/// de duplicate it. The value is the value of the path
42/// component42/// component
43file_segments: std.StringArrayHashMapUnmanaged(u16) = .{},43file_segments: std.StringArrayHashMapUnmanaged(u16) = .empty,
44/// The value of a 'f' symbol increments by 1 every time, so that no 2 'f'44/// The value of a 'f' symbol increments by 1 every time, so that no 2 'f'
45/// symbols have the same value.45/// symbols have the same value.
46file_segments_i: u16 = 1,46file_segments_i: u16 = 1,
...@@ -54,19 +54,19 @@ path_arena: std.heap.ArenaAllocator,...@@ -54,19 +54,19 @@ path_arena: std.heap.ArenaAllocator,
54/// If we group the decls by file, it makes it really easy to do this (put the symbol in the correct place)54/// If we group the decls by file, it makes it really easy to do this (put the symbol in the correct place)
55fn_nav_table: std.AutoArrayHashMapUnmanaged(55fn_nav_table: std.AutoArrayHashMapUnmanaged(
56 Zcu.File.Index,56 Zcu.File.Index,
57 struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, FnNavOutput) = .{} },57 struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, FnNavOutput) = .empty },
58) = .{},58) = .{},
59/// the code is modified when relocated, so that is why it is mutable59/// the code is modified when relocated, so that is why it is mutable
60data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .{},60data_nav_table: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u8) = .empty,
61/// When `updateExports` is called, we store the export indices here, to be used61/// When `updateExports` is called, we store the export indices here, to be used
62/// during flush.62/// during flush.
63nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .{},63nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, []u32) = .empty,
6464
65lazy_syms: LazySymbolTable = .{},65lazy_syms: LazySymbolTable = .{},
6666
67uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .{},67uavs: std.AutoHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty,
6868
69relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .{},69relocs: std.AutoHashMapUnmanaged(Atom.Index, std.ArrayListUnmanaged(Reloc)) = .empty,
70hdr: aout.ExecHdr = undefined,70hdr: aout.ExecHdr = undefined,
7171
72// relocs: std.72// relocs: std.
...@@ -77,12 +77,12 @@ entry_val: ?u64 = null,...@@ -77,12 +77,12 @@ entry_val: ?u64 = null,
77got_len: usize = 0,77got_len: usize = 0,
78// A list of all the free got indexes, so when making a new decl78// A list of all the free got indexes, so when making a new decl
79// don't make a new one, just use one from here.79// don't make a new one, just use one from here.
80got_index_free_list: std.ArrayListUnmanaged(usize) = .{},80got_index_free_list: std.ArrayListUnmanaged(usize) = .empty,
8181
82syms_index_free_list: std.ArrayListUnmanaged(usize) = .{},82syms_index_free_list: std.ArrayListUnmanaged(usize) = .empty,
8383
84atoms: std.ArrayListUnmanaged(Atom) = .{},84atoms: std.ArrayListUnmanaged(Atom) = .empty,
85navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .{},85navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavMetadata) = .empty,
8686
87/// Indices of the three "special" symbols into atoms87/// Indices of the three "special" symbols into atoms
88etext_edata_end_atom_indices: [3]?Atom.Index = .{ null, null, null },88etext_edata_end_atom_indices: [3]?Atom.Index = .{ null, null, null },
...@@ -220,7 +220,7 @@ pub const DebugInfoOutput = struct {...@@ -220,7 +220,7 @@ pub const DebugInfoOutput = struct {
220220
221const NavMetadata = struct {221const NavMetadata = struct {
222 index: Atom.Index,222 index: Atom.Index,
223 exports: std.ArrayListUnmanaged(usize) = .{},223 exports: std.ArrayListUnmanaged(usize) = .empty,
224224
225 fn getExport(m: NavMetadata, p9: *const Plan9, name: []const u8) ?usize {225 fn getExport(m: NavMetadata, p9: *const Plan9, name: []const u8) ?usize {
226 for (m.exports.items) |exp| {226 for (m.exports.items) |exp| {
src/link/SpirV/BinaryModule.zig+1-1
...@@ -148,7 +148,7 @@ pub const Parser = struct {...@@ -148,7 +148,7 @@ pub const Parser = struct {
148 a: Allocator,148 a: Allocator,
149149
150 /// Maps (instruction set, opcode) => instruction index (for instruction set)150 /// Maps (instruction set, opcode) => instruction index (for instruction set)
151 opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .{},151 opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .empty,
152152
153 pub fn init(a: Allocator) !Parser {153 pub fn init(a: Allocator) !Parser {
154 var self = Parser{154 var self = Parser{
src/link/SpirV/deduplicate.zig+2-2
...@@ -178,8 +178,8 @@ const ModuleInfo = struct {...@@ -178,8 +178,8 @@ const ModuleInfo = struct {
178178
179const EntityContext = struct {179const EntityContext = struct {
180 a: Allocator,180 a: Allocator,
181 ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{},181 ptr_map_a: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty,
182 ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .{},182 ptr_map_b: std.AutoArrayHashMapUnmanaged(ResultId, void) = .empty,
183 info: *const ModuleInfo,183 info: *const ModuleInfo,
184 binary: *const BinaryModule,184 binary: *const BinaryModule,
185185
src/link/SpirV/lower_invocation_globals.zig+2-2
...@@ -342,9 +342,9 @@ const ModuleBuilder = struct {...@@ -342,9 +342,9 @@ const ModuleBuilder = struct {
342 entry_point_new_id_base: u32,342 entry_point_new_id_base: u32,
343 /// A set of all function types in the new program. SPIR-V mandates that these are unique,343 /// A set of all function types in the new program. SPIR-V mandates that these are unique,
344 /// and until a general type deduplication pass is programmed, we just handle it here via this.344 /// and until a general type deduplication pass is programmed, we just handle it here via this.
345 function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .{},345 function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .empty,
346 /// Maps functions to new information required for creating the module346 /// Maps functions to new information required for creating the module
347 function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .{},347 function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .empty,
348 /// Offset of the functions section in the new binary.348 /// Offset of the functions section in the new binary.
349 new_functions_section: ?usize,349 new_functions_section: ?usize,
350350
src/link/StringTable.zig+2-2
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1buffer: std.ArrayListUnmanaged(u8) = .{},1buffer: std.ArrayListUnmanaged(u8) = .empty,
2table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .{},2table: std.HashMapUnmanaged(u32, void, StringIndexContext, std.hash_map.default_max_load_percentage) = .empty,
33
4pub fn deinit(self: *Self, gpa: Allocator) void {4pub fn deinit(self: *Self, gpa: Allocator) void {
5 self.buffer.deinit(gpa);5 self.buffer.deinit(gpa);
src/link/Wasm.zig+23-23
...@@ -72,11 +72,11 @@ files: std.MultiArrayList(File.Entry) = .{},...@@ -72,11 +72,11 @@ files: std.MultiArrayList(File.Entry) = .{},
72/// TODO: Allow setting this through a flag?72/// TODO: Allow setting this through a flag?
73host_name: []const u8 = "env",73host_name: []const u8 = "env",
74/// List of symbols generated by the linker.74/// List of symbols generated by the linker.
75synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .{},75synthetic_symbols: std.ArrayListUnmanaged(Symbol) = .empty,
76/// Maps atoms to their segment index76/// Maps atoms to their segment index
77atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .{},77atoms: std.AutoHashMapUnmanaged(u32, Atom.Index) = .empty,
78/// List of all atoms.78/// List of all atoms.
79managed_atoms: std.ArrayListUnmanaged(Atom) = .{},79managed_atoms: std.ArrayListUnmanaged(Atom) = .empty,
80/// Represents the index into `segments` where the 'code' section80/// Represents the index into `segments` where the 'code' section
81/// lives.81/// lives.
82code_section_index: ?u32 = null,82code_section_index: ?u32 = null,
...@@ -106,22 +106,22 @@ imported_globals_count: u32 = 0,...@@ -106,22 +106,22 @@ imported_globals_count: u32 = 0,
106/// to the table indexes when sections are merged.106/// to the table indexes when sections are merged.
107imported_tables_count: u32 = 0,107imported_tables_count: u32 = 0,
108/// Map of symbol locations, represented by its `types.Import`108/// Map of symbol locations, represented by its `types.Import`
109imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .{},109imports: std.AutoHashMapUnmanaged(SymbolLoc, types.Import) = .empty,
110/// Represents non-synthetic section entries.110/// Represents non-synthetic section entries.
111/// Used for code, data and custom sections.111/// Used for code, data and custom sections.
112segments: std.ArrayListUnmanaged(Segment) = .{},112segments: std.ArrayListUnmanaged(Segment) = .empty,
113/// Maps a data segment key (such as .rodata) to the index into `segments`.113/// Maps a data segment key (such as .rodata) to the index into `segments`.
114data_segments: std.StringArrayHashMapUnmanaged(u32) = .{},114data_segments: std.StringArrayHashMapUnmanaged(u32) = .empty,
115/// A table of `types.Segment` which provide meta data115/// A table of `types.Segment` which provide meta data
116/// about a data symbol such as its name where the key is116/// about a data symbol such as its name where the key is
117/// the segment index, which can be found from `data_segments`117/// the segment index, which can be found from `data_segments`
118segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .{},118segment_info: std.AutoArrayHashMapUnmanaged(u32, types.Segment) = .empty,
119/// Deduplicated string table for strings used by symbols, imports and exports.119/// Deduplicated string table for strings used by symbols, imports and exports.
120string_table: StringTable = .{},120string_table: StringTable = .{},
121121
122// Output sections122// Output sections
123/// Output type section123/// Output type section
124func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{},124func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty,
125/// Output function section where the key is the original125/// Output function section where the key is the original
126/// function index and the value is function.126/// function index and the value is function.
127/// This allows us to map multiple symbols to the same function.127/// This allows us to map multiple symbols to the same function.
...@@ -130,7 +130,7 @@ functions: std.AutoArrayHashMapUnmanaged(...@@ -130,7 +130,7 @@ functions: std.AutoArrayHashMapUnmanaged(
130 struct { func: std.wasm.Func, sym_index: Symbol.Index },130 struct { func: std.wasm.Func, sym_index: Symbol.Index },
131) = .{},131) = .{},
132/// Output global section132/// Output global section
133wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .{},133wasm_globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty,
134/// Memory section134/// Memory section
135memories: std.wasm.Memory = .{ .limits = .{135memories: std.wasm.Memory = .{ .limits = .{
136 .min = 0,136 .min = 0,
...@@ -138,12 +138,12 @@ memories: std.wasm.Memory = .{ .limits = .{...@@ -138,12 +138,12 @@ memories: std.wasm.Memory = .{ .limits = .{
138 .flags = 0,138 .flags = 0,
139} },139} },
140/// Output table section140/// Output table section
141tables: std.ArrayListUnmanaged(std.wasm.Table) = .{},141tables: std.ArrayListUnmanaged(std.wasm.Table) = .empty,
142/// Output export section142/// Output export section
143exports: std.ArrayListUnmanaged(types.Export) = .{},143exports: std.ArrayListUnmanaged(types.Export) = .empty,
144/// List of initialization functions. These must be called in order of priority144/// List of initialization functions. These must be called in order of priority
145/// by the (synthetic) __wasm_call_ctors function.145/// by the (synthetic) __wasm_call_ctors function.
146init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .{},146init_funcs: std.ArrayListUnmanaged(InitFuncLoc) = .empty,
147/// Index to a function defining the entry of the wasm file147/// Index to a function defining the entry of the wasm file
148entry: ?u32 = null,148entry: ?u32 = null,
149149
...@@ -152,31 +152,31 @@ entry: ?u32 = null,...@@ -152,31 +152,31 @@ entry: ?u32 = null,
152/// as well as an 'elements' section.152/// as well as an 'elements' section.
153///153///
154/// Note: Key is symbol location, value represents the index into the table154/// Note: Key is symbol location, value represents the index into the table
155function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .{},155function_table: std.AutoHashMapUnmanaged(SymbolLoc, u32) = .empty,
156156
157/// All object files and their data which are linked into the final binary157/// All object files and their data which are linked into the final binary
158objects: std.ArrayListUnmanaged(File.Index) = .{},158objects: std.ArrayListUnmanaged(File.Index) = .empty,
159/// All archive files that are lazy loaded.159/// All archive files that are lazy loaded.
160/// e.g. when an undefined symbol references a symbol from the archive.160/// e.g. when an undefined symbol references a symbol from the archive.
161archives: std.ArrayListUnmanaged(Archive) = .{},161archives: std.ArrayListUnmanaged(Archive) = .empty,
162162
163/// A map of global names (read: offset into string table) to their symbol location163/// A map of global names (read: offset into string table) to their symbol location
164globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .{},164globals: std.AutoHashMapUnmanaged(u32, SymbolLoc) = .empty,
165/// The list of GOT symbols and their location165/// The list of GOT symbols and their location
166got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .{},166got_symbols: std.ArrayListUnmanaged(SymbolLoc) = .empty,
167/// Maps discarded symbols and their positions to the location of the symbol167/// Maps discarded symbols and their positions to the location of the symbol
168/// it was resolved to168/// it was resolved to
169discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .{},169discarded: std.AutoHashMapUnmanaged(SymbolLoc, SymbolLoc) = .empty,
170/// List of all symbol locations which have been resolved by the linker and will be emit170/// List of all symbol locations which have been resolved by the linker and will be emit
171/// into the final binary.171/// into the final binary.
172resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .{},172resolved_symbols: std.AutoArrayHashMapUnmanaged(SymbolLoc, void) = .empty,
173/// Symbols that remain undefined after symbol resolution.173/// Symbols that remain undefined after symbol resolution.
174/// Note: The key represents an offset into the string table, rather than the actual string.174/// Note: The key represents an offset into the string table, rather than the actual string.
175undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .{},175undefs: std.AutoArrayHashMapUnmanaged(u32, SymbolLoc) = .empty,
176/// Maps a symbol's location to an atom. This can be used to find meta176/// Maps a symbol's location to an atom. This can be used to find meta
177/// data of a symbol, such as its size, or its offset to perform a relocation.177/// data of a symbol, such as its size, or its offset to perform a relocation.
178/// Undefined (and synthetic) symbols do not have an Atom and therefore cannot be mapped.178/// Undefined (and synthetic) symbols do not have an Atom and therefore cannot be mapped.
179symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .{},179symbol_atom: std.AutoHashMapUnmanaged(SymbolLoc, Atom.Index) = .empty,
180180
181pub const Alignment = types.Alignment;181pub const Alignment = types.Alignment;
182182
...@@ -287,7 +287,7 @@ pub const StringTable = struct {...@@ -287,7 +287,7 @@ pub const StringTable = struct {
287 std.hash_map.default_max_load_percentage,287 std.hash_map.default_max_load_percentage,
288 ) = .{},288 ) = .{},
289 /// Holds the actual data of the string table.289 /// Holds the actual data of the string table.
290 string_data: std.ArrayListUnmanaged(u8) = .{},290 string_data: std.ArrayListUnmanaged(u8) = .empty,
291291
292 /// Accepts a string and searches for a corresponding string.292 /// Accepts a string and searches for a corresponding string.
293 /// When found, de-duplicates the string and returns the existing offset instead.293 /// When found, de-duplicates the string and returns the existing offset instead.
...@@ -1698,7 +1698,7 @@ fn allocateVirtualAddresses(wasm: *Wasm) void {...@@ -1698,7 +1698,7 @@ fn allocateVirtualAddresses(wasm: *Wasm) void {
16981698
1699fn sortDataSegments(wasm: *Wasm) !void {1699fn sortDataSegments(wasm: *Wasm) !void {
1700 const gpa = wasm.base.comp.gpa;1700 const gpa = wasm.base.comp.gpa;
1701 var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .{};1701 var new_mapping: std.StringArrayHashMapUnmanaged(u32) = .empty;
1702 try new_mapping.ensureUnusedCapacity(gpa, wasm.data_segments.count());1702 try new_mapping.ensureUnusedCapacity(gpa, wasm.data_segments.count());
1703 errdefer new_mapping.deinit(gpa);1703 errdefer new_mapping.deinit(gpa);
17041704
src/link/Wasm/Archive.zig+1-1
...@@ -12,7 +12,7 @@ long_file_names: []const u8 = undefined,...@@ -12,7 +12,7 @@ long_file_names: []const u8 = undefined,
12/// Parsed table of contents.12/// Parsed table of contents.
13/// Each symbol name points to a list of all definition13/// Each symbol name points to a list of all definition
14/// sites within the current static archive.14/// sites within the current static archive.
15toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .{},15toc: std.StringArrayHashMapUnmanaged(std.ArrayListUnmanaged(u32)) = .empty,
1616
17// Archive files start with the ARMAG identifying string. Then follows a17// Archive files start with the ARMAG identifying string. Then follows a
18// `struct ar_hdr', and as many bytes of member file data as its `ar_size'18// `struct ar_hdr', and as many bytes of member file data as its `ar_size'
src/link/Wasm/Atom.zig+3-3
...@@ -6,9 +6,9 @@ sym_index: Symbol.Index,...@@ -6,9 +6,9 @@ sym_index: Symbol.Index,
6/// Size of the atom, used to calculate section sizes in the final binary6/// Size of the atom, used to calculate section sizes in the final binary
7size: u32 = 0,7size: u32 = 0,
8/// List of relocations belonging to this atom8/// List of relocations belonging to this atom
9relocs: std.ArrayListUnmanaged(types.Relocation) = .{},9relocs: std.ArrayListUnmanaged(types.Relocation) = .empty,
10/// Contains the binary data of an atom, which can be non-relocated10/// Contains the binary data of an atom, which can be non-relocated
11code: std.ArrayListUnmanaged(u8) = .{},11code: std.ArrayListUnmanaged(u8) = .empty,
12/// For code this is 1, for data this is set to the highest value of all segments12/// For code this is 1, for data this is set to the highest value of all segments
13alignment: Wasm.Alignment = .@"1",13alignment: Wasm.Alignment = .@"1",
14/// Offset into the section where the atom lives, this already accounts14/// Offset into the section where the atom lives, this already accounts
...@@ -22,7 +22,7 @@ original_offset: u32 = 0,...@@ -22,7 +22,7 @@ original_offset: u32 = 0,
22prev: Atom.Index = .null,22prev: Atom.Index = .null,
23/// Contains atoms local to a decl, all managed by this `Atom`.23/// Contains atoms local to a decl, all managed by this `Atom`.
24/// When the parent atom is being freed, it will also do so for all local atoms.24/// When the parent atom is being freed, it will also do so for all local atoms.
25locals: std.ArrayListUnmanaged(Atom.Index) = .{},25locals: std.ArrayListUnmanaged(Atom.Index) = .empty,
2626
27/// Represents the index of an Atom where `null` is considered27/// Represents the index of an Atom where `null` is considered
28/// an invalid atom.28/// an invalid atom.
src/link/Wasm/Object.zig+3-3
...@@ -51,7 +51,7 @@ start: ?u32 = null,...@@ -51,7 +51,7 @@ start: ?u32 = null,
51features: []const types.Feature = &.{},51features: []const types.Feature = &.{},
52/// A table that maps the relocations we must perform where the key represents52/// A table that maps the relocations we must perform where the key represents
53/// the section that the list of relocations applies to.53/// the section that the list of relocations applies to.
54relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .{},54relocations: std.AutoArrayHashMapUnmanaged(u32, []types.Relocation) = .empty,
55/// Table of symbols belonging to this Object file55/// Table of symbols belonging to this Object file
56symtable: []Symbol = &.{},56symtable: []Symbol = &.{},
57/// Extra metadata about the linking section, such as alignment of segments and their name57/// Extra metadata about the linking section, such as alignment of segments and their name
...@@ -62,7 +62,7 @@ init_funcs: []const types.InitFunc = &.{},...@@ -62,7 +62,7 @@ init_funcs: []const types.InitFunc = &.{},
62comdat_info: []const types.Comdat = &.{},62comdat_info: []const types.Comdat = &.{},
63/// Represents non-synthetic sections that can essentially be mem-cpy'd into place63/// Represents non-synthetic sections that can essentially be mem-cpy'd into place
64/// after performing relocations.64/// after performing relocations.
65relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .{},65relocatable_data: std.AutoHashMapUnmanaged(RelocatableData.Tag, []RelocatableData) = .empty,
66/// String table for all strings required by the object file, such as symbol names,66/// String table for all strings required by the object file, such as symbol names,
67/// import name, module name and export names. Each string will be deduplicated67/// import name, module name and export names. Each string will be deduplicated
68/// and returns an offset into the table.68/// and returns an offset into the table.
...@@ -379,7 +379,7 @@ fn Parser(comptime ReaderType: type) type {...@@ -379,7 +379,7 @@ fn Parser(comptime ReaderType: type) type {
379 try parser.parseFeatures(gpa);379 try parser.parseFeatures(gpa);
380 } else if (std.mem.startsWith(u8, name, ".debug")) {380 } else if (std.mem.startsWith(u8, name, ".debug")) {
381 const gop = try parser.object.relocatable_data.getOrPut(gpa, .custom);381 const gop = try parser.object.relocatable_data.getOrPut(gpa, .custom);
382 var relocatable_data: std.ArrayListUnmanaged(RelocatableData) = .{};382 var relocatable_data: std.ArrayListUnmanaged(RelocatableData) = .empty;
383 defer relocatable_data.deinit(gpa);383 defer relocatable_data.deinit(gpa);
384 if (!gop.found_existing) {384 if (!gop.found_existing) {
385 gop.value_ptr.* = &.{};385 gop.value_ptr.* = &.{};
src/link/Wasm/ZigObject.zig+15-15
...@@ -8,37 +8,37 @@ path: []const u8,...@@ -8,37 +8,37 @@ path: []const u8,
8index: File.Index,8index: File.Index,
9/// Map of all `Nav` that are currently alive.9/// Map of all `Nav` that are currently alive.
10/// Each index maps to the corresponding `NavInfo`.10/// Each index maps to the corresponding `NavInfo`.
11navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .{},11navs: std.AutoHashMapUnmanaged(InternPool.Nav.Index, NavInfo) = .empty,
12/// List of function type signatures for this Zig module.12/// List of function type signatures for this Zig module.
13func_types: std.ArrayListUnmanaged(std.wasm.Type) = .{},13func_types: std.ArrayListUnmanaged(std.wasm.Type) = .empty,
14/// List of `std.wasm.Func`. Each entry contains the function signature,14/// List of `std.wasm.Func`. Each entry contains the function signature,
15/// rather than the actual body.15/// rather than the actual body.
16functions: std.ArrayListUnmanaged(std.wasm.Func) = .{},16functions: std.ArrayListUnmanaged(std.wasm.Func) = .empty,
17/// List of indexes pointing to an entry within the `functions` list which has been removed.17/// List of indexes pointing to an entry within the `functions` list which has been removed.
18functions_free_list: std.ArrayListUnmanaged(u32) = .{},18functions_free_list: std.ArrayListUnmanaged(u32) = .empty,
19/// Map of symbol locations, represented by its `types.Import`.19/// Map of symbol locations, represented by its `types.Import`.
20imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .{},20imports: std.AutoHashMapUnmanaged(Symbol.Index, types.Import) = .empty,
21/// List of WebAssembly globals.21/// List of WebAssembly globals.
22globals: std.ArrayListUnmanaged(std.wasm.Global) = .{},22globals: std.ArrayListUnmanaged(std.wasm.Global) = .empty,
23/// Mapping between an `Atom` and its type index representing the Wasm23/// Mapping between an `Atom` and its type index representing the Wasm
24/// type of the function signature.24/// type of the function signature.
25atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .{},25atom_types: std.AutoHashMapUnmanaged(Atom.Index, u32) = .empty,
26/// List of all symbols generated by Zig code.26/// List of all symbols generated by Zig code.
27symbols: std.ArrayListUnmanaged(Symbol) = .{},27symbols: std.ArrayListUnmanaged(Symbol) = .empty,
28/// Map from symbol name offset to their index into the `symbols` list.28/// Map from symbol name offset to their index into the `symbols` list.
29global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .{},29global_syms: std.AutoHashMapUnmanaged(u32, Symbol.Index) = .empty,
30/// List of symbol indexes which are free to be used.30/// List of symbol indexes which are free to be used.
31symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .{},31symbols_free_list: std.ArrayListUnmanaged(Symbol.Index) = .empty,
32/// Extra metadata about the linking section, such as alignment of segments and their name.32/// Extra metadata about the linking section, such as alignment of segments and their name.
33segment_info: std.ArrayListUnmanaged(types.Segment) = .{},33segment_info: std.ArrayListUnmanaged(types.Segment) = .empty,
34/// List of indexes which contain a free slot in the `segment_info` list.34/// List of indexes which contain a free slot in the `segment_info` list.
35segment_free_list: std.ArrayListUnmanaged(u32) = .{},35segment_free_list: std.ArrayListUnmanaged(u32) = .empty,
36/// File encapsulated string table, used to deduplicate strings within the generated file.36/// File encapsulated string table, used to deduplicate strings within the generated file.
37string_table: StringTable = .{},37string_table: StringTable = .{},
38/// Map for storing anonymous declarations. Each anonymous decl maps to its Atom's index.38/// Map for storing anonymous declarations. Each anonymous decl maps to its Atom's index.
39uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .{},39uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Atom.Index) = .empty,
40/// List of atom indexes of functions that are generated by the backend.40/// List of atom indexes of functions that are generated by the backend.
41synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .{},41synthetic_functions: std.ArrayListUnmanaged(Atom.Index) = .empty,
42/// Represents the symbol index of the error name table42/// Represents the symbol index of the error name table
43/// When this is `null`, no code references an error using runtime `@errorName`.43/// When this is `null`, no code references an error using runtime `@errorName`.
44/// During initializion, a symbol with corresponding atom will be created that is44/// During initializion, a symbol with corresponding atom will be created that is
...@@ -88,7 +88,7 @@ debug_abbrev_index: ?u32 = null,...@@ -88,7 +88,7 @@ debug_abbrev_index: ?u32 = null,
8888
89const NavInfo = struct {89const NavInfo = struct {
90 atom: Atom.Index = .null,90 atom: Atom.Index = .null,
91 exports: std.ArrayListUnmanaged(Symbol.Index) = .{},91 exports: std.ArrayListUnmanaged(Symbol.Index) = .empty,
9292
93 fn @"export"(ni: NavInfo, zig_object: *const ZigObject, name: []const u8) ?Symbol.Index {93 fn @"export"(ni: NavInfo, zig_object: *const ZigObject, name: []const u8) ?Symbol.Index {
94 for (ni.exports.items) |sym_index| {94 for (ni.exports.items) |sym_index| {
src/link/table_section.zig+3-3
...@@ -1,8 +1,8 @@...@@ -1,8 +1,8 @@
1pub fn TableSection(comptime Entry: type) type {1pub fn TableSection(comptime Entry: type) type {
2 return struct {2 return struct {
3 entries: std.ArrayListUnmanaged(Entry) = .{},3 entries: std.ArrayListUnmanaged(Entry) = .empty,
4 free_list: std.ArrayListUnmanaged(Index) = .{},4 free_list: std.ArrayListUnmanaged(Index) = .empty,
5 lookup: std.AutoHashMapUnmanaged(Entry, Index) = .{},5 lookup: std.AutoHashMapUnmanaged(Entry, Index) = .empty,
66
7 pub fn deinit(self: *Self, allocator: Allocator) void {7 pub fn deinit(self: *Self, allocator: Allocator) void {
8 self.entries.deinit(allocator);8 self.entries.deinit(allocator);
src/link/tapi/parse.zig+4-4
...@@ -115,7 +115,7 @@ pub const Node = struct {...@@ -115,7 +115,7 @@ pub const Node = struct {
115 .start = undefined,115 .start = undefined,
116 .end = undefined,116 .end = undefined,
117 },117 },
118 values: std.ArrayListUnmanaged(Entry) = .{},118 values: std.ArrayListUnmanaged(Entry) = .empty,
119119
120 pub const base_tag: Node.Tag = .map;120 pub const base_tag: Node.Tag = .map;
121121
...@@ -161,7 +161,7 @@ pub const Node = struct {...@@ -161,7 +161,7 @@ pub const Node = struct {
161 .start = undefined,161 .start = undefined,
162 .end = undefined,162 .end = undefined,
163 },163 },
164 values: std.ArrayListUnmanaged(*Node) = .{},164 values: std.ArrayListUnmanaged(*Node) = .empty,
165165
166 pub const base_tag: Node.Tag = .list;166 pub const base_tag: Node.Tag = .list;
167167
...@@ -195,7 +195,7 @@ pub const Node = struct {...@@ -195,7 +195,7 @@ pub const Node = struct {
195 .start = undefined,195 .start = undefined,
196 .end = undefined,196 .end = undefined,
197 },197 },
198 string_value: std.ArrayListUnmanaged(u8) = .{},198 string_value: std.ArrayListUnmanaged(u8) = .empty,
199199
200 pub const base_tag: Node.Tag = .value;200 pub const base_tag: Node.Tag = .value;
201201
...@@ -227,7 +227,7 @@ pub const Tree = struct {...@@ -227,7 +227,7 @@ pub const Tree = struct {
227 source: []const u8,227 source: []const u8,
228 tokens: []Token,228 tokens: []Token,
229 line_cols: std.AutoHashMap(TokenIndex, LineCol),229 line_cols: std.AutoHashMap(TokenIndex, LineCol),
230 docs: std.ArrayListUnmanaged(*Node) = .{},230 docs: std.ArrayListUnmanaged(*Node) = .empty,
231231
232 pub fn init(allocator: Allocator) Tree {232 pub fn init(allocator: Allocator) Tree {
233 return .{233 return .{
src/main.zig+15-15
...@@ -126,7 +126,7 @@ const debug_usage = normal_usage ++...@@ -126,7 +126,7 @@ const debug_usage = normal_usage ++
126const usage = if (build_options.enable_debug_extensions) debug_usage else normal_usage;126const usage = if (build_options.enable_debug_extensions) debug_usage else normal_usage;
127const default_local_zig_cache_basename = ".zig-cache";127const default_local_zig_cache_basename = ".zig-cache";
128128
129var log_scopes: std.ArrayListUnmanaged([]const u8) = .{};129var log_scopes: std.ArrayListUnmanaged([]const u8) = .empty;
130130
131pub fn log(131pub fn log(
132 comptime level: std.log.Level,132 comptime level: std.log.Level,
...@@ -895,14 +895,14 @@ fn buildOutputType(...@@ -895,14 +895,14 @@ fn buildOutputType(
895 var linker_module_definition_file: ?[]const u8 = null;895 var linker_module_definition_file: ?[]const u8 = null;
896 var test_no_exec = false;896 var test_no_exec = false;
897 var entry: Compilation.CreateOptions.Entry = .default;897 var entry: Compilation.CreateOptions.Entry = .default;
898 var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .{};898 var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty;
899 var stack_size: ?u64 = null;899 var stack_size: ?u64 = null;
900 var image_base: ?u64 = null;900 var image_base: ?u64 = null;
901 var link_eh_frame_hdr = false;901 var link_eh_frame_hdr = false;
902 var link_emit_relocs = false;902 var link_emit_relocs = false;
903 var build_id: ?std.zig.BuildId = null;903 var build_id: ?std.zig.BuildId = null;
904 var runtime_args_start: ?usize = null;904 var runtime_args_start: ?usize = null;
905 var test_filters: std.ArrayListUnmanaged([]const u8) = .{};905 var test_filters: std.ArrayListUnmanaged([]const u8) = .empty;
906 var test_name_prefix: ?[]const u8 = null;906 var test_name_prefix: ?[]const u8 = null;
907 var test_runner_path: ?[]const u8 = null;907 var test_runner_path: ?[]const u8 = null;
908 var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena);908 var override_local_cache_dir: ?[]const u8 = try EnvVar.ZIG_LOCAL_CACHE_DIR.get(arena);
...@@ -931,12 +931,12 @@ fn buildOutputType(...@@ -931,12 +931,12 @@ fn buildOutputType(
931 var pdb_out_path: ?[]const u8 = null;931 var pdb_out_path: ?[]const u8 = null;
932 var error_limit: ?Zcu.ErrorInt = null;932 var error_limit: ?Zcu.ErrorInt = null;
933 // These are before resolving sysroot.933 // These are before resolving sysroot.
934 var extra_cflags: std.ArrayListUnmanaged([]const u8) = .{};934 var extra_cflags: std.ArrayListUnmanaged([]const u8) = .empty;
935 var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .{};935 var extra_rcflags: std.ArrayListUnmanaged([]const u8) = .empty;
936 var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .{};936 var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty;
937 var rc_includes: Compilation.RcIncludes = .any;937 var rc_includes: Compilation.RcIncludes = .any;
938 var manifest_file: ?[]const u8 = null;938 var manifest_file: ?[]const u8 = null;
939 var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .{};939 var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .empty;
940940
941 // Tracks the position in c_source_files which have already their owner populated.941 // Tracks the position in c_source_files which have already their owner populated.
942 var c_source_files_owner_index: usize = 0;942 var c_source_files_owner_index: usize = 0;
...@@ -944,7 +944,7 @@ fn buildOutputType(...@@ -944,7 +944,7 @@ fn buildOutputType(
944 var rc_source_files_owner_index: usize = 0;944 var rc_source_files_owner_index: usize = 0;
945945
946 // null means replace with the test executable binary946 // null means replace with the test executable binary
947 var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .{};947 var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .empty;
948948
949 // These get set by CLI flags and then snapshotted when a `-M` flag is949 // These get set by CLI flags and then snapshotted when a `-M` flag is
950 // encountered.950 // encountered.
...@@ -953,8 +953,8 @@ fn buildOutputType(...@@ -953,8 +953,8 @@ fn buildOutputType(
953 // These get appended to by CLI flags and then slurped when a `-M` flag953 // These get appended to by CLI flags and then slurped when a `-M` flag
954 // is encountered.954 // is encountered.
955 var cssan: ClangSearchSanitizer = .{};955 var cssan: ClangSearchSanitizer = .{};
956 var cc_argv: std.ArrayListUnmanaged([]const u8) = .{};956 var cc_argv: std.ArrayListUnmanaged([]const u8) = .empty;
957 var deps: std.ArrayListUnmanaged(CliModule.Dep) = .{};957 var deps: std.ArrayListUnmanaged(CliModule.Dep) = .empty;
958958
959 // Contains every module specified via -M. The dependencies are added959 // Contains every module specified via -M. The dependencies are added
960 // after argument parsing is completed. We use a StringArrayHashMap to make960 // after argument parsing is completed. We use a StringArrayHashMap to make
...@@ -2806,7 +2806,7 @@ fn buildOutputType(...@@ -2806,7 +2806,7 @@ fn buildOutputType(
2806 create_module.opts.emit_bin = emit_bin != .no;2806 create_module.opts.emit_bin = emit_bin != .no;
2807 create_module.opts.any_c_source_files = create_module.c_source_files.items.len != 0;2807 create_module.opts.any_c_source_files = create_module.c_source_files.items.len != 0;
28082808
2809 var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .{};2809 var builtin_modules: std.StringHashMapUnmanaged(*Package.Module) = .empty;
2810 // `builtin_modules` allocated into `arena`, so no deinit2810 // `builtin_modules` allocated into `arena`, so no deinit
2811 const main_mod = try createModule(gpa, arena, &create_module, 0, null, zig_lib_directory, &builtin_modules);2811 const main_mod = try createModule(gpa, arena, &create_module, 0, null, zig_lib_directory, &builtin_modules);
2812 for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| {2812 for (create_module.modules.keys(), create_module.modules.values()) |key, cli_mod| {
...@@ -3290,7 +3290,7 @@ fn buildOutputType(...@@ -3290,7 +3290,7 @@ fn buildOutputType(
32903290
3291 process.raiseFileDescriptorLimit();3291 process.raiseFileDescriptorLimit();
32923292
3293 var file_system_inputs: std.ArrayListUnmanaged(u8) = .{};3293 var file_system_inputs: std.ArrayListUnmanaged(u8) = .empty;
3294 defer file_system_inputs.deinit(gpa);3294 defer file_system_inputs.deinit(gpa);
32953295
3296 const comp = Compilation.create(gpa, arena, .{3296 const comp = Compilation.create(gpa, arena, .{
...@@ -5451,7 +5451,7 @@ fn jitCmd(...@@ -5451,7 +5451,7 @@ fn jitCmd(
5451 });5451 });
5452 defer thread_pool.deinit();5452 defer thread_pool.deinit();
54535453
5454 var child_argv: std.ArrayListUnmanaged([]const u8) = .{};5454 var child_argv: std.ArrayListUnmanaged([]const u8) = .empty;
5455 try child_argv.ensureUnusedCapacity(arena, args.len + 4);5455 try child_argv.ensureUnusedCapacity(arena, args.len + 4);
54565456
5457 // We want to release all the locks before executing the child process, so we make a nice5457 // We want to release all the locks before executing the child process, so we make a nice
...@@ -6553,7 +6553,7 @@ fn cmdChangelist(...@@ -6553,7 +6553,7 @@ fn cmdChangelist(
6553 process.exit(1);6553 process.exit(1);
6554 }6554 }
65556555
6556 var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{};6556 var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .empty;
6557 defer inst_map.deinit(gpa);6557 defer inst_map.deinit(gpa);
65586558
6559 try Zcu.mapOldZirToNew(gpa, old_zir, file.zir, &inst_map);6559 try Zcu.mapOldZirToNew(gpa, old_zir, file.zir, &inst_map);
...@@ -6738,7 +6738,7 @@ fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem {...@@ -6738,7 +6738,7 @@ fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem {
6738/// Silently ignore superfluous search dirs.6738/// Silently ignore superfluous search dirs.
6739/// Warn when a dir is added to multiple searchlists.6739/// Warn when a dir is added to multiple searchlists.
6740const ClangSearchSanitizer = struct {6740const ClangSearchSanitizer = struct {
6741 map: std.StringHashMapUnmanaged(Membership) = .{},6741 map: std.StringHashMapUnmanaged(Membership) = .empty,
67426742
6743 fn reset(self: *@This()) void {6743 fn reset(self: *@This()) void {
6744 self.map.clearRetainingCapacity();6744 self.map.clearRetainingCapacity();
src/register_manager.zig+1-1
...@@ -516,7 +516,7 @@ fn MockFunction(comptime Register: type) type {...@@ -516,7 +516,7 @@ fn MockFunction(comptime Register: type) type {
516 return struct {516 return struct {
517 allocator: Allocator,517 allocator: Allocator,
518 register_manager: Register.RM = .{},518 register_manager: Register.RM = .{},
519 spilled: std.ArrayListUnmanaged(Register) = .{},519 spilled: std.ArrayListUnmanaged(Register) = .empty,
520520
521 const Self = @This();521 const Self = @This();
522522
src/translate_c.zig+6-6
...@@ -27,23 +27,23 @@ pub const Context = struct {...@@ -27,23 +27,23 @@ pub const Context = struct {
27 gpa: mem.Allocator,27 gpa: mem.Allocator,
28 arena: mem.Allocator,28 arena: mem.Allocator,
29 source_manager: *clang.SourceManager,29 source_manager: *clang.SourceManager,
30 decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .{},30 decl_table: std.AutoArrayHashMapUnmanaged(usize, []const u8) = .empty,
31 alias_list: AliasList,31 alias_list: AliasList,
32 global_scope: *Scope.Root,32 global_scope: *Scope.Root,
33 clang_context: *clang.ASTContext,33 clang_context: *clang.ASTContext,
34 mangle_count: u32 = 0,34 mangle_count: u32 = 0,
35 /// Table of record decls that have been demoted to opaques.35 /// Table of record decls that have been demoted to opaques.
36 opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .{},36 opaque_demotes: std.AutoHashMapUnmanaged(usize, void) = .empty,
37 /// Table of unnamed enums and records that are child types of typedefs.37 /// Table of unnamed enums and records that are child types of typedefs.
38 unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .{},38 unnamed_typedefs: std.AutoHashMapUnmanaged(usize, []const u8) = .empty,
39 /// Needed to decide if we are parsing a typename39 /// Needed to decide if we are parsing a typename
40 typedefs: std.StringArrayHashMapUnmanaged(void) = .{},40 typedefs: std.StringArrayHashMapUnmanaged(void) = .empty,
4141
42 /// This one is different than the root scope's name table. This contains42 /// This one is different than the root scope's name table. This contains
43 /// a list of names that we found by visiting all the top level decls without43 /// a list of names that we found by visiting all the top level decls without
44 /// translating them. The other maps are updated as we translate; this one is updated44 /// translating them. The other maps are updated as we translate; this one is updated
45 /// up front in a pre-processing step.45 /// up front in a pre-processing step.
46 global_names: std.StringArrayHashMapUnmanaged(void) = .{},46 global_names: std.StringArrayHashMapUnmanaged(void) = .empty,
4747
48 /// This is similar to `global_names`, but contains names which we would48 /// This is similar to `global_names`, but contains names which we would
49 /// *like* to use, but do not strictly *have* to if they are unavailable.49 /// *like* to use, but do not strictly *have* to if they are unavailable.
...@@ -52,7 +52,7 @@ pub const Context = struct {...@@ -52,7 +52,7 @@ pub const Context = struct {
52 /// may be mangled.52 /// may be mangled.
53 /// This is distinct from `global_names` so we can detect at a type53 /// This is distinct from `global_names` so we can detect at a type
54 /// declaration whether or not the name is available.54 /// declaration whether or not the name is available.
55 weak_global_names: std.StringArrayHashMapUnmanaged(void) = .{},55 weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty,
5656
57 pattern_list: PatternList,57 pattern_list: PatternList,
5858
test/behavior/fn.zig+1-1
...@@ -415,7 +415,7 @@ test "import passed byref to function in return type" {...@@ -415,7 +415,7 @@ test "import passed byref to function in return type" {
415415
416 const S = struct {416 const S = struct {
417 fn get() @import("std").ArrayListUnmanaged(i32) {417 fn get() @import("std").ArrayListUnmanaged(i32) {
418 const x: @import("std").ArrayListUnmanaged(i32) = .{};418 const x: @import("std").ArrayListUnmanaged(i32) = .empty;
419 return x;419 return x;
420 }420 }
421 };421 };
test/compare_output.zig+3-3
...@@ -291,7 +291,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -291,7 +291,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
291 \\ stdout.print("before\n", .{}) catch unreachable;291 \\ stdout.print("before\n", .{}) catch unreachable;
292 \\ defer stdout.print("defer1\n", .{}) catch unreachable;292 \\ defer stdout.print("defer1\n", .{}) catch unreachable;
293 \\ defer stdout.print("defer2\n", .{}) catch unreachable;293 \\ defer stdout.print("defer2\n", .{}) catch unreachable;
294 \\ var gpa = @import("std").heap.GeneralPurposeAllocator(.{}){};294 \\ var gpa: @import("std").heap.GeneralPurposeAllocator(.{}) = .init;
295 \\ defer _ = gpa.deinit();295 \\ defer _ = gpa.deinit();
296 \\ var arena = @import("std").heap.ArenaAllocator.init(gpa.allocator());296 \\ var arena = @import("std").heap.ArenaAllocator.init(gpa.allocator());
297 \\ defer arena.deinit();297 \\ defer arena.deinit();
...@@ -361,7 +361,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -361,7 +361,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
361 \\const os = std.os;361 \\const os = std.os;
362 \\362 \\
363 \\pub fn main() !void {363 \\pub fn main() !void {
364 \\ var gpa = std.heap.GeneralPurposeAllocator(.{}){};364 \\ var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
365 \\ defer _ = gpa.deinit();365 \\ defer _ = gpa.deinit();
366 \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator());366 \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator());
367 \\ defer arena.deinit();367 \\ defer arena.deinit();
...@@ -402,7 +402,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -402,7 +402,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
402 \\const os = std.os;402 \\const os = std.os;
403 \\403 \\
404 \\pub fn main() !void {404 \\pub fn main() !void {
405 \\ var gpa = std.heap.GeneralPurposeAllocator(.{}){};405 \\ var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
406 \\ defer _ = gpa.deinit();406 \\ defer _ = gpa.deinit();
407 \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator());407 \\ var arena = std.heap.ArenaAllocator.init(gpa.allocator());
408 \\ defer arena.deinit();408 \\ defer arena.deinit();
test/standalone/coff_dwarf/main.zig+1-1
...@@ -5,7 +5,7 @@ const testing = std.testing;...@@ -5,7 +5,7 @@ const testing = std.testing;
5extern fn add(a: u32, b: u32, addr: *usize) u32;5extern fn add(a: u32, b: u32, addr: *usize) u32;
66
7pub fn main() !void {7pub fn main() !void {
8 var gpa = std.heap.GeneralPurposeAllocator(.{}){};8 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
9 defer assert(gpa.deinit() == .ok);9 defer assert(gpa.deinit() == .ok);
10 const allocator = gpa.allocator();10 const allocator = gpa.allocator();
1111
test/standalone/empty_env/main.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn main() !void {3pub fn main() !void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
5 defer _ = gpa.deinit();5 defer _ = gpa.deinit();
6 const env_map = std.process.getEnvMap(gpa.allocator()) catch @panic("unable to get env map");6 const env_map = std.process.getEnvMap(gpa.allocator()) catch @panic("unable to get env map");
7 try std.testing.expect(env_map.count() == 0);7 try std.testing.expect(env_map.count() == 0);
test/standalone/load_dynamic_library/main.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn main() !void {3pub fn main() !void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
5 defer _ = gpa.deinit();5 defer _ = gpa.deinit();
6 const args = try std.process.argsAlloc(gpa.allocator());6 const args = try std.process.argsAlloc(gpa.allocator());
7 defer std.process.argsFree(gpa.allocator(), args);7 defer std.process.argsFree(gpa.allocator(), args);
test/standalone/self_exe_symlink/create-symlink.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn main() anyerror!void {3pub fn main() anyerror!void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
5 defer if (gpa.deinit() == .leak) @panic("found memory leaks");5 defer if (gpa.deinit() == .leak) @panic("found memory leaks");
6 const allocator = gpa.allocator();6 const allocator = gpa.allocator();
77
test/standalone/self_exe_symlink/main.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn main() !void {3pub fn main() !void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
5 defer std.debug.assert(gpa.deinit() == .ok);5 defer std.debug.assert(gpa.deinit() == .ok);
6 const allocator = gpa.allocator();6 const allocator = gpa.allocator();
77
test/standalone/simple/brace_expansion.zig+1-1
...@@ -15,7 +15,7 @@ const Token = union(enum) {...@@ -15,7 +15,7 @@ const Token = union(enum) {
15 Eof,15 Eof,
16};16};
1717
18var gpa = std.heap.GeneralPurposeAllocator(.{}){};18var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
19var global_allocator = gpa.allocator();19var global_allocator = gpa.allocator();
2020
21fn tokenize(input: []const u8) !ArrayList(Token) {21fn tokenize(input: []const u8) !ArrayList(Token) {
test/standalone/windows_argv/fuzz.zig+1-1
...@@ -4,7 +4,7 @@ const windows = std.os.windows;...@@ -4,7 +4,7 @@ const windows = std.os.windows;
4const Allocator = std.mem.Allocator;4const Allocator = std.mem.Allocator;
55
6pub fn main() !void {6pub fn main() !void {
7 var gpa = std.heap.GeneralPurposeAllocator(.{}){};7 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
8 defer std.debug.assert(gpa.deinit() == .ok);8 defer std.debug.assert(gpa.deinit() == .ok);
9 const allocator = gpa.allocator();9 const allocator = gpa.allocator();
1010
test/standalone/windows_bat_args/fuzz.zig+1-1
...@@ -3,7 +3,7 @@ const builtin = @import("builtin");...@@ -3,7 +3,7 @@ const builtin = @import("builtin");
3const Allocator = std.mem.Allocator;3const Allocator = std.mem.Allocator;
44
5pub fn main() anyerror!void {5pub fn main() anyerror!void {
6 var gpa = std.heap.GeneralPurposeAllocator(.{}){};6 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
7 defer if (gpa.deinit() == .leak) @panic("found memory leaks");7 defer if (gpa.deinit() == .leak) @panic("found memory leaks");
8 const allocator = gpa.allocator();8 const allocator = gpa.allocator();
99
test/standalone/windows_bat_args/test.zig+1-1
...@@ -1,7 +1,7 @@...@@ -1,7 +1,7 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn main() anyerror!void {3pub fn main() anyerror!void {
4 var gpa = std.heap.GeneralPurposeAllocator(.{}){};4 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
5 defer if (gpa.deinit() == .leak) @panic("found memory leaks");5 defer if (gpa.deinit() == .leak) @panic("found memory leaks");
6 const allocator = gpa.allocator();6 const allocator = gpa.allocator();
77
test/standalone/windows_spawn/main.zig+1-1
...@@ -3,7 +3,7 @@ const windows = std.os.windows;...@@ -3,7 +3,7 @@ const windows = std.os.windows;
3const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral;3const utf16Literal = std.unicode.utf8ToUtf16LeStringLiteral;
44
5pub fn main() anyerror!void {5pub fn main() anyerror!void {
6 var gpa = std.heap.GeneralPurposeAllocator(.{}){};6 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
7 defer if (gpa.deinit() == .leak) @panic("found memory leaks");7 defer if (gpa.deinit() == .leak) @panic("found memory leaks");
8 const allocator = gpa.allocator();8 const allocator = gpa.allocator();
99
tools/doctest.zig+2-2
...@@ -868,8 +868,8 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {...@@ -868,8 +868,8 @@ fn parseManifest(arena: Allocator, source_bytes: []const u8) !Code {
868868
869 var mode: std.builtin.OptimizeMode = .Debug;869 var mode: std.builtin.OptimizeMode = .Debug;
870 var link_mode: ?std.builtin.LinkMode = null;870 var link_mode: ?std.builtin.LinkMode = null;
871 var link_objects: std.ArrayListUnmanaged([]const u8) = .{};871 var link_objects: std.ArrayListUnmanaged([]const u8) = .empty;
872 var additional_options: std.ArrayListUnmanaged([]const u8) = .{};872 var additional_options: std.ArrayListUnmanaged([]const u8) = .empty;
873 var target_str: ?[]const u8 = null;873 var target_str: ?[]const u8 = null;
874 var link_libc = false;874 var link_libc = false;
875 var disable_cache = false;875 var disable_cache = false;
tools/dump-cov.zig+2-2
...@@ -8,7 +8,7 @@ const assert = std.debug.assert;...@@ -8,7 +8,7 @@ const assert = std.debug.assert;
8const SeenPcsHeader = std.Build.Fuzz.abi.SeenPcsHeader;8const SeenPcsHeader = std.Build.Fuzz.abi.SeenPcsHeader;
99
10pub fn main() !void {10pub fn main() !void {
11 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .{};11 var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
12 defer _ = general_purpose_allocator.deinit();12 defer _ = general_purpose_allocator.deinit();
13 const gpa = general_purpose_allocator.allocator();13 const gpa = general_purpose_allocator.allocator();
1414
...@@ -55,7 +55,7 @@ pub fn main() !void {...@@ -55,7 +55,7 @@ pub fn main() !void {
55 try stdout.print("{any}\n", .{header.*});55 try stdout.print("{any}\n", .{header.*});
56 const pcs = header.pcAddrs();56 const pcs = header.pcAddrs();
5757
58 var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .{};58 var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .empty;
59 try indexed_pcs.entries.resize(arena, pcs.len);59 try indexed_pcs.entries.resize(arena, pcs.len);
60 @memcpy(indexed_pcs.entries.items(.key), pcs);60 @memcpy(indexed_pcs.entries.items(.key), pcs);
61 try indexed_pcs.reIndex(arena);61 try indexed_pcs.reIndex(arena);
tools/generate_JSONTestSuite.zig+1-1
...@@ -3,7 +3,7 @@...@@ -3,7 +3,7 @@
3const std = @import("std");3const std = @import("std");
44
5pub fn main() !void {5pub fn main() !void {
6 var gpa = std.heap.GeneralPurposeAllocator(.{}){};6 var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init;
7 var allocator = gpa.allocator();7 var allocator = gpa.allocator();
88
9 var output = std.io.getStdOut().writer();9 var output = std.io.getStdOut().writer();
tools/generate_c_size_and_align_checks.zig+1-1
...@@ -25,7 +25,7 @@ fn cName(ty: std.Target.CType) []const u8 {...@@ -25,7 +25,7 @@ fn cName(ty: std.Target.CType) []const u8 {
25 };25 };
26}26}
2727
28var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};28var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init;
2929
30pub fn main() !void {30pub fn main() !void {
31 const gpa = general_purpose_allocator.allocator();31 const gpa = general_purpose_allocator.allocator();
tools/incr-check.zig+4-4
...@@ -73,7 +73,7 @@ pub fn main() !void {...@@ -73,7 +73,7 @@ pub fn main() !void {
73 else73 else
74 null;74 null;
7575
76 var child_args: std.ArrayListUnmanaged([]const u8) = .{};76 var child_args: std.ArrayListUnmanaged([]const u8) = .empty;
77 try child_args.appendSlice(arena, &.{77 try child_args.appendSlice(arena, &.{
78 resolved_zig_exe,78 resolved_zig_exe,
79 "build-exe",79 "build-exe",
...@@ -107,7 +107,7 @@ pub fn main() !void {...@@ -107,7 +107,7 @@ pub fn main() !void {
107 child.cwd_dir = tmp_dir;107 child.cwd_dir = tmp_dir;
108 child.cwd = tmp_dir_path;108 child.cwd = tmp_dir_path;
109109
110 var cc_child_args: std.ArrayListUnmanaged([]const u8) = .{};110 var cc_child_args: std.ArrayListUnmanaged([]const u8) = .empty;
111 if (emit == .c) {111 if (emit == .c) {
112 const resolved_cc_zig_exe = if (opt_cc_zig) |cc_zig_exe|112 const resolved_cc_zig_exe = if (opt_cc_zig) |cc_zig_exe|
113 try std.fs.path.relative(arena, tmp_dir_path, cc_zig_exe)113 try std.fs.path.relative(arena, tmp_dir_path, cc_zig_exe)
...@@ -492,8 +492,8 @@ const Case = struct {...@@ -492,8 +492,8 @@ const Case = struct {
492 };492 };
493493
494 fn parse(arena: Allocator, bytes: []const u8) !Case {494 fn parse(arena: Allocator, bytes: []const u8) !Case {
495 var updates: std.ArrayListUnmanaged(Update) = .{};495 var updates: std.ArrayListUnmanaged(Update) = .empty;
496 var changes: std.ArrayListUnmanaged(FullContents) = .{};496 var changes: std.ArrayListUnmanaged(FullContents) = .empty;
497 var target_query: ?[]const u8 = null;497 var target_query: ?[]const u8 = null;
498 var it = std.mem.splitScalar(u8, bytes, '\n');498 var it = std.mem.splitScalar(u8, bytes, '\n');
499 var line_n: usize = 1;499 var line_n: usize = 1;