diff --git a/lib/compiler/Maker.zig b/lib/compiler/Maker.zig index cd3e43d332b2acb21ac76a8828d9426aba9a60d5..c31ba826d00a25807284c75e2209388d5e17b4d7 100644 --- a/lib/compiler/Maker.zig +++ b/lib/compiler/Maker.zig @@ -49,7 +49,7 @@ web_server: if (!builtin.single_threaded) ?WebServer else ?noreturn, /// Allocated into `gpa`. memory_blocked_steps: std.ArrayList(Configuration.Step.Index), /// Allocated into `gpa`. -step_stack: std.AutoArrayHashMapUnmanaged(Configuration.Step.Index, void), +step_stack: std.array_hash_map.Auto(Configuration.Step.Index, void), pkg_config: PkgConfig, error_style: ErrorStyle, @@ -481,7 +481,7 @@ pub fn main(init: process.Init.Minimal) !void { // maker process fails or crashes and it's helpful to be able to repeat // execution of the command line or otherwise inspect the configuration file. const c = &configuration; - var top_level_steps: std.StringArrayHashMapUnmanaged(Configuration.Step.Index) = .empty; + var top_level_steps: std.array_hash_map.String(Configuration.Step.Index) = .empty; for (configuration.steps, 0..) |*conf_step, step_index_usize| { if (conf_step.owner != .root) continue; const step_index: Configuration.Step.Index = @enumFromInt(step_index_usize); @@ -1217,7 +1217,7 @@ fn printTreeStep( step_index: Configuration.Step.Index, stderr: Io.Terminal, parent_node: *PrintNode, - step_stack: *std.AutoArrayHashMapUnmanaged(Configuration.Step.Index, void), + step_stack: *std.array_hash_map.Auto(Configuration.Step.Index, void), ) !void { const writer = stderr.writer; const first = step_stack.swapRemove(step_index); @@ -1502,7 +1502,7 @@ fn printChildNodePrefix(stderr: Io.Terminal) !void { fn constructGraphAndCheckForDependencyLoop( maker: *Maker, step_index: Configuration.Step.Index, - step_stack: *std.AutoArrayHashMapUnmanaged(Configuration.Step.Index, void), + step_stack: *std.array_hash_map.Auto(Configuration.Step.Index, void), rand: std.Random, ) error{ DependencyLoopDetected, OutOfMemory }!void { const c = &maker.scanned_config.configuration; diff --git a/lib/compiler/Maker/Fuzz.zig b/lib/compiler/Maker/Fuzz.zig index 2160befc08df2fb7f896d0f37b522e838cf7d331..44c3ccd2705799819cf189ae28053ddc9dce3583 100644 --- a/lib/compiler/Maker/Fuzz.zig +++ b/lib/compiler/Maker/Fuzz.zig @@ -27,7 +27,7 @@ prog_node: std.Progress.Node, /// Protects `coverage_files`. coverage_mutex: Io.Mutex, -coverage_files: std.AutoArrayHashMapUnmanaged(u64, CoverageMap), +coverage_files: std.array_hash_map.Auto(u64, CoverageMap), queue_mutex: Io.Mutex, queue_cond: Io.Condition, @@ -273,7 +273,7 @@ pub fn serveSourcesTar(fuzz: *Fuzz, req: *std.http.Server.Request) !void { defer arena_state.deinit(); const arena = arena_state.allocator(); - const DedupTable = std.ArrayHashMapUnmanaged(Build.Cache.Path, void, Build.Cache.Path.TableAdapter, false); + const DedupTable = std.array_hash_map.Custom(Build.Cache.Path, void, Build.Cache.Path.TableAdapter, false); var dedup_table: DedupTable = .empty; defer dedup_table.deinit(gpa); diff --git a/lib/compiler/Maker/ScannedConfig.zig b/lib/compiler/Maker/ScannedConfig.zig index c1e1ff18a90ba79e2331eae052deb4db61e5d164..f34303d2e56c1b6ea0cfe97f3ebed3d0d7f6c63c 100644 --- a/lib/compiler/Maker/ScannedConfig.zig +++ b/lib/compiler/Maker/ScannedConfig.zig @@ -8,7 +8,7 @@ const Serializer = std.zon.Serializer; const Graph = @import("Graph.zig"); configuration: Configuration, -top_level_steps: std.StringArrayHashMapUnmanaged(Configuration.Step.Index), +top_level_steps: std.array_hash_map.String(Configuration.Step.Index), path: []const u8, pub fn print(sc: *const ScannedConfig, w: *Writer) Writer.Error!void { diff --git a/lib/compiler/Maker/Step.zig b/lib/compiler/Maker/Step.zig index 6a6f5c1cf3718c2dce6c957283e528d7b0844ac4..40d82db57f6afbacc468e038f5c1e9f1487f15d9 100644 --- a/lib/compiler/Maker/Step.zig +++ b/lib/compiler/Maker/Step.zig @@ -180,7 +180,7 @@ pub const Inputs = struct { .table = .{}, }; - pub const Table = std.ArrayHashMapUnmanaged(Path, Files, Path.TableAdapter, false); + pub const Table = std.array_hash_map.Custom(Path, Files, Path.TableAdapter, false); /// The special file name "." means any changes inside the directory. pub const Files = std.ArrayList([]const u8); diff --git a/lib/compiler/Maker/Step/Compile.zig b/lib/compiler/Maker/Step/Compile.zig index 5f0589dc96c47e3be8e93697402fd3d7f1ba1e35..8db4b2be2a825da2fae3780043a35db491d28273 100644 --- a/lib/compiler/Maker/Step/Compile.zig +++ b/lib/compiler/Maker/Step/Compile.zig @@ -119,9 +119,9 @@ fn updateGeneratedFile( /// List of importable modules in a compilation's module graph, including /// the root module. The root module is guaranteed to be first. -const ModuleList = std.AutoArrayHashMapUnmanaged(Configuration.Module.Index, Configuration.String); +const ModuleList = std.array_hash_map.Auto(Configuration.Module.Index, Configuration.String); /// Keyed on the first key in the module list. -pub const ModuleGraph = std.ArrayHashMapUnmanaged(ModuleList, void, ModuleListContext, false); +pub const ModuleGraph = std.array_hash_map.Custom(ModuleList, void, ModuleListContext, false); const ModuleListContext = struct { pub fn eql(ctx: @This(), a: ModuleList, b: ModuleList) bool { @@ -221,8 +221,8 @@ fn lowerZigArgs( // module, along with any C compiler arguments that need to be passed // to the compiler for each module individually as reported by // pkg-config. - var seen_system_libs: std.AutoArrayHashMapUnmanaged(Configuration.String, []const []const u8) = .empty; - var frameworks: std.AutoArrayHashMapUnmanaged(Configuration.String, Configuration.Module.Framework.Flags) = .empty; + var seen_system_libs: std.array_hash_map.Auto(Configuration.String, []const []const u8) = .empty; + var frameworks: std.array_hash_map.Auto(Configuration.String, Configuration.Module.Framework.Flags) = .empty; var module_graph: ModuleGraph = .empty; var prev_has_cflags = false; @@ -1126,8 +1126,8 @@ fn moduleNeedsCliArg(mod: *const Configuration.Module, conf: *const Configuratio } const CliNamedModules = struct { - modules: std.AutoArrayHashMapUnmanaged(Configuration.Module.Index, void), - names: std.StringArrayHashMapUnmanaged(void), + modules: std.array_hash_map.Auto(Configuration.Module.Index, void), + names: std.array_hash_map.String(void), /// Traverse the whole dependency graph and give every module a unique /// name, ideally one named after what it's called somewhere in the graph. @@ -1177,7 +1177,7 @@ pub fn getCompileDependencies( start: Configuration.Step.Index, chase_dynamic: bool, ) ![]const Configuration.Step.Index { - var compiles: std.AutoArrayHashMapUnmanaged(Configuration.Step.Index, void) = .empty; + var compiles: std.array_hash_map.Auto(Configuration.Step.Index, void) = .empty; var compiles_i: usize = 0; try compiles.putNoClobber(arena, start, {}); diff --git a/lib/compiler/Maker/Step/TranslateC.zig b/lib/compiler/Maker/Step/TranslateC.zig index d9bbd6ad4cb2b20deaf3da3f74cc56409a491598..11b30e89b6ec6a677e04df4622bee15a3a4c0bd2 100644 --- a/lib/compiler/Maker/Step/TranslateC.zig +++ b/lib/compiler/Maker/Step/TranslateC.zig @@ -66,7 +66,7 @@ pub fn make( var prev_search_strategy: std.Build.Module.SystemLib.SearchStrategy = .paths_first; var prev_preferred_link_mode: std.builtin.LinkMode = .dynamic; - var seen_system_libs: std.AutoArrayHashMapUnmanaged(Configuration.String, []const []const u8) = .empty; + var seen_system_libs: std.array_hash_map.Auto(Configuration.String, []const []const u8) = .empty; for (conf_tc.system_libs.slice) |system_lib_index| { const system_lib = system_lib_index.get(conf); diff --git a/lib/compiler/Maker/Watch.zig b/lib/compiler/Maker/Watch.zig index 603b9c911d696ad94f0ea5d250df07236cec78d6..fb8bca122804d0ba963f3827e29f38d69b40444e 100644 --- a/lib/compiler/Maker/Watch.zig +++ b/lib/compiler/Maker/Watch.zig @@ -27,11 +27,11 @@ pub const have_impl = Os != void; /// interested in noticing changes to. /// /// Value is generation. -const DirTable = std.ArrayHashMapUnmanaged(Cache.Path, void, Cache.Path.TableAdapter, false); +const DirTable = std.array_hash_map.Custom(Cache.Path, void, Cache.Path.TableAdapter, false); /// Special key of "." means any changes in this directory trigger the steps. -const ReactionSet = std.StringArrayHashMapUnmanaged(StepSet); -const StepSet = std.AutoArrayHashMapUnmanaged(Configuration.Step.Index, Generation); +const ReactionSet = std.array_hash_map.String(StepSet); +const StepSet = std.array_hash_map.Auto(Configuration.Step.Index, Generation); const Generation = u8; @@ -46,10 +46,10 @@ const Os = switch (builtin.os.tag) { handle_table: HandleTable, /// fanotify file descriptors are keyed by mount id since marks /// are limited to a single filesystem. - poll_fds: std.AutoArrayHashMapUnmanaged(MountId, posix.pollfd), + poll_fds: std.array_hash_map.Auto(MountId, posix.pollfd), const MountId = i32; - const HandleTable = std.ArrayHashMapUnmanaged(FileHandle, struct { mount_id: MountId, reaction_set: ReactionSet }, FileHandle.Adapter, false); + const HandleTable = std.array_hash_map.Custom(FileHandle, struct { mount_id: MountId, reaction_set: ReactionSet }, FileHandle.Adapter, false); const fan_mask: std.os.linux.fanotify.MarkMask = .{ .CLOSE_WRITE = true, @@ -314,7 +314,7 @@ const Os = switch (builtin.os.tag) { const windows = std.os.windows; /// Keyed differently but indexes correspond 1:1 with `dir_table`. - handle_table: std.ArrayHashMapUnmanaged(*Directory, void, Directory.TableAdapter, false), + handle_table: std.array_hash_map.Custom(*Directory, void, Directory.TableAdapter, false), ready_dirs: std.DoublyLinkedList, const FileId = struct { diff --git a/lib/compiler/aro/aro/Compilation.zig b/lib/compiler/aro/aro/Compilation.zig index 978bbcffc8ea121ebbcdfd7bda6c9dfcd24e636d..f1dc72ae86c5f15611e77cbdbf69a28339d2b275 100644 --- a/lib/compiler/aro/aro/Compilation.zig +++ b/lib/compiler/aro/aro/Compilation.zig @@ -140,7 +140,7 @@ io: Io, cwd: std.Io.Dir, diagnostics: *Diagnostics, -sources: std.StringArrayHashMapUnmanaged(Source) = .empty, +sources: std.array_hash_map.String(Source) = .empty, source_aliases: std.ArrayList(Source) = .empty, /// Allocated into `gpa`, but keys are externally managed. search_path: std.ArrayList(Include) = .empty, @@ -159,7 +159,7 @@ builtins: Builtins = .{}, string_interner: StringInterner = .{}, interner: Interner = .{}, type_store: TypeStore = .{}, -pragma_handlers: std.StringArrayHashMapUnmanaged(*Pragma) = .empty, +pragma_handlers: std.array_hash_map.String(*Pragma) = .empty, /// If this is not null, the directory containing the specified Source will be searched for includes /// Used by MS extensions which allow searching for includes relative to the directory of the main source file. ms_cwd_source_id: ?Source.Id = null, diff --git a/lib/compiler/aro/aro/DepFile.zig b/lib/compiler/aro/aro/DepFile.zig index a8f8d7cbaebe944adff461abadd38d3396fbf117..ba8d5c92b58e7d403544cc2a020e5420add2d979 100644 --- a/lib/compiler/aro/aro/DepFile.zig +++ b/lib/compiler/aro/aro/DepFile.zig @@ -6,7 +6,7 @@ pub const Format = enum { make, nmake }; const DepFile = @This(); target: []const u8, -deps: std.StringArrayHashMapUnmanaged(void) = .empty, +deps: std.array_hash_map.String(void) = .empty, format: Format, pub fn deinit(d: *DepFile, gpa: Allocator) void { diff --git a/lib/compiler/aro/aro/Preprocessor.zig b/lib/compiler/aro/aro/Preprocessor.zig index 6b52492e7d9a09a1650c7ffdf27cd6ffd09cdad4..2018da7bd023d347fdedccfadf029a25140b4054 100644 --- a/lib/compiler/aro/aro/Preprocessor.zig +++ b/lib/compiler/aro/aro/Preprocessor.zig @@ -23,7 +23,7 @@ const Tree = @import("Tree.zig"); const Token = Tree.Token; const TokenWithExpansionLocs = Tree.TokenWithExpansionLocs; -const DefineMap = std.StringArrayHashMapUnmanaged(Macro); +const DefineMap = std.array_hash_map.String(Macro); const RawTokenList = std.ArrayList(RawToken); const max_include_depth = 200; diff --git a/lib/compiler/aro/aro/StringInterner.zig b/lib/compiler/aro/aro/StringInterner.zig index e22ec23a467f20fcba6184628fc9ddddbb45a626..021bd3f602438587c91d8db63de450ba58098d65 100644 --- a/lib/compiler/aro/aro/StringInterner.zig +++ b/lib/compiler/aro/aro/StringInterner.zig @@ -19,7 +19,7 @@ pub const StringId = enum(u32) { } }; -table: std.StringArrayHashMapUnmanaged(void) = .empty, +table: std.array_hash_map.String(void) = .empty, pub fn deinit(si: *StringInterner, allocator: mem.Allocator) void { si.table.deinit(allocator); diff --git a/lib/compiler/aro/backend/Interner.zig b/lib/compiler/aro/backend/Interner.zig index 027c411d637cf35c2534dd8f8b22128ac927cbbe..6a7fe6fd0772d478ac9ff0d30cbeb7064819cee8 100644 --- a/lib/compiler/aro/backend/Interner.zig +++ b/lib/compiler/aro/backend/Interner.zig @@ -8,7 +8,7 @@ const Limb = std.math.big.Limb; const Interner = @This(); -map: std.AutoArrayHashMapUnmanaged(void, void) = .empty, +map: std.array_hash_map.Auto(void, void) = .empty, items: std.MultiArrayList(struct { tag: Tag, data: u32, diff --git a/lib/compiler/aro/backend/Ir.zig b/lib/compiler/aro/backend/Ir.zig index ae4fa2a6d30fb4910b9409f0f11b6acf1256cdec..f35eca40f7af811593b8a4161ad8d575f44609ce 100644 --- a/lib/compiler/aro/backend/Ir.zig +++ b/lib/compiler/aro/backend/Ir.zig @@ -7,7 +7,7 @@ const Object = @import("Object.zig"); const Ir = @This(); interner: *Interner, -decls: std.StringArrayHashMapUnmanaged(Decl), +decls: std.array_hash_map.String(Decl), pub const Decl = struct { instructions: std.MultiArrayList(Inst), @@ -26,7 +26,7 @@ pub const Builder = struct { arena: std.heap.ArenaAllocator, interner: *Interner, - decls: std.StringArrayHashMapUnmanaged(Decl) = .empty, + decls: std.array_hash_map.String(Decl) = .empty, instructions: std.MultiArrayList(Ir.Inst) = .empty, body: std.ArrayList(Ref) = .empty, alloc_count: u32 = 0, @@ -181,7 +181,7 @@ pub const Renderer = struct { ir: *const Ir, errors: ErrorList = .{}, - pub const ErrorList = std.StringArrayHashMapUnmanaged([]const u8); + pub const ErrorList = std.array_hash_map.String([]const u8); pub const Error = Allocator.Error || error{LowerFail}; @@ -380,7 +380,7 @@ const REF = std.Io.Terminal.Color.bright_blue; const LITERAL = std.Io.Terminal.Color.bright_green; const ATTRIBUTE = std.Io.Terminal.Color.bright_yellow; -const RefMap = std.AutoArrayHashMapUnmanaged(Ref, void); +const RefMap = std.array_hash_map.Auto(Ref, void); pub const DumpError = std.Io.Terminal.SetColorError || std.mem.Allocator.Error; diff --git a/lib/compiler/configurer.zig b/lib/compiler/configurer.zig index 9b3c8fb403d267103ff7bf99138190565a443f57..58268882582d1aa121ec0df31433d5aa4f1f1768 100644 --- a/lib/compiler/configurer.zig +++ b/lib/compiler/configurer.zig @@ -160,10 +160,10 @@ pub fn main(init: process.Init.Minimal) !void { const Serialize = struct { arena: Allocator, wc: *Configuration.Wip, - module_map: std.AutoArrayHashMapUnmanaged(*std.Build.Module, Configuration.Module.Index) = .empty, - package_map: std.AutoArrayHashMapUnmanaged(*std.Build, Configuration.Package.Index) = .empty, + module_map: std.array_hash_map.Auto(*std.Build.Module, Configuration.Module.Index) = .empty, + package_map: std.array_hash_map.Auto(*std.Build, Configuration.Package.Index) = .empty, /// Index corresponds to `Configuration.steps` index. - step_map: std.AutoArrayHashMapUnmanaged(*Step, void) = .empty, + step_map: std.array_hash_map.Auto(*Step, void) = .empty, fn builderToPackage(s: *Serialize, b: *std.Build) !Configuration.Package.Index { if (b.pkg_hash.len == 0) return .root; diff --git a/lib/compiler/reduce/Walk.zig b/lib/compiler/reduce/Walk.zig index 955eed53259a8bf8802ca8301f35266ade07d37c..1873c23d77f6c08230e69743e5b6db09285284f4 100644 --- a/lib/compiler/reduce/Walk.zig +++ b/lib/compiler/reduce/Walk.zig @@ -44,7 +44,7 @@ pub const Transformation = union(enum) { imported_string: []const u8, /// Identifier names that must be renamed in the inlined code or else /// will cause ambiguous reference errors. - in_scope_names: std.StringArrayHashMapUnmanaged(void), + in_scope_names: std.array_hash_map.String(void), }; }; @@ -723,7 +723,7 @@ fn walkBuiltinCall( try w.transformations.append(.{ .inline_imported_file = .{ .builtin_call_node = call_node, .imported_string = imported_string, - .in_scope_names = try std.StringArrayHashMapUnmanaged(void).init( + .in_scope_names = try std.array_hash_map.String(void).init( w.arena, w.in_scope_names.keys(), &.{}, diff --git a/lib/compiler/resinator/cli.zig b/lib/compiler/resinator/cli.zig index f35e70ce6cccdd726d01426ba8c11216f94b81b1..7fa82ae65138cfdc7c08d43f592bdcd62d53f5fd 100644 --- a/lib/compiler/resinator/cli.zig +++ b/lib/compiler/resinator/cli.zig @@ -159,7 +159,7 @@ pub const Options = struct { default_language_id: ?u16 = null, default_code_page: ?SupportedCodePage = null, verbose: bool = false, - symbols: std.StringArrayHashMapUnmanaged(SymbolValue) = .empty, + symbols: std.array_hash_map.String(SymbolValue) = .empty, null_terminate_string_table_strings: bool = false, max_string_literal_codepoints: u15 = lex.default_max_string_literal_codepoints, silent_duplicate_control_ids: bool = false, diff --git a/lib/compiler/resinator/compile.zig b/lib/compiler/resinator/compile.zig index c8c11b58707d7c8a2ae03fea8c5db8424af4b7e8..c5bd06320aa19c03c6d158335301e8526daeab19 100644 --- a/lib/compiler/resinator/compile.zig +++ b/lib/compiler/resinator/compile.zig @@ -3049,7 +3049,7 @@ pub const StringTablesByLanguage = struct { /// when the first STRINGTABLE for the language was defined, and all blocks for a given /// language are written contiguously. /// Using an ArrayHashMap here gives us this property for free. - tables: std.AutoArrayHashMapUnmanaged(res.Language, StringTable) = .empty, + tables: std.array_hash_map.Auto(res.Language, StringTable) = .empty, pub fn deinit(self: *StringTablesByLanguage, allocator: Allocator) void { self.tables.deinit(allocator); @@ -3080,7 +3080,7 @@ pub const StringTable = struct { /// was added to the block (i.e. `STRINGTABLE { 16 "b" 0 "a" }` would then get written /// with block ID 2 (the one with "b") first and block ID 1 (the one with "a") second). /// Using an ArrayHashMap here gives us this property for free. - blocks: std.AutoArrayHashMapUnmanaged(u16, Block) = .empty, + blocks: std.array_hash_map.Auto(u16, Block) = .empty, pub const Block = struct { strings: std.ArrayList(Token) = .empty, diff --git a/lib/compiler/resinator/cvtres.zig b/lib/compiler/resinator/cvtres.zig index 84364cea9fc0199e8ba35cd03301c4f4b1573bd6..244ab3f63596bfe01365761e1a5e2db084f48a2e 100644 --- a/lib/compiler/resinator/cvtres.zig +++ b/lib/compiler/resinator/cvtres.zig @@ -439,9 +439,9 @@ pub const ResourceDataEntry = extern struct { /// type -> name -> language const ResourceTree = struct { - type_to_name_map: std.ArrayHashMapUnmanaged(NameOrOrdinal, NameToLanguageMap, NameOrOrdinalHashContext, true), - rsrc_string_table: std.ArrayHashMapUnmanaged(NameOrOrdinal, void, NameOrOrdinalHashContext, true), - deduplicated_data: std.StringArrayHashMapUnmanaged(u32), + type_to_name_map: std.array_hash_map.Custom(NameOrOrdinal, NameToLanguageMap, NameOrOrdinalHashContext, true), + rsrc_string_table: std.array_hash_map.Custom(NameOrOrdinal, void, NameOrOrdinalHashContext, true), + deduplicated_data: std.array_hash_map.String(u32), data_offsets: std.ArrayList(u32), rsrc02_len: u32, coff_options: CoffOptions, @@ -451,8 +451,8 @@ const ResourceTree = struct { resource: *const Resource, original_index: usize, }; - const LanguageToResourceMap = std.AutoArrayHashMapUnmanaged(Language, RelocatableResource); - const NameToLanguageMap = std.ArrayHashMapUnmanaged(NameOrOrdinal, LanguageToResourceMap, NameOrOrdinalHashContext, true); + const LanguageToResourceMap = std.array_hash_map.Auto(Language, RelocatableResource); + const NameToLanguageMap = std.array_hash_map.Custom(NameOrOrdinal, LanguageToResourceMap, NameOrOrdinalHashContext, true); const NameOrOrdinalHashContext = struct { pub fn hash(self: @This(), v: NameOrOrdinal) u32 { diff --git a/lib/compiler/translate-c/Scope.zig b/lib/compiler/translate-c/Scope.zig index 9e5f715600179973b8e0394e6a723e5f59ad2ba7..80817634314b1e366a06b7b09e9b0bced31bdf1a 100644 --- a/lib/compiler/translate-c/Scope.zig +++ b/lib/compiler/translate-c/Scope.zig @@ -7,7 +7,7 @@ const Translator = @import("Translator.zig"); const Scope = @This(); -pub const SymbolTable = std.StringArrayHashMapUnmanaged(ast.Node); +pub const SymbolTable = std.array_hash_map.String(ast.Node); pub const AliasList = std.ArrayList(struct { alias: []const u8, name: []const u8, @@ -18,7 +18,7 @@ pub const ContainerMemberFns = struct { container_decl_ptr: *ast.Node, member_fns: std.ArrayList(*ast.Payload.Func) = .empty, }; -pub const ContainerMemberFnsHashMap = std.ArrayHashMapUnmanaged( +pub const ContainerMemberFnsHashMap = std.array_hash_map.Custom( aro.QualType, ContainerMemberFns, struct { @@ -79,7 +79,7 @@ pub const Block = struct { /// will be used. This maps the variable's name to the Discard payload, so that if /// the variable is subsequently referenced we can indicate that the discard should /// be skipped during the intermediate AST -> Zig AST render step. - variable_discards: std.StringArrayHashMapUnmanaged(*ast.Payload.Discard), + variable_discards: std.array_hash_map.String(*ast.Payload.Discard), /// When the block corresponds to a function, keep track of the return type /// so that the return expression can be cast, if necessary @@ -209,7 +209,7 @@ pub const Root = struct { base: Scope, translator: *Translator, sym_table: SymbolTable, - blank_macros: std.StringArrayHashMapUnmanaged(void), + blank_macros: std.array_hash_map.String(void), nodes: std.ArrayList(ast.Node), container_member_fns_map: ContainerMemberFnsHashMap, @@ -267,7 +267,7 @@ pub const Root = struct { const gpa = root.translator.gpa; const arena = root.translator.arena; - var member_names: std.StringArrayHashMapUnmanaged(void) = .empty; + var member_names: std.array_hash_map.String(void) = .empty; defer member_names.deinit(gpa); for (root.container_member_fns_map.keys(), root.container_member_fns_map.values()) |container_qt, members| { // Get the container name diff --git a/lib/compiler/translate-c/Translator.zig b/lib/compiler/translate-c/Translator.zig index 9e27ee5e387dba6f072220bec6f64e3d0105e382..794be9361e530a25fa4da4f40693bf432838cef5 100644 --- a/lib/compiler/translate-c/Translator.zig +++ b/lib/compiler/translate-c/Translator.zig @@ -106,7 +106,7 @@ global_scope: *Scope.Root, mangle_count: u32 = 0, /// Table of declarations for enum, struct, union and typedef types. -type_decls: std.AutoArrayHashMapUnmanaged(Node.Index, []const u8) = .empty, +type_decls: std.array_hash_map.Auto(Node.Index, []const u8) = .empty, /// Table of record decls that have been demoted to opaques. opaque_demotes: std.HashMapUnmanaged(QualType, void, QualTypeHashContext, std.hash_map.default_max_load_percentage) = .empty, /// Table of unnamed enums and records that are child types of typedefs. @@ -123,7 +123,7 @@ anonymous_record_field_names: std.HashMapUnmanaged( /// a list of names that we found by visiting all the top level decls without /// translating them. The other maps are updated as we translate; this one is updated /// up front in a pre-processing step. -global_names: std.StringArrayHashMapUnmanaged(void) = .empty, +global_names: std.array_hash_map.String(void) = .empty, /// This is similar to `global_names`, but contains names which we would /// *like* to use, but do not strictly *have* to if they are unavailable. @@ -132,11 +132,11 @@ global_names: std.StringArrayHashMapUnmanaged(void) = .empty, /// may be mangled. /// This is distinct from `global_names` so we can detect at a type /// declaration whether or not the name is available. -weak_global_names: std.StringArrayHashMapUnmanaged(void) = .empty, +weak_global_names: std.array_hash_map.String(void) = .empty, /// Set of identifiers known to refer to typedef declarations. /// Used when parsing macros. -typedefs: std.StringArrayHashMapUnmanaged(void) = .empty, +typedefs: std.array_hash_map.String(void) = .empty, /// The lhs lval of a compound assignment expression. compound_assign_dummy: ?ZigNode = null, diff --git a/lib/docs/wasm/Walk.zig b/lib/docs/wasm/Walk.zig index f0601e6438f80ce8951146fcbb3024bd8f7cee0b..2d5a45d72f739abb1d763bea3d6804b3ee53859d 100644 --- a/lib/docs/wasm/Walk.zig +++ b/lib/docs/wasm/Walk.zig @@ -10,9 +10,9 @@ const Oom = error{OutOfMemory}; pub const Decl = @import("Decl.zig"); -pub var files: std.StringArrayHashMapUnmanaged(File) = .empty; +pub var files: std.array_hash_map.String(File) = .empty; pub var decls: std.ArrayList(Decl) = .empty; -pub var modules: std.StringArrayHashMapUnmanaged(File.Index) = .empty; +pub var modules: std.array_hash_map.String(File.Index) = .empty; file: File.Index, @@ -42,17 +42,17 @@ pub const Category = union(enum(u8)) { pub const File = struct { ast: Ast, /// Maps identifiers to the declarations they point to. - ident_decls: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .empty, + ident_decls: std.array_hash_map.Auto(Ast.TokenIndex, Ast.Node.Index) = .empty, /// Maps field access identifiers to the containing field access node. - token_parents: std.AutoArrayHashMapUnmanaged(Ast.TokenIndex, Ast.Node.Index) = .empty, + token_parents: std.array_hash_map.Auto(Ast.TokenIndex, Ast.Node.Index) = .empty, /// Maps declarations to their global index. - node_decls: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Decl.Index) = .empty, + node_decls: std.array_hash_map.Auto(Ast.Node.Index, Decl.Index) = .empty, /// Maps function declarations to doctests. - doctests: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty, + doctests: std.array_hash_map.Auto(Ast.Node.Index, Ast.Node.Index) = .empty, /// root node => its namespace scope /// struct/union/enum/opaque decl node => its namespace scope /// local var decl node => its local variable scope - scopes: std.AutoArrayHashMapUnmanaged(Ast.Node.Index, *Scope) = .empty, + scopes: std.array_hash_map.Auto(Ast.Node.Index, *Scope) = .empty, pub fn lookup_token(file: *File, token: Ast.TokenIndex) Decl.Index { const decl_node = file.ident_decls.get(token) orelse return .none; @@ -465,8 +465,8 @@ pub const Scope = struct { const Namespace = struct { base: Scope = .{ .tag = .namespace }, parent: *Scope, - names: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty, - doctests: std.StringArrayHashMapUnmanaged(Ast.Node.Index) = .empty, + names: std.array_hash_map.String(Ast.Node.Index) = .empty, + doctests: std.array_hash_map.String(Ast.Node.Index) = .empty, decl_index: Decl.Index, }; diff --git a/lib/docs/wasm/main.zig b/lib/docs/wasm/main.zig index bee3e4acbcc370261f3b137d40584ea2ad2f8065..d73f2a68160ff2db197067d8cc39e40e4998a824 100644 --- a/lib/docs/wasm/main.zig +++ b/lib/docs/wasm/main.zig @@ -264,7 +264,7 @@ const ErrorIdentifier = packed struct(u64) { }; var string_result: ArrayList(u8) = .empty; -var error_set_result: std.StringArrayHashMapUnmanaged(ErrorIdentifier) = .empty; +var error_set_result: std.array_hash_map.String(ErrorIdentifier) = .empty; export fn decl_error_set(decl_index: Decl.Index) Slice(ErrorIdentifier) { return Slice(ErrorIdentifier).init(decl_error_set_fallible(decl_index) catch @panic("OOM")); @@ -305,7 +305,7 @@ fn sort_error_set_result() void { fn addErrorsFromDecl( decl_index: Decl.Index, - out: *std.StringArrayHashMapUnmanaged(ErrorIdentifier), + out: *std.array_hash_map.String(ErrorIdentifier), ) Oom!void { switch (decl_index.get().categorize()) { .error_set => |node| try addErrorsFromExpr(decl_index, out, node), @@ -316,7 +316,7 @@ fn addErrorsFromDecl( fn addErrorsFromExpr( decl_index: Decl.Index, - out: *std.StringArrayHashMapUnmanaged(ErrorIdentifier), + out: *std.array_hash_map.String(ErrorIdentifier), node: Ast.Node.Index, ) Oom!void { const decl = decl_index.get(); @@ -343,7 +343,7 @@ fn addErrorsFromExpr( fn addErrorsFromNode( decl_index: Decl.Index, - out: *std.StringArrayHashMapUnmanaged(ErrorIdentifier), + out: *std.array_hash_map.String(ErrorIdentifier), node: Ast.Node.Index, ) Oom!void { const decl = decl_index.get(); diff --git a/lib/fuzzer.zig b/lib/fuzzer.zig index 37189a2b635f0a8c8774ee3d88d670e01bc37b90..acb23b66c58777bc2a6738081e23fcb52ee3c1d9 100644 --- a/lib/fuzzer.zig +++ b/lib/fuzzer.zig @@ -340,7 +340,7 @@ const Fuzzer = struct { quality_buf: []Input.Best, input_buf: []Input.Best.Map, }, - seen_uids: std.ArrayHashMapUnmanaged(Uid, struct { + seen_uids: std.array_hash_map.Custom(Uid, struct { slices: union { ints: std.ArrayList([]u64), bytes: std.ArrayList(Input.Data.Bytes), @@ -505,7 +505,7 @@ const Fuzzer = struct { } }; - pub const UidSlices = std.ArrayHashMapUnmanaged(Uid, struct { + pub const UidSlices = std.array_hash_map.Custom(Uid, struct { base: u32, len: u32, }, Uid.hashmap_ctx, false); @@ -584,7 +584,7 @@ const Fuzzer = struct { }; pub const Builder = struct { - uid_slices: std.ArrayHashMapUnmanaged(Uid, union { + uid_slices: std.array_hash_map.Custom(Uid, union { ints: std.MultiArrayList(struct { value: u64, order_i: u32, diff --git a/lib/std/Build.zig b/lib/std/Build.zig index 798729533c70421c8c5126a22540341f3129091d..2c9427645f71b3285f80115b8248de4add324a77 100644 --- a/lib/std/Build.zig +++ b/lib/std/Build.zig @@ -33,7 +33,7 @@ user_input_options: UserInputOptionsMap, available_options_map: std.array_hash_map.String(AvailableOption) = .empty, invalid_user_input: bool, default_step: *Step, -top_level_steps: std.StringArrayHashMapUnmanaged(*Step.TopLevel), +top_level_steps: std.array_hash_map.String(*Step.TopLevel), /// Path to the directory containing build.zig. root: Cache.Path, debug_log_scopes: []const []const u8 = &.{}, @@ -78,11 +78,11 @@ pub const Graph = struct { io: Io, /// Process lifetime. arena: Allocator, - system_integration_options: std.StringArrayHashMapUnmanaged(SystemLibraryMode) = .empty, + system_integration_options: std.array_hash_map.String(SystemLibraryMode) = .empty, system_package_mode: bool = false, zig_exe: []const u8, environ_map: process.Environ.Map, - needed_lazy_dependencies: std.StringArrayHashMapUnmanaged(void) = .empty, + needed_lazy_dependencies: std.array_hash_map.String(void) = .empty, /// Information about the native target. Computed before build() is invoked. host: ResolvedTarget, dependency_cache: InitializedDepMap = .empty, diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig index fe40251590f090d567744bcddd3451f62e52eac7..33c3148dd22080b5916100f4c3e210dabe38e14d 100644 --- a/lib/std/Build/Cache.zig +++ b/lib/std/Build/Cache.zig @@ -351,7 +351,7 @@ pub const Manifest = struct { }; }; - pub const Files = std.ArrayHashMapUnmanaged(File, void, FilesContext, false); + pub const Files = std.array_hash_map.Custom(File, void, FilesContext, false); pub const FilesContext = struct { pub fn hash(fc: FilesContext, file: File) u32 { diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index 35a07f1eb88b911f2a0303ee556de7de1bb43e93..5583b6611b474c8fe07fd5f77492967a532d5edd 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -12,7 +12,7 @@ root_source_file: ?LazyPath, /// The modules that are mapped into this module's import table. /// Use `addImport` rather than modifying this field directly in order to /// maintain step dependency edges. -import_table: std.StringArrayHashMapUnmanaged(*Module), +import_table: std.array_hash_map.String(*Module), resolved_target: ?std.Build.ResolvedTarget = null, optimize: ?std.builtin.OptimizeMode = null, @@ -22,7 +22,7 @@ c_macros: ArrayList([]const u8), include_dirs: ArrayList(IncludeDir), lib_paths: ArrayList(LazyPath), rpaths: ArrayList(RPath), -frameworks: std.StringArrayHashMapUnmanaged(LinkFrameworkOptions), +frameworks: std.array_hash_map.String(LinkFrameworkOptions), link_objects: ArrayList(LinkObject), strip: ?bool, @@ -563,7 +563,7 @@ pub fn getGraph(root: *Module) Graph { const arena = root.owner.graph.arena; - var modules: std.AutoArrayHashMapUnmanaged(*std.Build.Module, []const u8) = .empty; + var modules: std.array_hash_map.Auto(*std.Build.Module, []const u8) = .empty; var next_idx: usize = 0; modules.putNoClobber(arena, root, "root") catch @panic("OOM"); diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index d74b633fdc9e087e9638fdbb566ba8ad6f0ca9ab..5c0631fc1e5f8bfe21538671980a366b1ed50437 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -187,7 +187,7 @@ entry: Entry = .default, /// List of symbols forced as undefined in the symbol table /// thus forcing their resolution by the linker. /// Corresponds to `-u ` for ELF/MachO and `/include:` for COFF/PE. -force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), +force_undefined_symbols: std.array_hash_map.String(void), /// Overrides the default stack size stack_size: ?u64 = null, @@ -759,7 +759,7 @@ pub fn rootModuleTarget(c: *Compile) std.Target { pub fn getCompileDependencies(start: *Compile, chase_dynamic: bool) []const *Compile { const arena = start.step.owner.graph.arena; - var compiles: std.AutoArrayHashMapUnmanaged(*Compile, void) = .empty; + var compiles: std.array_hash_map.Auto(*Compile, void) = .empty; var next_idx: usize = 0; compiles.putNoClobber(arena, start, {}) catch @panic("OOM"); diff --git a/lib/std/Io/Kqueue.zig b/lib/std/Io/Kqueue.zig index 63fd846b72abecaf75f44487d6023385b486d345..45e49b0f0cadf89efee58186ac08d71f2739cfce 100644 --- a/lib/std/Io/Kqueue.zig +++ b/lib/std/Io/Kqueue.zig @@ -40,7 +40,7 @@ const Thread = struct { steal_ready_search_index: u32, /// For ensuring multiple fibers waiting on the same file descriptor and /// filter use the same kevent. - wait_queues: std.AutoArrayHashMapUnmanaged(WaitQueueKey, *Fiber), + wait_queues: std.array_hash_map.Auto(WaitQueueKey, *Fiber), const WaitQueueKey = struct { ident: usize, diff --git a/lib/std/debug/Coverage.zig b/lib/std/debug/Coverage.zig index b3e16382cc45dff17d34b9bf57f7accb63d918e5..7bbc58a5b71f541734aafd75d75fdfb2c3858efb 100644 --- a/lib/std/debug/Coverage.zig +++ b/lib/std/debug/Coverage.zig @@ -15,13 +15,13 @@ const assert = std.debug.assert; /// String memory references the memory-mapped debug information. /// /// Protected by `mutex`. -directories: std.ArrayHashMapUnmanaged(String, void, String.MapContext, false), +directories: std.array_hash_map.Custom(String, void, String.MapContext, false), /// Provides a globally-scoped integer index for files. /// /// String memory references the memory-mapped debug information. /// /// Protected by `mutex`. -files: std.ArrayHashMapUnmanaged(File, void, File.MapContext, false), +files: std.array_hash_map.Custom(File, void, File.MapContext, false), string_bytes: std.ArrayList(u8), /// Protects the other fields. mutex: Io.Mutex, diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig index 439e590daed71cf16c70d1ebea2a6943978f719f..a5f290039f4c57138832360a7fecf4183ecc04b5 100644 --- a/lib/std/debug/Dwarf.zig +++ b/lib/std/debug/Dwarf.zig @@ -134,7 +134,7 @@ pub const CompileUnit = struct { files: []FileEntry, version: u16, - pub const LineTable = std.AutoArrayHashMapUnmanaged(u64, LineEntry); + pub const LineTable = std.array_hash_map.Auto(u64, LineEntry); pub const LineEntry = struct { line: u32, diff --git a/lib/std/debug/MachOFile.zig b/lib/std/debug/MachOFile.zig index 4b2fb524bcdab99802e9001b0d340d484e6f86e2..369ee8c4bc41bf87ac8f9c3356a7ab1c532bfdad 100644 --- a/lib/std/debug/MachOFile.zig +++ b/lib/std/debug/MachOFile.zig @@ -4,7 +4,7 @@ strings: []const u8, text_vmaddr: u64, /// Key is index into `strings` of the file path. -ofiles: std.AutoArrayHashMapUnmanaged(u32, Error!OFile), +ofiles: std.array_hash_map.Auto(u32, Error!OFile), pub const Error = error{ InvalidMachO, @@ -115,7 +115,7 @@ pub fn load(gpa: Allocator, io: Io, path: []const u8, arch: std.Target.Cpu.Arch) // necessary because we prefer to use STAB ("symbolic debugging table") symbols, // but they might not be present, so we track normal symbols too. // Indices match 1-1 with those of `symbols`. - var symbol_names: std.StringArrayHashMapUnmanaged(void) = .empty; + var symbol_names: std.array_hash_map.String(void) = .empty; defer symbol_names.deinit(gpa); try symbol_names.ensureUnusedCapacity(gpa, symtab.nsyms); @@ -305,7 +305,7 @@ const OFile = struct { symtab_raw: []align(1) const macho.nlist_64, /// All named symbols in `symtab_raw`. Stored `u32` key is the index into `symtab_raw`. Accessed /// through `SymbolAdapter`, so that the symbol name is used as the logical key. - symbols_by_name: std.ArrayHashMapUnmanaged(u32, void, void, true), + symbols_by_name: std.array_hash_map.Custom(u32, void, void, true), const SymbolAdapter = struct { strtab: []const u8, @@ -380,7 +380,7 @@ test { fn appendStabSymbol( symbols: *std.ArrayList(Symbol), - symbol_names: *std.StringArrayHashMapUnmanaged(void), + symbol_names: *std.array_hash_map.String(void), strings: []const u8, last_sym: Symbol, ) void { @@ -476,7 +476,7 @@ fn loadOFile(gpa: Allocator, io: Io, o_file_name: []const u8) !OFile { const symtab_raw: []align(1) const macho.nlist_64 = @ptrCast(mapped_ofile[symtab_cmd.symoff..][0..n_sym_bytes]); // TODO handle tentative (common) symbols - var symbols_by_name: std.ArrayHashMapUnmanaged(u32, void, void, true) = .empty; + var symbols_by_name: std.array_hash_map.Custom(u32, void, void, true) = .empty; defer symbols_by_name.deinit(gpa); try symbols_by_name.ensureUnusedCapacity(gpa, @intCast(symtab_raw.len)); for (symtab_raw, 0..) |sym_raw, sym_index| { diff --git a/lib/std/debug/SelfInfo/MachO.zig b/lib/std/debug/SelfInfo/MachO.zig index 431108cd3f6164769359902f1abccdec720516df..e771d7a9f5e45b3b5c217053f3394fd7b713a029 100644 --- a/lib/std/debug/SelfInfo/MachO.zig +++ b/lib/std/debug/SelfInfo/MachO.zig @@ -1,6 +1,6 @@ mutex: Io.Mutex, /// Accessed through `Module.Adapter`. -modules: std.ArrayHashMapUnmanaged(Module, void, Module.Context, false), +modules: std.array_hash_map.Custom(Module, void, Module.Context, false), pub const init: SelfInfo = .{ .mutex = .init, diff --git a/lib/std/json/hashmap.zig b/lib/std/json/hashmap.zig index be4e9bd2dd5a4359c6ed2a0b6be704369fc314e9..7a88f6ea0d3a2ae1d40f2a9a522ebd0bc0ec63f4 100644 --- a/lib/std/json/hashmap.zig +++ b/lib/std/json/hashmap.zig @@ -6,20 +6,20 @@ const innerParse = @import("static.zig").innerParse; const innerParseFromValue = @import("static.zig").innerParseFromValue; const Value = @import("dynamic.zig").Value; -/// A thin wrapper around `std.StringArrayHashMapUnmanaged` that implements +/// A thin wrapper around `std.array_hash_map.String` that implements /// `jsonParse`, `jsonParseFromValue`, and `jsonStringify`. /// This is useful when your JSON schema has an object with arbitrary data keys /// instead of comptime-known struct field names. pub fn ArrayHashMap(comptime T: type) type { return struct { - map: std.StringArrayHashMapUnmanaged(T) = .empty, + map: std.array_hash_map.String(T) = .empty, pub fn deinit(self: *@This(), allocator: Allocator) void { self.map.deinit(allocator); } pub fn jsonParse(allocator: Allocator, source: anytype, options: ParseOptions) !@This() { - var map: std.StringArrayHashMapUnmanaged(T) = .empty; + var map: std.array_hash_map.String(T) = .empty; errdefer map.deinit(allocator); if (.object_begin != try source.next()) return error.UnexpectedToken; @@ -52,7 +52,7 @@ pub fn ArrayHashMap(comptime T: type) type { pub fn jsonParseFromValue(allocator: Allocator, source: Value, options: ParseOptions) !@This() { if (source != .object) return error.UnexpectedToken; - var map: std.StringArrayHashMapUnmanaged(T) = .empty; + var map: std.array_hash_map.String(T) = .empty; errdefer map.deinit(allocator); var it = source.object.iterator(); diff --git a/lib/std/process/Environ.zig b/lib/std/process/Environ.zig index bf0408c31ddc4eebf48a08dea54b6391a524e012..a2b2f4110f499171a09ffb42c3d631f7e48faee7 100644 --- a/lib/std/process/Environ.zig +++ b/lib/std/process/Environ.zig @@ -101,7 +101,7 @@ pub const Map = struct { array_hash_map: ArrayHashMap, allocator: Allocator, - const ArrayHashMap = std.ArrayHashMapUnmanaged([]const u8, []const u8, EnvNameHashContext, false); + const ArrayHashMap = std.array_hash_map.Custom([]const u8, []const u8, EnvNameHashContext, false); pub const Size = usize; diff --git a/lib/std/process/Preopens.zig b/lib/std/process/Preopens.zig index 3baf696ee9a5d95dbf2bed352ea4867e8c3fde8c..6a7337a31e9bcaf207af9d2ab501448a95649cc3 100644 --- a/lib/std/process/Preopens.zig +++ b/lib/std/process/Preopens.zig @@ -16,7 +16,7 @@ pub const empty: Preopens = switch (native_os) { pub const Map = switch (native_os) { // Indexed by file descriptor number. - .wasi => std.StringArrayHashMapUnmanaged(void), + .wasi => std.array_hash_map.String(void), else => void, }; diff --git a/lib/std/zig/Ast/Render.zig b/lib/std/zig/Ast/Render.zig index 6c8c0c9143d147b0f2483148f305c7b00c1cf304..8f5b2e2c276f5b8680fb56173154bcbdbf8966e6 100644 --- a/lib/std/zig/Ast/Render.zig +++ b/lib/std/zig/Ast/Render.zig @@ -42,7 +42,7 @@ pub const Fixups = struct { /// These nodes will be replaced with a different node. replace_nodes_with_node: std.AutoHashMapUnmanaged(Ast.Node.Index, Ast.Node.Index) = .empty, /// Change all identifier names matching the key to be value instead. - rename_identifiers: std.StringArrayHashMapUnmanaged([]const u8) = .empty, + rename_identifiers: std.array_hash_map.String([]const u8) = .empty, /// All `@import` builtin calls which refer to a file path will be prefixed /// with this path. diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig index 21287babeb34826d42ab612fb8143fd2ae344044..06621ea29e1ca672a904ebf7e47546f3a4d823a4 100644 --- a/lib/std/zig/AstGen.zig +++ b/lib/std/zig/AstGen.zig @@ -52,7 +52,7 @@ within_fn: bool = false, fn_ret_ty: Zir.Inst.Ref = .none, /// Maps string table indexes to the first `@import` ZIR instruction /// that uses this string as the operand. -imports: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .empty, +imports: std.array_hash_map.Auto(Zir.NullTerminatedString, Ast.TokenIndex) = .empty, /// Used for temporary storage when building payloads. scratch: std.ArrayList(u32) = .empty, /// Whenever a `ref` instruction is needed, it is created and saved in this @@ -11163,7 +11163,7 @@ const Scope = struct { declaring_gz: ?*GenZir, /// Set of captures used by this namespace. - captures: std.AutoArrayHashMapUnmanaged(Zir.Inst.Capture, Zir.NullTerminatedString) = .empty, + captures: std.array_hash_map.Auto(Zir.Inst.Capture, Zir.NullTerminatedString) = .empty, fn deinit(self: *Namespace, gpa: Allocator) void { self.decls.deinit(gpa); @@ -12856,9 +12856,9 @@ fn scanContainer( var bfa_state: std.heap.BufferFirstAllocator = .init(&bfa_buf, astgen.gpa); const bfa = bfa_state.allocator(); - var names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; - var test_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; - var decltest_names: std.AutoArrayHashMapUnmanaged(Zir.NullTerminatedString, NameEntry) = .empty; + var names: std.array_hash_map.Auto(Zir.NullTerminatedString, NameEntry) = .empty; + var test_names: std.array_hash_map.Auto(Zir.NullTerminatedString, NameEntry) = .empty; + var decltest_names: std.array_hash_map.Auto(Zir.NullTerminatedString, NameEntry) = .empty; defer { names.deinit(bfa); test_names.deinit(bfa); diff --git a/lib/std/zig/llvm/Builder.zig b/lib/std/zig/llvm/Builder.zig index 27a1532aab387624bb127e6ee5f2ad341f989ea8..e0c4de018c6d146018d3d8c8f74c641bedf60193 100644 --- a/lib/std/zig/llvm/Builder.zig +++ b/lib/std/zig/llvm/Builder.zig @@ -21,25 +21,25 @@ data_layout: String, target_triple: String, module_asm: std.ArrayList(u8), -string_map: std.AutoArrayHashMapUnmanaged(void, void), +string_map: std.array_hash_map.Auto(void, void), string_indices: std.ArrayList(u32), string_bytes: std.ArrayList(u8), -types: std.AutoArrayHashMapUnmanaged(String, Type), +types: std.array_hash_map.Auto(String, Type), next_unnamed_type: String, next_unique_type_id: std.AutoHashMapUnmanaged(String, u32), -type_map: std.AutoArrayHashMapUnmanaged(void, void), +type_map: std.array_hash_map.Auto(void, void), type_items: std.ArrayList(Type.Item), type_extra: std.ArrayList(u32), -attributes: std.AutoArrayHashMapUnmanaged(Attribute.Storage, void), -attributes_map: std.AutoArrayHashMapUnmanaged(void, void), +attributes: std.array_hash_map.Auto(Attribute.Storage, void), +attributes_map: std.array_hash_map.Auto(void, void), attributes_indices: std.ArrayList(u32), attributes_extra: std.ArrayList(u32), -function_attributes_set: std.AutoArrayHashMapUnmanaged(FunctionAttributes, void), +function_attributes_set: std.array_hash_map.Auto(FunctionAttributes, void), -globals: std.AutoArrayHashMapUnmanaged(StrtabString, Global), +globals: std.array_hash_map.Auto(StrtabString, Global), next_unnamed_global: StrtabString, next_replaced_global: StrtabString, next_unique_global_id: std.AutoHashMapUnmanaged(StrtabString, u32), @@ -47,28 +47,28 @@ aliases: std.ArrayList(Alias), variables: std.ArrayList(Variable), functions: std.ArrayList(Function), -strtab_string_map: std.AutoArrayHashMapUnmanaged(void, void), +strtab_string_map: std.array_hash_map.Auto(void, void), strtab_string_indices: std.ArrayList(u32), strtab_string_bytes: std.ArrayList(u8), -constant_map: std.AutoArrayHashMapUnmanaged(void, void), +constant_map: std.array_hash_map.Auto(void, void), constant_items: std.MultiArrayList(Constant.Item), constant_extra: std.ArrayList(u32), constant_limbs: std.ArrayList(std.math.big.Limb), alignment_forward_references: std.ArrayList(Alignment), -metadata_map: std.AutoArrayHashMapUnmanaged(void, void), +metadata_map: std.array_hash_map.Auto(void, void), metadata_items: std.MultiArrayList(Metadata.Item), metadata_extra: std.ArrayList(u32), metadata_limbs: std.ArrayList(std.math.big.Limb), metadata_forward_references: std.ArrayList(Metadata.Optional), -metadata_named: std.AutoArrayHashMapUnmanaged(String, struct { +metadata_named: std.array_hash_map.Auto(String, struct { len: u32, index: Metadata.Item.ExtraIndex, }), -metadata_string_map: std.AutoArrayHashMapUnmanaged(void, void), +metadata_string_map: std.array_hash_map.Auto(void, void), metadata_string_indices: std.ArrayList(u32), metadata_string_bytes: std.ArrayList(u8), @@ -1633,7 +1633,7 @@ pub const FunctionAttributes = enum(u32) { pub const Wip = struct { maps: Maps = .empty, - const Map = std.AutoArrayHashMapUnmanaged(Attribute.Kind, Attribute.Index); + const Map = std.array_hash_map.Auto(Attribute.Kind, Attribute.Index); const Maps = std.ArrayList(Map); pub fn deinit(self: *Wip, builder: *const Builder) void { @@ -5235,8 +5235,8 @@ pub const WipFunction = struct { instructions: std.MultiArrayList(Instruction), names: std.ArrayList(String), strip: bool, - debug_locations: std.AutoArrayHashMapUnmanaged(Instruction.Index, DebugLocation), - debug_values: std.AutoArrayHashMapUnmanaged(Instruction.Index, void), + debug_locations: std.array_hash_map.Auto(Instruction.Index, DebugLocation), + debug_values: std.array_hash_map.Auto(Instruction.Index, void), extra: std.ArrayList(u32), pub const Cursor = struct { block: Block.Index, instruction: u32 = 0 }; @@ -8451,7 +8451,7 @@ pub const Metadata = packed struct(u32) { const Formatter = struct { builder: *Builder, need_comma: bool, - map: std.AutoArrayHashMapUnmanaged(union(enum) { + map: std.array_hash_map.Auto(union(enum) { metadata: Metadata, debug_location: DebugLocation.Location, }, void) = .empty, @@ -9791,7 +9791,7 @@ pub fn print(self: *Builder, w: *Writer) (Writer.Error || Allocator.Error)!void } } - var attribute_groups: std.AutoArrayHashMapUnmanaged(Attributes, void) = .empty; + var attribute_groups: std.array_hash_map.Auto(Attributes, void) = .empty; defer attribute_groups.deinit(self.gpa); for (0.., self.functions.items) |function_i, function| { @@ -13507,7 +13507,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco try type_block.end(); } - var attributes_set: std.AutoArrayHashMapUnmanaged(struct { + var attributes_set: std.array_hash_map.Auto(struct { attributes: Attributes, index: u32, }, void) = .{}; @@ -13743,7 +13743,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco try paramattr_block.end(); } - var globals: std.AutoArrayHashMapUnmanaged(Global.Index, void) = .empty; + var globals: std.array_hash_map.Auto(Global.Index, void) = .empty; defer globals.deinit(self.gpa); try globals.ensureUnusedCapacity( self.gpa, @@ -13784,7 +13784,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco const ConstantAdapter = struct { builder: *const Builder, - globals: *const std.AutoArrayHashMapUnmanaged(Global.Index, void), + globals: *const std.array_hash_map.Auto(Global.Index, void), pub fn get(adapter: @This(), param: anytype) switch (@TypeOf(param)) { Constant => u32, @@ -13815,7 +13815,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator, producer: Producer) bitco // Globals { - var section_map: std.AutoArrayHashMapUnmanaged(String, void) = .empty; + var section_map: std.array_hash_map.Auto(String, void) = .empty; defer section_map.deinit(self.gpa); try section_map.ensureUnusedCapacity(self.gpa, globals.count()); diff --git a/src/Compilation.zig b/src/Compilation.zig index 03a6904413a05002277d8b93701a0957582f8226..e4ba55d477b8cb05b46b63b74a51c01913c19469 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -87,7 +87,7 @@ link_inputs: []const link.Input, framework_dirs: []const []const u8, /// These are only for DLLs dependencies fulfilled by the `.def` files shipped /// with Zig. Static libraries are provided as `link.Input` values. -windows_libs: std.StringArrayHashMapUnmanaged(void), +windows_libs: std.array_hash_map.String(void), /// The number of items in `windows_libs` which we have already built. All items at or after this /// index will be built in `performAllTheWork`. windows_libs_num_done: u32, @@ -101,10 +101,10 @@ native_system_include_paths: []const []const u8, /// List of symbols forced as undefined in the symbol table /// thus forcing their resolution by the linker. /// Corresponds to `-u ` for ELF/MachO and `/include:` for COFF/PE. -force_undefined_symbols: std.StringArrayHashMapUnmanaged(void), +force_undefined_symbols: std.array_hash_map.String(void), -c_object_table: std.AutoArrayHashMapUnmanaged(*CObject, void) = .empty, -win32_resource_table: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, void) else struct { +c_object_table: std.array_hash_map.Auto(*CObject, void) = .empty, +win32_resource_table: if (dev.env.supports(.win32_resource)) std.array_hash_map.Auto(*Win32Resource, void) else struct { pub fn keys(_: @This()) [0]void { return .{}; } @@ -145,11 +145,11 @@ win32_resource_work_queue: if (dev.env.supports(.win32_resource)) std.Deque(*Win /// The ErrorMsg memory is owned by the `CObject`, using Compilation's general purpose allocator. /// This data is accessed by multiple threads and is protected by `mutex`. -failed_c_objects: std.AutoArrayHashMapUnmanaged(*CObject, *CObject.Diag.Bundle) = .empty, +failed_c_objects: std.array_hash_map.Auto(*CObject, *CObject.Diag.Bundle) = .empty, /// The ErrorBundle memory is owned by the `Win32Resource`, using Compilation's general purpose allocator. /// This data is accessed by multiple threads and is protected by `mutex`. -failed_win32_resources: if (dev.env.supports(.win32_resource)) std.AutoArrayHashMapUnmanaged(*Win32Resource, ErrorBundle) else struct { +failed_win32_resources: if (dev.env.supports(.win32_resource)) std.array_hash_map.Auto(*Win32Resource, ErrorBundle) else struct { pub fn values(_: @This()) [0]void { return .{}; } @@ -157,7 +157,7 @@ failed_win32_resources: if (dev.env.supports(.win32_resource)) std.AutoArrayHash } = .{}, /// Miscellaneous things that can fail. -misc_failures: std.AutoArrayHashMapUnmanaged(MiscTask, MiscError) = .empty, +misc_failures: std.array_hash_map.Auto(MiscTask, MiscError) = .empty, /// When this is `true` it means invoking clang as a sub-process is expected to inherit /// stdin, stdout, stderr, and if it returns non success, to forward the exit code. @@ -865,7 +865,7 @@ pub const TimeReport = struct { /// a function) all generic instances of this function. It also includes time spent analyzing /// function bodies if this is a function (generic or otherwise). /// An entry not existing means the declaration has not been analyzed (so far). - decl_sema_info: std.AutoArrayHashMapUnmanaged(InternPool.TrackedInst.Index, struct { + decl_sema_info: std.array_hash_map.Auto(InternPool.TrackedInst.Index, struct { ns: u64, count: u32, }), @@ -875,14 +875,14 @@ pub const TimeReport = struct { /// instances, both of this function itself and of its parent namespace. /// An entry not existing means the declaration has not been codegenned (so far). /// Every key in `decl_codegen_ns` is also in `decl_sema_ns`. - decl_codegen_ns: std.AutoArrayHashMapUnmanaged(InternPool.TrackedInst.Index, u64), + decl_codegen_ns: std.array_hash_map.Auto(InternPool.TrackedInst.Index, u64), /// Key is a ZIR `declaration` instruction which is anything other than a `comptime` decl; value /// is the number of nanoseconds spent linking it into the binary. As above, this is the total /// across all generic instances. /// An entry not existing means the declaration has not been linked (so far). /// Every key in `decl_link_ns` is also in `decl_sema_ns`. - decl_link_ns: std.AutoArrayHashMapUnmanaged(InternPool.TrackedInst.Index, u64), + decl_link_ns: std.array_hash_map.Auto(InternPool.TrackedInst.Index, u64), pub fn deinit(tr: *TimeReport, gpa: Allocator) void { tr.stats = undefined; @@ -1068,8 +1068,8 @@ pub const CObject = struct { } pub const Bundle = struct { - file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty, - category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty, + file_names: std.array_hash_map.Auto(u32, []const u8) = .empty, + category_names: std.array_hash_map.Auto(u32, []const u8) = .empty, diags: []Diag = &.{}, pub fn destroy(bundle: *Bundle, gpa: Allocator) void { @@ -1122,13 +1122,13 @@ pub const CObject = struct { var bc = std.zig.llvm.BitcodeReader.init(gpa, .{ .reader = &file_reader.interface }); defer bc.deinit(); - var file_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty; + var file_names: std.array_hash_map.Auto(u32, []const u8) = .empty; errdefer { for (file_names.values()) |file_name| gpa.free(file_name); file_names.deinit(gpa); } - var category_names: std.AutoArrayHashMapUnmanaged(u32, []const u8) = .empty; + var category_names: std.array_hash_map.Auto(u32, []const u8) = .empty; errdefer { for (category_names.values()) |category_name| gpa.free(category_name); category_names.deinit(gpa); @@ -1604,7 +1604,7 @@ pub const CreateOptions = struct { /// implementations still do. lib_directories: []const Cache.Directory = &.{}, rpath_list: []const []const u8 = &[0][]const u8{}, - symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty, + symbol_wrap_set: std.array_hash_map.String(void) = .empty, c_source_files: []const CSourceFile = &.{}, rc_source_files: []const RcSourceFile = &.{}, manifest_file: ?[]const u8 = null, @@ -1683,7 +1683,7 @@ pub const CreateOptions = struct { skip_linker_dependencies: bool = false, hash_style: link.File.Lld.Elf.HashStyle = .both, entry: Entry = .default, - force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty, + force_undefined_symbols: std.array_hash_map.String(void) = .empty, stack_size: ?u64 = null, image_base: ?u64 = null, version: ?std.SemanticVersion = null, @@ -4064,7 +4064,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) error{OutOfMemory}!ErrorBundle { } } if (zcu.skip_analysis_this_update) break :zcu_errors; - var sorted_failed_analysis: std.AutoArrayHashMapUnmanaged(InternPool.AnalUnit, *Zcu.ErrorMsg).DataList.Slice = s: { + var sorted_failed_analysis: std.array_hash_map.Auto(InternPool.AnalUnit, *Zcu.ErrorMsg).DataList.Slice = s: { const SortOrder = struct { zcu: *Zcu, errors: []const *Zcu.ErrorMsg, @@ -4360,7 +4360,7 @@ pub fn addModuleErrorMsg( // De-duplicate error notes. The main use case in mind for this is // too many "note: called from here" notes when eval branch quota is reached. - var notes: std.ArrayHashMapUnmanaged(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .empty; + var notes: std.array_hash_map.Custom(ErrorBundle.ErrorMessage, void, ErrorNoteHashContext, true) = .empty; defer notes.deinit(gpa); var last_note_loc: ?std.zig.Loc = null; @@ -4831,7 +4831,7 @@ fn docsCopyFallible(comp: *Compilation) anyerror!void { var buffer: [1024]u8 = undefined; var tar_file_writer = tar_file.writer(io, &buffer); - var seen_table: std.AutoArrayHashMapUnmanaged(*Package.Module, []const u8) = .empty; + var seen_table: std.array_hash_map.Auto(*Package.Module, []const u8) = .empty; defer seen_table.deinit(comp.gpa); try seen_table.put(comp.gpa, zcu.main_mod, comp.root_name); diff --git a/src/InternPool.zig b/src/InternPool.zig index e570aad1daa67f50bdf274d60d502f0a25ebc1c3..48af82b0410200295484bbae55f9e09d78dfac29 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -41,22 +41,22 @@ tid_shift_32: if (single_threaded) u0 else std.math.Log2Int(u32), /// * For a `func`, this is the source of the full function signature. /// These are also invalidated if tracking fails for this instruction. /// Value is index into `dep_entries` of the first dependency on this hash. -src_hash_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index), +src_hash_deps: std.array_hash_map.Auto(TrackedInst.Index, DepEntry.Index), /// Dependencies on the value of a Nav. /// Value is index into `dep_entries` of the first dependency on this Nav value. -nav_val_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index), +nav_val_deps: std.array_hash_map.Auto(Nav.Index, DepEntry.Index), /// Dependencies on the type of a Nav. /// Value is index into `dep_entries` of the first dependency on this Nav value. -nav_ty_deps: std.AutoArrayHashMapUnmanaged(Nav.Index, DepEntry.Index), +nav_ty_deps: std.array_hash_map.Auto(Nav.Index, DepEntry.Index), /// Dependencies on a function's inferred error set. Key is the function body, not the IES. /// Value is index into `dep_entries` of the first dependency on this function's IES. -func_ies_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index), +func_ies_deps: std.array_hash_map.Auto(Index, DepEntry.Index), /// Dependencies on the resolved layout of a `struct`, `union`, or `enum` type. /// Value is index into `dep_entries` of the first dependency on this type's layout. -type_layout_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index), +type_layout_deps: std.array_hash_map.Auto(Index, DepEntry.Index), /// Dependencies on the resolved default field values of a `struct` type. /// Value is index into `dep_entries` of the first dependency on this type's inits. -struct_defaults_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index), +struct_defaults_deps: std.array_hash_map.Auto(Index, DepEntry.Index), /// Dependencies on a Zig or ZON source file. Triggered by `@import`. /// * For ZON source files, the dependency is invalidated if the file changes at all. The `@import` /// must be re-analyzed to return the new data structure. @@ -64,18 +64,18 @@ struct_defaults_deps: std.AutoArrayHashMapUnmanaged(Index, DepEntry.Index), /// (which can only happen because the `.main_struct_inst` got lost). The `@import` must be /// re-analyzed to return the new type. /// Value is index into `dep_entries` of the first dependency on this Zig/ZON file. -source_file_deps: std.AutoArrayHashMapUnmanaged(FileIndex, DepEntry.Index), +source_file_deps: std.array_hash_map.Auto(FileIndex, DepEntry.Index), /// Dependencies on an embedded file. /// Introduced by `@embedFile`; invalidated when the file changes. /// Value is index into `dep_entries` of the first dependency on this `Zcu.EmbedFile`. -embed_file_deps: std.AutoArrayHashMapUnmanaged(Zcu.EmbedFile.Index, DepEntry.Index), +embed_file_deps: std.array_hash_map.Auto(Zcu.EmbedFile.Index, DepEntry.Index), /// Dependencies on the full set of names in a ZIR namespace. /// Key refers to a `struct_decl`, `union_decl`, etc. /// Value is index into `dep_entries` of the first dependency on this namespace. -namespace_deps: std.AutoArrayHashMapUnmanaged(TrackedInst.Index, DepEntry.Index), +namespace_deps: std.array_hash_map.Auto(TrackedInst.Index, DepEntry.Index), /// Dependencies on the (non-)existence of some name in a namespace. /// Value is index into `dep_entries` of the first dependency on this name. -namespace_name_deps: std.AutoArrayHashMapUnmanaged(NamespaceNameKey, DepEntry.Index), +namespace_name_deps: std.array_hash_map.Auto(NamespaceNameKey, DepEntry.Index), // Dependencies on the value of fields memoized on `Zcu` (`panic_messages` etc). // If set, these are indices into `dep_entries` of the first dependency on this state. memoized_state_main_deps: DepEntry.Index.Optional, @@ -86,7 +86,7 @@ memoized_state_assembly_deps: DepEntry.Index.Optional, /// Given a `Depender`, points to an entry in `dep_entries` whose `depender` /// matches. The `next_dependee` field can be used to iterate all such entries /// and remove them from the corresponding lists. -first_dependency: std.AutoArrayHashMapUnmanaged(AnalUnit, DepEntry.Index), +first_dependency: std.array_hash_map.Auto(AnalUnit, DepEntry.Index), /// Stores dependency information. The hashmaps declared above are used to look /// up entries in this list as required. This is not stored in `extra` so that @@ -1587,7 +1587,7 @@ fn getIndexMask(ip: *const InternPool, comptime BackingInt: type) u32 { return @as(u32, std.math.maxInt(BackingInt)) >> ip.tid_width; } -const FieldMap = std.ArrayHashMapUnmanaged(void, void, std.array_hash_map.AutoContext(void), false); +const FieldMap = std.array_hash_map.Custom(void, void, std.array_hash_map.AutoContext(void), false); /// An index into `maps` which might be `none`. pub const OptionalMapIndex = enum(u32) { @@ -11039,7 +11039,7 @@ pub fn dumpGenericInstancesFallible(ip: *const InternPool, allocator: Allocator, defer arena_allocator.deinit(); const arena = arena_allocator.allocator(); - var instances: std.AutoArrayHashMapUnmanaged(Index, std.ArrayList(Index)) = .empty; + var instances: std.array_hash_map.Auto(Index, std.ArrayList(Index)) = .empty; for (ip.locals, 0..) |*local, tid| { const items = local.shared.items.view().slice(); const extra_list = local.shared.extra; diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig index d5e0c3e615c687b775852f65a9d1df9393ec852e..20e19cdaa7ad2e55b9ddb07f490df1ffdaa26eea 100644 --- a/src/Package/Fetch.zig +++ b/src/Package/Fetch.zig @@ -162,9 +162,9 @@ pub const JobQueue = struct { /// Both non-lazy and lazy dependencies are always fetched. all, }; - pub const Table = std.AutoArrayHashMapUnmanaged(Package.Hash, *Fetch); - pub const UnlazySet = std.AutoArrayHashMapUnmanaged(Package.Hash, void); - pub const ForkSet = std.ArrayHashMapUnmanaged(Fork, void, Fork.Context, false); + pub const Table = std.array_hash_map.Auto(Package.Hash, *Fetch); + pub const UnlazySet = std.array_hash_map.Auto(Package.Hash, void); + pub const ForkSet = std.array_hash_map.Custom(Fork, void, Fork.Context, false); pub const Fork = struct { path: Cache.Path, @@ -1725,7 +1725,7 @@ fn computeHash(f: *Fetch, pkg_path: Cache.Path, filter: Filter) RunError!Compute // Track directories which had any files deleted from them so that empty directories // can be deleted. - var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .empty; + var sus_dirs: std.array_hash_map.String(void) = .empty; defer sus_dirs.deinit(gpa); var walker = try root_dir.walk(gpa); @@ -2002,7 +2002,7 @@ fn normalizePath(bytes: []u8) void { } const Filter = struct { - include_paths: std.StringArrayHashMapUnmanaged(void) = .empty, + include_paths: std.array_hash_map.String(void) = .empty, /// sub_path is relative to the package root. pub fn includePath(self: *const Filter, sub_path: []const u8) bool { diff --git a/src/Package/Manifest.zig b/src/Package/Manifest.zig index 05ca2a31c25d6939bc190f19b79cc9d53bea2647..849fc742ec5c7b5be02a2895f54f99fece02b2ff 100644 --- a/src/Package/Manifest.zig +++ b/src/Package/Manifest.zig @@ -42,9 +42,9 @@ name: []const u8, id: u32, version: std.SemanticVersion, version_node: Ast.Node.Index, -dependencies: std.StringArrayHashMapUnmanaged(Dependency), +dependencies: std.array_hash_map.String(Dependency), dependencies_node: Ast.Node.OptionalIndex, -paths: std.StringArrayHashMapUnmanaged(void), +paths: std.array_hash_map.String(void), minimum_zig_version: ?std.SemanticVersion, errors: []ErrorMessage, @@ -144,9 +144,9 @@ const Parse = struct { id: u32, version: std.SemanticVersion, version_node: Ast.Node.Index, - dependencies: std.StringArrayHashMapUnmanaged(Dependency), + dependencies: std.array_hash_map.String(Dependency), dependencies_node: Ast.Node.OptionalIndex, - paths: std.StringArrayHashMapUnmanaged(void), + paths: std.array_hash_map.String(void), allow_missing_paths_field: bool, minimum_zig_version: ?std.SemanticVersion, diff --git a/src/Package/Module.zig b/src/Package/Module.zig index 9241293d1dd480b1d9046c26e2d419a6874d2556..0c7e4166adf7d6c290cbb330bb12857c1cf21d90 100644 --- a/src/Package/Module.zig +++ b/src/Package/Module.zig @@ -35,11 +35,11 @@ cc_argv: []const []const u8, structured_cfg: bool, no_builtin: bool, -pub const Deps = std.StringArrayHashMapUnmanaged(*Module); +pub const Deps = std.array_hash_map.String(*Module); pub const Tree = struct { /// Each `Package` exposes a `Module` with build.zig as its root source file. - build_module_table: std.AutoArrayHashMapUnmanaged(MultiHashHexDigest, *Module), + build_module_table: std.array_hash_map.Auto(MultiHashHexDigest, *Module), }; pub const CreateOptions = struct { diff --git a/src/Sema.zig b/src/Sema.zig index b11bce351fd901eaf56a3371abb7621dcd31990b..5428a30d65cd4fa823e4943153481cada2ea3c47 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -88,7 +88,7 @@ err: ?*Zcu.ErrorMsg = null, /// The temporary arena is used for the memory of the `InferredAlloc` values /// here so the values can be dropped without any cleanup. -unresolved_inferred_allocs: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InferredAlloc) = .empty, +unresolved_inferred_allocs: std.array_hash_map.Auto(Air.Inst.Index, InferredAlloc) = .empty, /// Links every pointer derived from a base `alloc` back to that `alloc`. Used /// to detect comptime-known `const`s. @@ -119,13 +119,13 @@ exports: std.ArrayList(Zcu.Export) = .empty, /// All references registered so far by this `Sema`. This is a temporary duplicate /// of data stored in `Zcu.all_references`. It exists to avoid adding references to /// a given `AnalUnit` multiple times. -references: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, -type_references: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty, +references: std.array_hash_map.Auto(AnalUnit, void) = .empty, +type_references: std.array_hash_map.Auto(InternPool.Index, void) = .empty, /// All dependencies registered so far by this `Sema`. This is a temporary duplicate /// of the main dependency data. It exists to avoid adding dependencies to a given /// `AnalUnit` multiple times. -dependencies: std.AutoArrayHashMapUnmanaged(InternPool.Dependee, void) = .empty, +dependencies: std.array_hash_map.Auto(InternPool.Dependee, void) = .empty, /// Whether memoization of this call is permitted. Operations with side effects global /// to the `Sema`, such as `@setEvalBranchQuota`, set this to `false`. It is observed @@ -212,11 +212,11 @@ pub const InferredErrorSet = struct { /// are returned from any dependent functions. errors: NameMap = .{}, /// Other inferred error sets which this inferred error set should include. - inferred_error_sets: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty, + inferred_error_sets: std.array_hash_map.Auto(InternPool.Index, void) = .empty, /// The regular error set created by resolving this inferred error set. resolved: InternPool.Index = .none, - pub const NameMap = std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void); + pub const NameMap = std.array_hash_map.Auto(InternPool.NullTerminatedString, void); pub fn addErrorSet( self: *InferredErrorSet, diff --git a/src/Type.zig b/src/Type.zig index b86573dcc92be4bf24bc8ff9be2e2a4d4b9b8cd2..3f45e0c6e7b74cf9fac12a3ce50f43ed3d50c3fe 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -3340,7 +3340,7 @@ pub fn assertHasLayout(ty: Type, zcu: *const Zcu) void { } /// Recursively walks the type and marks for each subtype how many times it has been seen -fn collectSubtypes(ty: Type, pt: Zcu.PerThread, visited: *std.AutoArrayHashMapUnmanaged(Type, u16)) error{OutOfMemory}!void { +fn collectSubtypes(ty: Type, pt: Zcu.PerThread, visited: *std.array_hash_map.Auto(Type, u16)) error{OutOfMemory}!void { const zcu = pt.zcu; const ip = &zcu.intern_pool; @@ -3455,8 +3455,8 @@ fn shouldDedupeType(ty: Type, ctx: *Comparison, pt: Zcu.PerThread) error{OutOfMe /// the subtype length and number of occurences. Placeholders are then found by /// iterating `type_dedupe_cache` which caches the inline/placeholder decisions. pub const Comparison = struct { - type_occurrences: std.AutoArrayHashMapUnmanaged(Type, u16), - type_dedupe_cache: std.AutoArrayHashMapUnmanaged(Type, DedupeEntry), + type_occurrences: std.array_hash_map.Auto(Type, u16), + type_dedupe_cache: std.array_hash_map.Auto(Type, DedupeEntry), placeholder_index: u8, pub const Placeholder = struct { diff --git a/src/Zcu.zig b/src/Zcu.zig index d1b0fe3eaf69205ea057116ae0c4a5d2247efa52..8c4ae90ac98908a9249baac8b40b82c1867f86bd 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -97,20 +97,20 @@ free_exports: std.ArrayList(Export.Index) = .empty, /// Maps from an `AnalUnit` which performs a single export, to the index into `all_exports` of /// the export it performs. Note that the key is not the `Decl` being exported, but the `AnalUnit` /// whose analysis triggered the export. -single_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, Export.Index) = .empty, +single_exports: std.array_hash_map.Auto(AnalUnit, Export.Index) = .empty, /// Like `single_exports`, but for `AnalUnit`s which perform multiple exports. /// The exports are `all_exports.items[index..][0..len]`. -multi_exports: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { +multi_exports: std.array_hash_map.Auto(AnalUnit, extern struct { index: u32, len: u32, }) = .{}, /// Key is the digest returned by `Builtin.hash`; value is the corresponding module. -builtin_modules: std.AutoArrayHashMapUnmanaged(Cache.BinDigest, *Package.Module) = .empty, +builtin_modules: std.array_hash_map.Auto(Cache.BinDigest, *Package.Module) = .empty, /// Populated as soon as the `Compilation` is created. Guaranteed to contain all modules, even builtin ones. /// Modules whose root file is not a Zig or ZON file have the value `.none`. -module_roots: std.AutoArrayHashMapUnmanaged(*Package.Module, File.Index.Optional) = .empty, +module_roots: std.array_hash_map.Auto(*Package.Module, File.Index.Optional) = .empty, /// The set of all the Zig source files in the Zig Compilation Unit. Tracked in /// order to iterate over it and check which source files have been modified on @@ -125,7 +125,7 @@ module_roots: std.AutoArrayHashMapUnmanaged(*Package.Module, File.Index.Optional /// /// Not serialized. This state is reconstructed during the first call to /// `Compilation.update` of the process for a given `Compilation`. -import_table: std.ArrayHashMapUnmanaged( +import_table: std.array_hash_map.Custom( File.Index, void, struct { @@ -141,7 +141,7 @@ import_table: std.ArrayHashMapUnmanaged( /// update removes an import, or if a module specified on the CLI is never imported. /// Reconstructed on every update, after AstGen and before Sema. /// Value is why the file is alive. -alive_files: std.AutoArrayHashMapUnmanaged(File.Index, File.Reference) = .empty, +alive_files: std.array_hash_map.Auto(File.Index, File.Reference) = .empty, /// If this is populated, a "file exists in multiple modules" error should be emitted. /// This causes file errors to not be shown, because we don't really know which files @@ -162,7 +162,7 @@ multi_module_err: ?struct { /// on the `Compilation.Path` of the `EmbedFile`. /// /// This table owns all of the `*EmbedFile` memory, which is allocated into gpa. -embed_table: std.ArrayHashMapUnmanaged( +embed_table: std.array_hash_map.Custom( *EmbedFile, void, struct { @@ -179,27 +179,27 @@ intern_pool: InternPool = .empty, /// Value explains why this `AnalUnit` is being analyzed. It is `null` for the topmost analysis /// (index 0), and non-`null` for all others. -analysis_in_progress: std.AutoArrayHashMapUnmanaged(AnalUnit, ?*const DependencyReason) = .empty, +analysis_in_progress: std.array_hash_map.Auto(AnalUnit, ?*const DependencyReason) = .empty, /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. -failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, *ErrorMsg) = .empty, +failed_analysis: std.array_hash_map.Auto(AnalUnit, *ErrorMsg) = .empty, /// This `AnalUnit` failed semantic analysis because it required analysis of another `AnalUnit` which itself failed. -transitive_failed_analysis: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, +transitive_failed_analysis: std.array_hash_map.Auto(AnalUnit, void) = .empty, /// This `Nav` succeeded analysis, but failed codegen. /// This may be a simple "value" `Nav`, or it may be a function. /// The ErrorMsg memory is owned by the `AnalUnit`, using Module's general purpose allocator. /// While multiple threads are active (most of the time!), this is guarded by `zcu.comp.mutex`, as /// codegen and linking run on a separate thread. -failed_codegen: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, *ErrorMsg) = .empty, -failed_types: std.AutoArrayHashMapUnmanaged(InternPool.Index, *ErrorMsg) = .empty, +failed_codegen: std.array_hash_map.Auto(InternPool.Nav.Index, *ErrorMsg) = .empty, +failed_types: std.array_hash_map.Auto(InternPool.Index, *ErrorMsg) = .empty, /// Key is an `AnalUnit` which is in `dependency_loop_nodes`. For each dependency loop, exactly one /// unit in the loop is in this map, though the choice is arbitrary and not necessarily reproducible /// between compilations. So, instead of (for instance) defining where the dependency loop "starts", /// this map simply exists to allow easily iterating all dependency loops exactly once. -dependency_loops: std.AutoArrayHashMapUnmanaged(AnalUnit, void) = .empty, +dependency_loops: std.array_hash_map.Auto(AnalUnit, void) = .empty, /// Key is an `AnalUnit`, value is the `AnalUnit` which the key references and why it does so. /// All units in here form loops. To iterate loops, see `dependency_loops`. -dependency_loop_nodes: std.AutoArrayHashMapUnmanaged(AnalUnit, struct { +dependency_loop_nodes: std.array_hash_map.Auto(AnalUnit, struct { unit: AnalUnit, reason: DependencyReason, }) = .empty, @@ -207,7 +207,7 @@ dependency_loop_nodes: std.AutoArrayHashMapUnmanaged(AnalUnit, struct { /// Keep track of `@compileLog`s per `AnalUnit`. /// We track the source location of the first `@compileLog` call, and all logged lines as a linked list. /// The list is singly linked, but we do track its tail for fast appends (optimizing many logs in one unit). -compile_logs: std.AutoArrayHashMapUnmanaged(AnalUnit, extern struct { +compile_logs: std.array_hash_map.Auto(AnalUnit, extern struct { base_node_inst: InternPool.TrackedInst.Index, node_offset: Ast.Node.Offset, first_line: CompileLogLine.Index, @@ -228,7 +228,7 @@ free_compile_log_lines: std.ArrayList(CompileLogLine.Index) = .empty, /// We just store a `[]u8` instead of a full `*ErrorMsg`, because the source /// location is always the entire file. The `[]u8` memory is owned by the map /// and allocated into `gpa`. -failed_files: std.AutoArrayHashMapUnmanaged(File.Index, ?[]u8) = .empty, +failed_files: std.array_hash_map.Auto(File.Index, ?[]u8) = .empty, /// AstGen is not aware of modules, and so cannot determine whether an import /// string makes sense. That is the job of a traversal after AstGen. /// @@ -256,10 +256,10 @@ failed_imports: std.ArrayList(struct { import_token: Ast.TokenIndex, kind: enum { file_outside_module_root, illegal_zig_import }, }) = .empty, -failed_exports: std.AutoArrayHashMapUnmanaged(Export.Index, *ErrorMsg) = .empty, +failed_exports: std.array_hash_map.Auto(Export.Index, *ErrorMsg) = .empty, /// If analysis failed due to a cimport error, the corresponding Clang errors /// are stored here. -cimport_errors: std.AutoArrayHashMapUnmanaged(AnalUnit, std.zig.ErrorBundle) = .empty, +cimport_errors: std.array_hash_map.Auto(AnalUnit, std.zig.ErrorBundle) = .empty, /// Maximum amount of distinct error values, set by --error-limit error_limit: ErrorInt, @@ -271,19 +271,19 @@ outdated_lock: if (std.debug.runtime_safety) std.Io.RwLock else void = if (std.d /// Value is the number of PO dependencies of this AnalUnit. /// This value will decrease as we perform semantic analysis to learn what is outdated. /// If any of these PO deps is outdated, this value will be moved to `outdated`. -potentially_outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, +potentially_outdated: std.array_hash_map.Auto(AnalUnit, u32) = .empty, /// Value is the number of PO dependencies of this AnalUnit. /// Once this value drops to 0, the AnalUnit is a candidate for re-analysis. -outdated: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, +outdated: std.array_hash_map.Auto(AnalUnit, u32) = .empty, /// This is the set of all `AnalUnit`s in `outdated` whose PO dependency count is 0. /// Such `AnalUnit`s are ready for immediate re-analysis. /// See `findOutdatedToAnalyze` for details. outdated_ready: struct { /// These are separate from other units because it allows `findOutdatedToAnalyze` to prioritize /// functions, which is useful because it means they will be sent to codegen more quickly. - funcs: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), + funcs: std.array_hash_map.Auto(InternPool.Index, void), /// Does not contain `.func` units. - other: std.AutoArrayHashMapUnmanaged(AnalUnit, void), + other: std.array_hash_map.Auto(AnalUnit, void), } = .{ .funcs = .empty, .other = .empty }, /// This contains a list of AnalUnit whose analysis or codegen failed, but the /// failure was something like running out of disk space, and trying again may @@ -298,23 +298,23 @@ analysis_roots_len: usize = 0, /// This is the cached result of `Zcu.resolveReferences`. It is computed on-demand, and /// reset to `null` when any semantic analysis occurs (since this invalidates the data). /// Allocated into `gpa`. -resolved_references: ?std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = null, +resolved_references: ?std.array_hash_map.Auto(AnalUnit, ?ResolvedReference) = null, /// If `true`, then semantic analysis must not occur on this update due to AstGen errors. /// Essentially the entire pipeline after AstGen, including Sema, codegen, and link, is skipped. /// Reset to `false` at the start of each update in `Compilation.update`. skip_analysis_this_update: bool = false, -test_functions: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty, +test_functions: std.array_hash_map.Auto(InternPool.Nav.Index, void) = .empty, -global_assembly: std.AutoArrayHashMapUnmanaged(AnalUnit, []u8) = .empty, +global_assembly: std.array_hash_map.Auto(AnalUnit, []u8) = .empty, /// Key is the `AnalUnit` *performing* the reference. This representation allows /// incremental updates to quickly delete references caused by a specific `AnalUnit`. /// Value is index into `all_references` of the first reference triggered by the unit. /// The `next` field on the `Reference` forms a linked list of all references /// triggered by the key `AnalUnit`. -reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, +reference_table: std.array_hash_map.Auto(AnalUnit, u32) = .empty, all_references: std.ArrayList(Reference) = .empty, /// Freelist of indices in `all_references`. free_references: std.ArrayList(u32) = .empty, @@ -327,7 +327,7 @@ free_inline_reference_frames: std.ArrayList(InlineReferenceFrame.Index) = .empty /// Value is index into `all_type_reference` of the first reference triggered by the unit. /// The `next` field on the `TypeReference` forms a linked list of all type references /// triggered by the key `AnalUnit`. -type_reference_table: std.AutoArrayHashMapUnmanaged(AnalUnit, u32) = .empty, +type_reference_table: std.array_hash_map.Auto(AnalUnit, u32) = .empty, all_type_references: std.ArrayList(TypeReference) = .empty, /// Freelist of indices in `all_type_references`. free_type_references: std.ArrayList(u32) = .empty, @@ -355,12 +355,12 @@ pub const DependencyReason = struct { pub const IncrementalDebugState = struct { /// All container types in the ZCU, even dead ones. /// Value is the generation the type was created on. - types: std.AutoArrayHashMapUnmanaged(InternPool.Index, u32), + types: std.array_hash_map.Auto(InternPool.Index, u32), /// All `Nav`s in the ZCU, even dead ones. /// Value is the generation the `Nav` was created on. - navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, u32), + navs: std.array_hash_map.Auto(InternPool.Nav.Index, u32), /// All `AnalUnit`s in the ZCU, even dead ones. - units: std.AutoArrayHashMapUnmanaged(AnalUnit, UnitInfo), + units: std.array_hash_map.Auto(AnalUnit, UnitInfo), pub const init: IncrementalDebugState = .{ .types = .empty, @@ -681,7 +681,7 @@ pub const SimplePanicId = enum { } }; -pub const GlobalErrorSet = std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void); +pub const GlobalErrorSet = std.array_hash_map.Auto(InternPool.NullTerminatedString, void); pub const CImportError = struct { offset: u32, @@ -840,9 +840,9 @@ pub const Namespace = struct { /// Will be a struct, enum, union, or opaque. owner_type: InternPool.Index, /// Members of the namespace which are marked `pub`. - pub_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty, + pub_decls: std.array_hash_map.Custom(InternPool.Nav.Index, void, NavNameContext, true) = .empty, /// Members of the namespace which are *not* marked `pub`. - priv_decls: std.ArrayHashMapUnmanaged(InternPool.Nav.Index, void, NavNameContext, true) = .empty, + priv_decls: std.array_hash_map.Custom(InternPool.Nav.Index, void, NavNameContext, true) = .empty, /// All `comptime` declarations in this namespace. We store these purely so that incremental /// compilation can re-use the existing `ComptimeUnit`s when a namespace changes. comptime_decls: std.ArrayList(InternPool.ComptimeUnit.Id) = .empty, @@ -4188,13 +4188,13 @@ pub const ResolvedReference = struct { /// If an `AnalUnit` is not in the returned map, it is unreferenced. /// The returned hashmap is owned by the `Zcu`, so should not be freed by the caller. /// This hashmap is cached, so repeated calls to this function are cheap. -pub fn resolveReferences(zcu: *Zcu) Allocator.Error!*const std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) { +pub fn resolveReferences(zcu: *Zcu) Allocator.Error!*const std.array_hash_map.Auto(AnalUnit, ?ResolvedReference) { if (zcu.resolved_references == null) { zcu.resolved_references = try zcu.resolveReferencesInner(); } return &zcu.resolved_references.?; } -fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) { +fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.array_hash_map.Auto(AnalUnit, ?ResolvedReference) { const trace = tracy.trace(@src()); defer trace.end(); @@ -4202,8 +4202,8 @@ fn resolveReferencesInner(zcu: *Zcu) Allocator.Error!std.AutoArrayHashMapUnmanag const comp = zcu.comp; const ip = &zcu.intern_pool; - var units: std.AutoArrayHashMapUnmanaged(AnalUnit, ?ResolvedReference) = .empty; - var types: std.AutoArrayHashMapUnmanaged(InternPool.Index, ?ResolvedReference) = .empty; + var units: std.array_hash_map.Auto(AnalUnit, ?ResolvedReference) = .empty; + var types: std.array_hash_map.Auto(InternPool.Index, ?ResolvedReference) = .empty; defer { units.deinit(gpa); types.deinit(gpa); diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index 9782ca3993f4f5f50d98fd4a309e2c6e6398b404..8428627bc51ceaaf3eea7b5845c7570758bdede3 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -787,7 +787,7 @@ const UpdatedFile = struct { inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index), }; -fn cleanupUpdatedFiles(gpa: Allocator, updated_files: *std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile)) void { +fn cleanupUpdatedFiles(gpa: Allocator, updated_files: *std.array_hash_map.Auto(Zcu.File.Index, UpdatedFile)) void { for (updated_files.values()) |*elem| elem.inst_map.deinit(gpa); updated_files.deinit(gpa); } @@ -805,7 +805,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { // We need to visit every updated File for every TrackedInst in InternPool. // This only includes Zig files; ZON files are omitted. - var updated_files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, UpdatedFile) = .empty; + var updated_files: std.array_hash_map.Auto(Zcu.File.Index, UpdatedFile) = .empty; defer cleanupUpdatedFiles(gpa, &updated_files); for (zcu.import_table.keys()) |file_index| { @@ -907,7 +907,7 @@ fn updateZirRefs(pt: Zcu.PerThread) (Io.Cancelable || Allocator.Error)!void { if (!has_namespace) continue; // Value is whether the declaration is `pub`. - var old_names: std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, bool) = .empty; + var old_names: std.array_hash_map.Auto(InternPool.NullTerminatedString, bool) = .empty; defer old_names.deinit(zcu.gpa); for (old_zir.typeDecls(old_inst)) |decl_inst| { const old_decl = old_zir.getDeclaration(decl_inst); @@ -3568,8 +3568,8 @@ pub fn processExports(pt: Zcu.PerThread) !void { } // First, construct a mapping of every exported value and Nav to the indices of all its different exports. - var nav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, std.ArrayList(Zcu.Export.Index)) = .empty; - var uav_exports: std.AutoArrayHashMapUnmanaged(InternPool.Index, std.ArrayList(Zcu.Export.Index)) = .empty; + var nav_exports: std.array_hash_map.Auto(InternPool.Nav.Index, std.ArrayList(Zcu.Export.Index)) = .empty; + var uav_exports: std.array_hash_map.Auto(InternPool.Index, std.ArrayList(Zcu.Export.Index)) = .empty; defer { for (nav_exports.values()) |*exports| { exports.deinit(gpa); @@ -3665,7 +3665,7 @@ pub fn processExports(pt: Zcu.PerThread) !void { } } -const SymbolExports = std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, Zcu.Export.Index); +const SymbolExports = std.array_hash_map.Auto(InternPool.NullTerminatedString, Zcu.Export.Index); fn processExportsInner( pt: Zcu.PerThread, diff --git a/src/codegen/aarch64/Select.zig b/src/codegen/aarch64/Select.zig index 8f64fd012071d7edd6b7ed85de3099d919001e9a..39d1109bd4e7620d7e3b1d35803b633ed74f2f33 100644 --- a/src/codegen/aarch64/Select.zig +++ b/src/codegen/aarch64/Select.zig @@ -4,12 +4,12 @@ air: Air, nav_index: InternPool.Nav.Index, // Blocks -def_order: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, void), -blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, Block), -loops: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, Loop), +def_order: std.array_hash_map.Auto(Air.Inst.Index, void), +blocks: std.array_hash_map.Auto(Air.Inst.Index, Block), +loops: std.array_hash_map.Auto(Air.Inst.Index, Loop), active_loops: std.ArrayList(Loop.Index), loop_live: struct { - set: std.AutoArrayHashMapUnmanaged(struct { Loop.Index, Air.Inst.Index }, void), + set: std.array_hash_map.Auto(struct { Loop.Index, Air.Inst.Index }, void), list: std.ArrayList(Air.Inst.Index), }, dom_start: u32, @@ -11225,7 +11225,7 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { defer std.debug.unlockStderr(); const stderr = &locked_stderr.file_writer.interface; - var reverse_live_values: std.AutoArrayHashMapUnmanaged(Value.Index, std.ArrayList(Air.Inst.Index)) = .empty; + var reverse_live_values: std.array_hash_map.Auto(Value.Index, std.ArrayList(Air.Inst.Index)) = .empty; defer { for (reverse_live_values.values()) |*list| list.deinit(gpa); reverse_live_values.deinit(gpa); @@ -11254,7 +11254,7 @@ fn dumpValuesInner(isel: *Select, which: WhichValues) !void { }; } - var roots: std.AutoArrayHashMapUnmanaged(Value.Index, u32) = .empty; + var roots: std.array_hash_map.Auto(Value.Index, u32) = .empty; defer roots.deinit(gpa); { try roots.ensureTotalCapacity(gpa, isel.values.items.len); diff --git a/src/codegen/c.zig b/src/codegen/c.zig index de378073b17ea173ea808b90fcef1bc4836ff2d8..d37df54d6bb8dc576c568c0c6db40692e5477fe4 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -59,14 +59,14 @@ pub const Mir = struct { /// Key is the value of the UAV; value is the UAV's alignment, or /// `.none` for natural alignment. The specified alignment is never /// less than the natural alignment. - need_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), + need_uavs: std.array_hash_map.Auto(InternPool.Index, Alignment), ctype_deps: CType.Dependencies, /// Key is an enum type for which we need a generated `@tagName` function. - need_tag_name_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), + need_tag_name_funcs: std.array_hash_map.Auto(InternPool.Index, void), /// Key is a function Nav for which we need a generated `zig_never_tail` wrapper. - need_never_tail_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), + need_never_tail_funcs: std.array_hash_map.Auto(InternPool.Nav.Index, void), /// Key is a function Nav for which we need a generated `zig_never_inline` wrapper. - need_never_inline_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), + need_never_inline_funcs: std.array_hash_map.Auto(InternPool.Nav.Index, void), pub fn deinit(mir: *Mir, gpa: Allocator) void { gpa.free(mir.fwd_decl); @@ -164,8 +164,8 @@ const LocalType = struct { }; const LocalIndex = u16; -const LocalsList = std.AutoArrayHashMapUnmanaged(LocalIndex, void); -const LocalsMap = std.AutoArrayHashMapUnmanaged(LocalType, LocalsList); +const LocalsList = std.array_hash_map.Auto(LocalIndex, void); +const LocalsMap = std.array_hash_map.Auto(LocalType, LocalsList); const ValueRenderLocation = enum { initializer, @@ -391,11 +391,11 @@ pub const Function = struct { code: Writer.Allocating, indent_counter: usize, /// Key is an enum type for which we need a generated `@tagName` function. - need_tag_name_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), + need_tag_name_funcs: std.array_hash_map.Auto(InternPool.Index, void), /// Key is a function Nav for which we need a generated `zig_never_tail` wrapper. - need_never_tail_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), + need_never_tail_funcs: std.array_hash_map.Auto(InternPool.Nav.Index, void), /// Key is a function Nav for which we need a generated `zig_never_inline` wrapper. - need_never_inline_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), + need_never_inline_funcs: std.array_hash_map.Auto(InternPool.Nav.Index, void), func_index: InternPool.Index, /// All the locals, to be emitted at the top of the function. locals: std.ArrayList(LocalType) = .empty, @@ -407,7 +407,7 @@ pub const Function = struct { /// of variable declarations at the top of a function, sorted descending /// by type alignment. /// The value is whether the alloc needs to be emitted in the header. - allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .empty, + allocs: std.array_hash_map.Auto(LocalIndex, bool) = .empty, /// Maps from `loop_switch_br` instructions to the allocated local used /// for the switch cond. Dispatches should set this local to the new cond. loop_switch_conds: std.AutoHashMapUnmanaged(Air.Inst.Index, LocalIndex) = .empty, @@ -643,7 +643,7 @@ pub const DeclGen = struct { /// Key is the value of the UAV; value is the UAV's alignment, or /// `.none` for natural alignment. The specified alignment is never /// less than the natural alignment. - uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), + uavs: std.array_hash_map.Auto(InternPool.Index, Alignment), fn fail(dg: *DeclGen, comptime format: []const u8, args: anytype) Error { @branchHint(.cold); diff --git a/src/codegen/c/type.zig b/src/codegen/c/type.zig index e5049a547f14b9a9df83e9cb5854d42fb6dea7c7..1788b3cd3867494f1a5818f14c044fceef47e4b9 100644 --- a/src/codegen/c/type.zig +++ b/src/codegen/c/type.zig @@ -572,30 +572,30 @@ pub const CType = union(enum) { pub const Dependencies = struct { /// Key is any Zig type which corresponds to a C `struct`, `union`, or `typedef`. That C /// type must be declared and complete. - type: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), + type: std.array_hash_map.Auto(InternPool.Index, void), /// Key is a Zig type which is the *payload* of an error union. The C `struct` type /// corresponding to such an error union must be declared and complete. /// /// These are separate from `type` to avoid redundant types for every different error set /// used with the same payload type---for instance a different C type for every `E!void`. - errunion_type: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), + errunion_type: std.array_hash_map.Auto(InternPool.Index, void), /// Like `type`, but the type does not necessarily need to be completed yet: a forward /// declaration is sufficient. - type_fwd: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), + type_fwd: std.array_hash_map.Auto(InternPool.Index, void), /// Like `errunion_type`, but the type does not necessarily need to be completed yet: a /// forward declaration is sufficient. - errunion_type_fwd: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), + errunion_type_fwd: std.array_hash_map.Auto(InternPool.Index, void), /// Key is a Zig type; value is a bitmask of alignments. For every bit which is set, an /// aligned typedef is required. For instance, if bit 3 is set, the C type 'aligned__8_foo' /// must be declared through `typedef` (but not necessarily completed yet). - aligned_type_fwd: std.AutoArrayHashMapUnmanaged(InternPool.Index, u64), + aligned_type_fwd: std.array_hash_map.Auto(InternPool.Index, u64), /// Key specifies a big-int type whose C `struct` must be declared and complete. - bigint: std.AutoArrayHashMapUnmanaged(BigInt, void), + bigint: std.array_hash_map.Auto(BigInt, void), pub const empty: Dependencies = .{ .type = .empty, diff --git a/src/codegen/llvm/FuncGen.zig b/src/codegen/llvm/FuncGen.zig index bb4cf80cbd012dada91626adcaf4393326309771..dd4e5113f96d733f4e265000c05d749643a33200 100644 --- a/src/codegen/llvm/FuncGen.zig +++ b/src/codegen/llvm/FuncGen.zig @@ -2513,7 +2513,7 @@ fn airAssembly(self: *FuncGen, inst: Air.Inst.Index) TodoError!Builder.Value { var llvm_param_i: usize = 0; var total_i: usize = 0; - var name_map: std.StringArrayHashMapUnmanaged(u16) = .empty; + var name_map: std.array_hash_map.String(u16) = .empty; try name_map.ensureUnusedCapacity(arena, max_param_count); var it = unwrapped_asm.iterateOutputs(); diff --git a/src/codegen/riscv64/CodeGen.zig b/src/codegen/riscv64/CodeGen.zig index 555a295e888f959db260c0e5a30409e8581a2c77..fc5f5e6f1e0e2a6cd4734acc829eaeaccdb7f78b 100644 --- a/src/codegen/riscv64/CodeGen.zig +++ b/src/codegen/riscv64/CodeGen.zig @@ -112,7 +112,7 @@ const_tracking: ConstTrackingMap = .{}, inst_tracking: InstTrackingMap = .{}, frame_allocs: std.MultiArrayList(FrameAlloc) = .{}, -free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty, +free_frame_indices: std.array_hash_map.Auto(FrameIndex, void) = .empty, frame_locs: std.MultiArrayList(Mir.FrameLoc) = .{}, loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { @@ -338,7 +338,7 @@ const MCValue = union(enum) { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, + inst_table: std.array_hash_map.Auto(Air.Inst.Index, MCValue) = .empty, fn deinit(func: *Branch, gpa: Allocator) void { func.inst_table.deinit(gpa); @@ -346,8 +346,8 @@ const Branch = struct { } }; -const InstTrackingMap = std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InstTracking); -const ConstTrackingMap = std.AutoArrayHashMapUnmanaged(InternPool.Index, InstTracking); +const InstTrackingMap = std.array_hash_map.Auto(Air.Inst.Index, InstTracking); +const ConstTrackingMap = std.array_hash_map.Auto(InternPool.Index, InstTracking); const InstTracking = struct { long: MCValue, diff --git a/src/codegen/sparc64/CodeGen.zig b/src/codegen/sparc64/CodeGen.zig index a7a5cef78df9ec08aa5e97a0b04a85f30d0982d2..8845921df740132981bb4949e51fce954a43f7a1 100644 --- a/src/codegen/sparc64/CodeGen.zig +++ b/src/codegen/sparc64/CodeGen.zig @@ -200,7 +200,7 @@ const MCValue = union(enum) { }; const Branch = struct { - inst_table: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, MCValue) = .empty, + inst_table: std.array_hash_map.Auto(Air.Inst.Index, MCValue) = .empty, fn deinit(self: *Branch, gpa: Allocator) void { self.inst_table.deinit(gpa); diff --git a/src/codegen/spirv/Assembler.zig b/src/codegen/spirv/Assembler.zig index 3a63df8424350c53aa627ef67210f6036b50014b..fa6a000153f2fe720d13f7bdab0ba3a624955e7c 100644 --- a/src/codegen/spirv/Assembler.zig +++ b/src/codegen/spirv/Assembler.zig @@ -35,8 +35,8 @@ inst: struct { return null; } } = .{}, -value_map: std.StringArrayHashMapUnmanaged(AsmValue) = .{}, -inst_map: std.StringArrayHashMapUnmanaged(void) = .empty, +value_map: std.array_hash_map.String(AsmValue) = .{}, +inst_map: std.array_hash_map.String(void) = .empty, const Operand = union(enum) { /// Any 'simple' 32-bit value. This could be a mask or diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index 0280b2885dc55a620ea7fedf66279c0ff8480802..a0897896ab28d9f9e3127c44a6077dc5bc2bd043 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -28,7 +28,7 @@ uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, spec.StorageClass intern_map: std.AutoHashMapUnmanaged(struct { InternPool.Index, Repr }, Id) = .empty, decls: std.ArrayList(Decl) = .empty, decl_deps: std.ArrayList(Decl.Index) = .empty, -entry_points: std.AutoArrayHashMapUnmanaged(Id, EntryPoint) = .empty, +entry_points: std.array_hash_map.Auto(Id, EntryPoint) = .empty, /// This map serves a dual purpose: /// - It keeps track of pointers that are currently being emitted, so that we can tell /// if they are recursive and need an OpTypeForwardPointer. @@ -58,18 +58,18 @@ cache: struct { float_types: std.AutoHashMapUnmanaged(std.lang.Type.Float, Id) = .empty, vector_types: std.AutoHashMapUnmanaged(struct { Id, u32 }, Id) = .empty, array_types: std.AutoHashMapUnmanaged(struct { Id, Id }, Id) = .empty, - struct_types: std.ArrayHashMapUnmanaged(StructType, Id, StructType.HashContext, true) = .empty, - fn_types: std.ArrayHashMapUnmanaged(FnType, Id, FnType.HashContext, true) = .empty, + struct_types: std.array_hash_map.Custom(StructType, Id, StructType.HashContext, true) = .empty, + fn_types: std.array_hash_map.Custom(FnType, Id, FnType.HashContext, true) = .empty, capabilities: std.AutoHashMapUnmanaged(spec.Capability, void) = .empty, extensions: std.StringHashMapUnmanaged(void) = .empty, extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, Id) = .empty, decorations: std.AutoHashMapUnmanaged(struct { Id, spec.Decoration }, void) = .empty, builtins: std.AutoHashMapUnmanaged(struct { spec.BuiltIn, spec.StorageClass }, Decl.Index) = .empty, - strings: std.StringArrayHashMapUnmanaged(Id) = .empty, + strings: std.array_hash_map.String(Id) = .empty, bool_const: [2]?Id = .{ null, null }, - constants: std.ArrayHashMapUnmanaged(Constant, Id, Constant.HashContext, true) = .empty, + constants: std.array_hash_map.Custom(Constant, Id, Constant.HashContext, true) = .empty, spirv_types: std.AutoHashMapUnmanaged(InternPool.Index, Id) = .empty, } = .{}, diff --git a/src/codegen/wasm/CodeGen.zig b/src/codegen/wasm/CodeGen.zig index b487cba42009009ad72c919aaa0512ff5188387a..4ca747db9940ac5f30d67c2fdd90795b02b69b79 100644 --- a/src/codegen/wasm/CodeGen.zig +++ b/src/codegen/wasm/CodeGen.zig @@ -141,7 +141,7 @@ branches: std.ArrayList(Branch) = .empty, /// Table to save `WValue`'s generated by an `Air.Inst` // values: ValueTable, /// Mapping from Air.Inst.Index to block ids -blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, struct { +blocks: std.array_hash_map.Auto(Air.Inst.Index, struct { label: u32, value: WValue, }) = .{}, @@ -171,12 +171,12 @@ mir_extra: std.ArrayList(u32), mir_locals: std.ArrayList(std.wasm.Valtype), /// Set of all UAVs referenced by this function. Key is the UAV value, value is the alignment. /// `.none` means naturally aligned. An explicit alignment is never less than the natural alignment. -mir_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), +mir_uavs: std.array_hash_map.Auto(InternPool.Index, Alignment), /// Set of all functions whose address this function has taken and which therefore might be called /// via a `call_indirect` function. -mir_indirect_function_set: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), +mir_indirect_function_set: std.array_hash_map.Auto(InternPool.Nav.Index, void), /// Set of all function types used by this function. These must be interned by the linker. -mir_func_tys: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), +mir_func_tys: std.array_hash_map.Auto(InternPool.Index, void), /// The number of `error_name_table_ref` instructions emitted. error_name_table_ref_count: u32, /// When a function is executing, we store the the current stack pointer's value within this local. @@ -322,7 +322,7 @@ const WValue = union(enum) { }; /// Hashmap to store generated `WValue` for each `Air.Inst.Ref` -const ValueTable = std.AutoArrayHashMapUnmanaged(Air.Inst.Ref, WValue); +const ValueTable = std.array_hash_map.Auto(Air.Inst.Ref, WValue); const bookkeeping_init = if (std.debug.runtime_safety) @as(usize, 0) else {}; diff --git a/src/codegen/wasm/Mir.zig b/src/codegen/wasm/Mir.zig index 662e177447cdb966b961731253c0334c53e519aa..f3b96f1c7939b4566630b8c3261cb432206d49ac 100644 --- a/src/codegen/wasm/Mir.zig +++ b/src/codegen/wasm/Mir.zig @@ -26,11 +26,11 @@ prologue: Prologue, /// Not directly used by `Emit`, but the linker needs this to merge it with a global set. /// Value is the explicit alignment if greater than natural alignment, `.none` otherwise. -uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), +uavs: std.array_hash_map.Auto(InternPool.Index, Alignment), /// Not directly used by `Emit`, but the linker needs this to merge it with a global set. -indirect_function_set: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), +indirect_function_set: std.array_hash_map.Auto(InternPool.Nav.Index, void), /// Not directly used by `Emit`, but the linker needs this to ensure these types are interned. -func_tys: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), +func_tys: std.array_hash_map.Auto(InternPool.Index, void), /// Not directly used by `Emit`, but the linker needs this to add it to its own refcount. error_name_table_ref_count: u32, diff --git a/src/codegen/x86_64/CodeGen.zig b/src/codegen/x86_64/CodeGen.zig index 32c6552f78b51d0b0212908521bf08acdd3b0d3c..27b3d501b3f9eb7a1be5e7d2926838d0ee3c9578 100644 --- a/src/codegen/x86_64/CodeGen.zig +++ b/src/codegen/x86_64/CodeGen.zig @@ -140,7 +140,7 @@ register_manager: RegisterManager = .{}, scope_generation: u32 = 0, frame_allocs: std.MultiArrayList(FrameAlloc) = .empty, -free_frame_indices: std.AutoArrayHashMapUnmanaged(FrameIndex, void) = .empty, +free_frame_indices: std.array_hash_map.Auto(FrameIndex, void) = .empty, frame_locs: std.MultiArrayList(Mir.FrameLoc) = .empty, loops: std.AutoHashMapUnmanaged(Air.Inst.Index, struct { @@ -569,8 +569,8 @@ pub const MCValue = union(enum) { } }; -const InstTrackingMap = std.AutoArrayHashMapUnmanaged(Air.Inst.Index, InstTracking); -const ConstTrackingMap = std.AutoArrayHashMapUnmanaged(InternPool.Index, InstTracking); +const InstTrackingMap = std.array_hash_map.Auto(Air.Inst.Index, InstTracking); +const ConstTrackingMap = std.array_hash_map.Auto(InternPool.Index, InstTracking); const InstTracking = struct { long: MCValue, short: MCValue, diff --git a/src/libs/mingw/implib.zig b/src/libs/mingw/implib.zig index 525129fe119046846ca70b798bd38fc0c4cfadd0..0c4ca824863cd411435e2bb44aee95d9a4a680f9 100644 --- a/src/libs/mingw/implib.zig +++ b/src/libs/mingw/implib.zig @@ -245,7 +245,7 @@ pub fn getMembers( }; var renames: std.ArrayList(DeferredExport) = .empty; defer renames.deinit(allocator); - var regular_imports: std.StringArrayHashMapUnmanaged([]const u8) = .empty; + var regular_imports: std.array_hash_map.String([]const u8) = .empty; defer regular_imports.deinit(allocator); for (module_def.exports.items) |*e| { diff --git a/src/link.zig b/src/link.zig index 3d64c248a96a8fc811f28d840000b68359477063..59a8ea84d86e14b1d8f880f52dfa4565e85f6c21 100644 --- a/src/link.zig +++ b/src/link.zig @@ -471,7 +471,7 @@ pub const File = struct { /// wrapper for a system function. The wrapper function should be called /// __wrap_symbol. If it wishes to call the system function, it should call /// __real_symbol. - symbol_wrap_set: std.StringArrayHashMapUnmanaged(void), + symbol_wrap_set: std.array_hash_map.String(void), compatibility_version: ?std.SemanticVersion, diff --git a/src/link/C.zig b/src/link/C.zig index 1cbf660ed7e8c67b638e3ef5e8fdd69b790a9a0e..127485171314adc352096f6e13b448b28d12e173 100644 --- a/src/link/C.zig +++ b/src/link/C.zig @@ -44,10 +44,10 @@ type_dependencies: std.ArrayList(link.ConstPool.Index), align_dependency_masks: std.ArrayList(u64), /// All NAVs, regardless of whether they are functions or simple constants, are put in this map. -navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, RenderedDecl), +navs: std.array_hash_map.Auto(InternPool.Nav.Index, RenderedDecl), /// All UAVs which may be referenced are in this map. The UAV alignment is not included in the /// rendered C code stored here, because we don't know the alignment a UAV needs until `flush`. -uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, RenderedDecl), +uavs: std.array_hash_map.Auto(InternPool.Index, RenderedDecl), /// Contains all types which are needed by some other rendered code. Does not contain any constants /// other than types. type_pool: link.ConstPool, @@ -59,10 +59,10 @@ types: std.ArrayList(RenderedType), /// The set of big int types required by *any* generated code so far. These are always safe to emit, /// so they do not participate in the dependency graph traversal in `flush`. Therefore, redundant /// big-int types may be emitted under incremental compilation. -bigint_types: std.AutoArrayHashMapUnmanaged(codegen.CType.BigInt, void), +bigint_types: std.array_hash_map.Auto(codegen.CType.BigInt, void), -exported_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, String), -exported_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, String), +exported_navs: std.array_hash_map.Auto(InternPool.Nav.Index, String), +exported_uavs: std.array_hash_map.Auto(InternPool.Index, String), /// A reference into `string_bytes`. const String = extern struct { @@ -133,10 +133,10 @@ const RenderedDecl = struct { fwd_decl: String, code: String, ctype_deps: CTypeDependencies, - need_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), - need_tag_name_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), - need_never_tail_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), - need_never_inline_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void), + need_uavs: std.array_hash_map.Auto(InternPool.Index, Alignment), + need_tag_name_funcs: std.array_hash_map.Auto(InternPool.Index, void), + need_never_tail_funcs: std.array_hash_map.Auto(InternPool.Nav.Index, void), + need_never_inline_funcs: std.array_hash_map.Auto(InternPool.Nav.Index, void), const init: RenderedDecl = .{ .fwd_decl = .empty, @@ -746,7 +746,7 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog // incremental updates which is invalid C (due to e.g. types changing). Machine code backends // don't have this problem because there are, of course, no type checking performed when you // *execute* a binary! - var need_navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty; + var need_navs: std.array_hash_map.Auto(InternPool.Nav.Index, void) = .empty; defer need_navs.deinit(gpa); { const unit_references = try zcu.resolveReferences(); @@ -774,23 +774,23 @@ pub fn flush(c: *C, arena: Allocator, tid: Zcu.PerThread.Id, prog_node: std.Prog // // At the same time, we will discover the set of lazy functions which are referenced. - var need_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .empty; + var need_uavs: std.array_hash_map.Auto(InternPool.Index, Alignment) = .empty; defer need_uavs.deinit(gpa); - var need_types: std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, void) = .empty; + var need_types: std.array_hash_map.Auto(link.ConstPool.Index, void) = .empty; defer need_types.deinit(gpa); - var need_errunion_types: std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, void) = .empty; + var need_errunion_types: std.array_hash_map.Auto(link.ConstPool.Index, void) = .empty; defer need_errunion_types.deinit(gpa); - var need_aligned_types: std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, u64) = .empty; + var need_aligned_types: std.array_hash_map.Auto(link.ConstPool.Index, u64) = .empty; defer need_aligned_types.deinit(gpa); - var need_tag_name_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Index, void) = .empty; + var need_tag_name_funcs: std.array_hash_map.Auto(InternPool.Index, void) = .empty; defer need_tag_name_funcs.deinit(gpa); - var need_never_tail_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty; + var need_never_tail_funcs: std.array_hash_map.Auto(InternPool.Nav.Index, void) = .empty; defer need_never_tail_funcs.deinit(gpa); - var need_never_inline_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty; + var need_never_inline_funcs: std.array_hash_map.Auto(InternPool.Nav.Index, void) = .empty; defer need_never_inline_funcs.deinit(gpa); // As mentioned above, we need this type for error names. @@ -1284,9 +1284,9 @@ pub fn deleteExport( fn mergeNeededCTypes( c: *C, - need_types: *std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, void), - need_errunion_types: *std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, void), - need_aligned_types: *std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, u64), + need_types: *std.array_hash_map.Auto(link.ConstPool.Index, void), + need_errunion_types: *std.array_hash_map.Auto(link.ConstPool.Index, void), + need_aligned_types: *std.array_hash_map.Auto(link.ConstPool.Index, u64), deps: *const CTypeDependencies, ) Allocator.Error!void { const gpa = c.base.comp.gpa; @@ -1312,8 +1312,8 @@ fn mergeNeededCTypes( fn mergeNeededUavs( zcu: *const Zcu, - global: *std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), - new: *const std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment), + global: *std.array_hash_map.Auto(InternPool.Index, Alignment), + new: *const std.array_hash_map.Auto(InternPool.Index, Alignment), ) Allocator.Error!void { const gpa = zcu.comp.gpa; @@ -1422,12 +1422,12 @@ const FlushTypes = struct { c: *C, f: *Flush, - aligned_types: *const std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, u64), + aligned_types: *const std.array_hash_map.Auto(link.ConstPool.Index, u64), aligned_type_strings: []const []const u8, - status: std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, bool), - errunion_status: std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, bool), - aligned_status: std.AutoArrayHashMapUnmanaged(link.ConstPool.Index, void), + status: std.array_hash_map.Auto(link.ConstPool.Index, bool), + errunion_status: std.array_hash_map.Auto(link.ConstPool.Index, bool), + aligned_status: std.array_hash_map.Auto(link.ConstPool.Index, void), fn processDeps(ft: *FlushTypes, deps: *const CTypeDependencies) void { const resolved = deps.get(ft.c); diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 2d41c3bc582ccd62799e8b8fa1ec6ec178d8c460..7136131f2f0ef015683f6bf915e62251f5d0a233 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -30,18 +30,18 @@ strings: std.HashMapUnmanaged( ), string_bytes: std.ArrayList(u8), image_section_table: std.ArrayList(Symbol.Index), -pseudo_section_table: std.AutoArrayHashMapUnmanaged(String, Symbol.Index), -object_section_table: std.AutoArrayHashMapUnmanaged(String, Symbol.Index), +pseudo_section_table: std.array_hash_map.Auto(String, Symbol.Index), +object_section_table: std.array_hash_map.Auto(String, Symbol.Index), symbol_table: std.ArrayList(Symbol), -globals: std.AutoArrayHashMapUnmanaged(GlobalName, Symbol.Index), +globals: std.array_hash_map.Auto(GlobalName, Symbol.Index), global_pending_index: u32, -navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, Symbol.Index), -uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Symbol.Index), +navs: std.array_hash_map.Auto(InternPool.Nav.Index, Symbol.Index), +uavs: std.array_hash_map.Auto(InternPool.Index, Symbol.Index), lazy: std.EnumArray(link.File.LazySymbol.Kind, struct { - map: std.AutoArrayHashMapUnmanaged(InternPool.Index, Symbol.Index), + map: std.array_hash_map.Auto(InternPool.Index, Symbol.Index), pending_index: u32, }), -pending_uavs: std.AutoArrayHashMapUnmanaged(Node.UavMapIndex, struct { +pending_uavs: std.array_hash_map.Auto(Node.UavMapIndex, struct { alignment: InternPool.Alignment, }), relocs: std.ArrayList(Reloc), @@ -272,7 +272,7 @@ pub const Node = union(enum) { pub const ImportTable = struct { ni: MappedFile.Node.Index, - entries: std.AutoArrayHashMapUnmanaged(void, Entry), + entries: std.array_hash_map.Auto(void, Entry), pub const Entry = struct { import_lookup_table_ni: MappedFile.Node.Index, diff --git a/src/link/ConstPool.zig b/src/link/ConstPool.zig index dbab83c826b34129e49373ba3be8b1c48ddec581..3ff2d9a540e1d47d2da7e5e3d9b441ff70effa6b 100644 --- a/src/link/ConstPool.zig +++ b/src/link/ConstPool.zig @@ -15,10 +15,10 @@ /// * ensure that any `get` call is eventually followed by a `flushPending` call const ConstPool = @This(); -values: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), +values: std.array_hash_map.Auto(InternPool.Index, void), pending: std.ArrayList(Index), -complete_containers: std.AutoArrayHashMapUnmanaged(InternPool.Index, void), -container_deps: std.AutoArrayHashMapUnmanaged(InternPool.Index, ContainerDepEntry.Index), +complete_containers: std.array_hash_map.Auto(InternPool.Index, void), +container_deps: std.array_hash_map.Auto(InternPool.Index, ContainerDepEntry.Index), container_dep_entries: std.ArrayList(ContainerDepEntry), pub const empty: ConstPool = .{ diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index bb780f061bae7f1e8d03205b9f7c174e1ce11c85..96fb3d10c9191de8a2acaf7acaf799f5b9832fc5 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -27,11 +27,11 @@ address_size: AddressSize, const_pool: link.ConstPool, -mods: std.AutoArrayHashMapUnmanaged(*Module, ModInfo), +mods: std.array_hash_map.Auto(*Module, ModInfo), /// Indices are `link.ConstPool.Index`. values: std.ArrayList(struct { Unit.Index, Entry.Index }), -navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, Entry.Index), -decls: std.AutoArrayHashMapUnmanaged(InternPool.TrackedInst.Index, Entry.Index), +navs: std.array_hash_map.Auto(InternPool.Nav.Index, Entry.Index), +decls: std.array_hash_map.Auto(InternPool.TrackedInst.Index, Entry.Index), debug_abbrev: DebugAbbrev, debug_aranges: DebugAranges, @@ -69,8 +69,8 @@ pub const AddressSize = enum(u8) { const ModInfo = struct { root_dir_path: Entry.Index, - dirs: std.AutoArrayHashMapUnmanaged(Unit.Index, void), - files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, void), + dirs: std.array_hash_map.Auto(Unit.Index, void), + files: std.array_hash_map.Auto(Zcu.File.Index, void), fn deinit(mod_info: *ModInfo, gpa: Allocator) void { mod_info.dirs.deinit(gpa); @@ -236,7 +236,7 @@ const DebugRngLists = struct { const StringSection = struct { contents: std.ArrayList(u8), - map: std.AutoArrayHashMapUnmanaged(void, void), + map: std.array_hash_map.Auto(void, void), section: Section, const unit: Unit.Index = @enumFromInt(0); diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 4c50caf8f2b6d363a37c3f6189b0975b8bdd1451..d64d429bb0bc7d03f3e152615cbf81434e67515e 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -2,7 +2,7 @@ pub const Atom = @import("Elf/Atom.zig"); base: link.File, zig_object: ?*ZigObject, -rpath_table: std.StringArrayHashMapUnmanaged(void), +rpath_table: std.array_hash_map.String(void), image_base: u64, z_nodelete: bool, z_notext: bool, @@ -30,7 +30,7 @@ file_handles: std.ArrayList(File.Handle) = .empty, zig_object_index: ?File.Index = null, linker_defined_index: ?File.Index = null, objects: std.ArrayList(File.Index) = .empty, -shared_objects: std.StringArrayHashMapUnmanaged(File.Index) = .empty, +shared_objects: std.array_hash_map.String(File.Index) = .empty, /// List of all output sections and their associated metadata. sections: std.MultiArrayList(Section) = .{}, @@ -249,7 +249,7 @@ pub fn createEmpty( const is_dyn_lib = output_mode == .Lib and link_mode == .dynamic; const default_sym_version: elf.Versym = if (is_dyn_lib or comp.config.rdynamic) .GLOBAL else .LOCAL; - var rpath_table: std.StringArrayHashMapUnmanaged(void) = .empty; + var rpath_table: std.array_hash_map.String(void) = .empty; try rpath_table.entries.resize(arena, options.rpath_list.len); @memcpy(rpath_table.entries.items(.key), options.rpath_list); try rpath_table.reIndex(arena); @@ -1112,7 +1112,7 @@ fn parseDso( io: Io, diags: *Diags, dso: link.Input.Dso, - shared_objects: *std.StringArrayHashMapUnmanaged(File.Index), + shared_objects: *std.array_hash_map.String(File.Index), files: *std.MultiArrayList(File.Entry), target: *const std.Target, ) !void { @@ -4153,7 +4153,7 @@ pub const Ref = struct { pub const SymbolResolver = struct { keys: std.ArrayList(Key) = .empty, values: std.ArrayList(Ref) = .empty, - table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, + table: std.array_hash_map.Auto(void, void) = .empty, const Result = struct { found_existing: bool, diff --git a/src/link/Elf/AtomList.zig b/src/link/Elf/AtomList.zig index 9350f1a276b16382a297a471ae8214b1bcc1be29..245c00bf6ee359e452826363c428144d45371202 100644 --- a/src/link/Elf/AtomList.zig +++ b/src/link/Elf/AtomList.zig @@ -3,7 +3,7 @@ size: u64 = 0, alignment: Atom.Alignment = .@"1", output_section_index: u32 = 0, // atoms: std.ArrayList(Elf.Ref) = .empty, -atoms: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .empty, +atoms: std.array_hash_map.Auto(Elf.Ref, void) = .empty, dirty: bool = true, diff --git a/src/link/Elf/Thunk.zig b/src/link/Elf/Thunk.zig index 1700bb8276dd4e534629e6ff30eaa9220ada8a5d..69af9707bc9e8d41c2b81952c32b5cc981ccfdbd 100644 --- a/src/link/Elf/Thunk.zig +++ b/src/link/Elf/Thunk.zig @@ -1,6 +1,6 @@ value: i64 = 0, output_section_index: u32 = 0, -symbols: std.AutoArrayHashMapUnmanaged(Elf.Ref, void) = .empty, +symbols: std.array_hash_map.Auto(Elf.Ref, void) = .empty, output_symtab_ctx: Elf.SymtabCtx = .{}, pub fn deinit(thunk: *Thunk, allocator: Allocator) void { diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig index aa6dbdadc7b879bf2949da4ff30233a2a34a2a4a..3f4a85ece7a40dbed094b587df82cc0e1293cbd6 100644 --- a/src/link/Elf/ZigObject.zig +++ b/src/link/Elf/ZigObject.zig @@ -2408,10 +2408,10 @@ const TlsVariable = struct { }; const AtomList = std.ArrayList(Atom.Index); -const NavTable = std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvMetadata); -const UavTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, AvMetadata); -const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata); -const TlsTable = std.AutoArrayHashMapUnmanaged(Atom.Index, void); +const NavTable = std.array_hash_map.Auto(InternPool.Nav.Index, AvMetadata); +const UavTable = std.array_hash_map.Auto(InternPool.Index, AvMetadata); +const LazySymbolTable = std.array_hash_map.Auto(InternPool.Index, LazySymbolMetadata); +const TlsTable = std.array_hash_map.Auto(Atom.Index, void); const x86_64 = struct { fn writeTrampolineCode(source_addr: i64, target_addr: i64, buf: *[max_trampoline_len]u8) ![]u8 { diff --git a/src/link/Elf2.zig b/src/link/Elf2.zig index b16e726d21213f6ba5ccd2c6aa6c22c4690ef914..ebd3a7b484b10884e2c115a58161e9065ecbe558 100644 --- a/src/link/Elf2.zig +++ b/src/link/Elf2.zig @@ -112,7 +112,7 @@ plt_first_symbol_reloc: SymbolReloc.Index, /// The `.dynamic` section contains zero or more symbol relocations starting at this index. dynamic_first_symbol_reloc: SymbolReloc.Index, -needed: std.AutoArrayHashMapUnmanaged(String(.dynstr), void), +needed: std.array_hash_map.Auto(String(.dynstr), void), inputs: std.ArrayList(struct { path: std.Build.Cache.Path, member: ?[]const u8, @@ -120,21 +120,21 @@ inputs: std.ArrayList(struct { }), input_sections: std.ArrayList(InputSection), input_section_pending_index: u32, -navs: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, struct { +navs: std.array_hash_map.Auto(InternPool.Nav.Index, struct { lsi: Symbol.LocalIndex, /// The start index of the contiguous sequence of symbol relocations in this NAV. first_symbol_reloc: SymbolReloc.Index, /// The start index of the contiguous sequence of GOT relocations in this NAV. first_got_reloc: GotReloc.Index, }), -uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, struct { +uavs: std.array_hash_map.Auto(InternPool.Index, struct { lsi: Symbol.LocalIndex, /// The start index of the contiguous sequence of symbol relocations in this UAV. first_symbol_reloc: SymbolReloc.Index, // No `first_got_reloc` field because a UAV never contains GOT relocations. }), lazy: std.EnumArray(link.File.LazySymbol.Kind, struct { - map: std.AutoArrayHashMapUnmanaged(InternPool.Index, struct { + map: std.array_hash_map.Auto(InternPool.Index, struct { lsi: Symbol.LocalIndex, /// The start index of the contiguous sequence of symbol relocations in this lazy code/data. first_symbol_reloc: SymbolReloc.Index, diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 8783781a4ced69514353f2696587a9f9a1516b23..8b045bf354aca5f5df2955307a1b67cc75f1a2fa 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -28,9 +28,9 @@ sections: std.MultiArrayList(Section) = .{}, resolver: SymbolResolver = .{}, /// This table will be populated after `scanRelocs` has run. /// Key is symbol index. -undefs: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, UndefRefs) = .empty, +undefs: std.array_hash_map.Auto(SymbolResolver.Index, UndefRefs) = .empty, undefs_mutex: std.Io.Mutex = .init, -dupes: std.AutoArrayHashMapUnmanaged(SymbolResolver.Index, std.ArrayList(File.Index)) = .empty, +dupes: std.array_hash_map.Auto(SymbolResolver.Index, std.ArrayList(File.Index)) = .empty, dupes_mutex: std.Io.Mutex = .init, dyld_info_cmd: macho.dyld_info_command = .{}, @@ -4102,7 +4102,7 @@ const Section = struct { }; pub const LiteralPool = struct { - table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, + table: std.array_hash_map.Auto(void, void) = .empty, keys: std.ArrayList(Key) = .empty, values: std.ArrayList(MachO.Ref) = .empty, data: std.ArrayList(u8) = .empty, @@ -4541,7 +4541,7 @@ pub const Ref = struct { pub const SymbolResolver = struct { keys: std.ArrayList(Key) = .empty, values: std.ArrayList(Ref) = .empty, - table: std.AutoArrayHashMapUnmanaged(void, void) = .empty, + table: std.array_hash_map.Auto(void, void) = .empty, const Result = struct { found_existing: bool, diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig index d1f79b5ab73e7efd293858116a2031453d57c8de..3125cd538d01636f3c181c48282c354de53f388a 100644 --- a/src/link/MachO/Dylib.zig +++ b/src/link/MachO/Dylib.zig @@ -14,7 +14,7 @@ symbols: std.ArrayList(Symbol) = .empty, symbols_extra: std.ArrayList(u32) = .empty, globals: std.ArrayList(MachO.SymbolResolver.Index) = .empty, dependents: std.ArrayList(Id) = .empty, -rpaths: std.StringArrayHashMapUnmanaged(void) = .empty, +rpaths: std.array_hash_map.String(void) = .empty, umbrella: File.Index, platform: ?MachO.Platform = null, diff --git a/src/link/MachO/Thunk.zig b/src/link/MachO/Thunk.zig index cdb9eb649af4a0aeb340d96cad81716cc66ecbde..d71cf29aea5c331a08028cf99eb78fd7a7f8f511 100644 --- a/src/link/MachO/Thunk.zig +++ b/src/link/MachO/Thunk.zig @@ -1,6 +1,6 @@ value: u64 = 0, out_n_sect: u8 = 0, -symbols: std.AutoArrayHashMapUnmanaged(MachO.Ref, void) = .empty, +symbols: std.array_hash_map.Auto(MachO.Ref, void) = .empty, output_symtab_ctx: MachO.SymtabCtx = .{}, pub fn deinit(thunk: *Thunk, allocator: Allocator) void { diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig index 8d54129094b19166f4c2b818e14b522cc8aa1afc..fc2500867f7d90d619c91fd0b2ad48bc3c59f9d1 100644 --- a/src/link/MachO/ZigObject.zig +++ b/src/link/MachO/ZigObject.zig @@ -1750,11 +1750,11 @@ const TlvInitializer = struct { } }; -const NavTable = std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, AvMetadata); -const UavTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, AvMetadata); -const LazySymbolTable = std.AutoArrayHashMapUnmanaged(InternPool.Index, LazySymbolMetadata); +const NavTable = std.array_hash_map.Auto(InternPool.Nav.Index, AvMetadata); +const UavTable = std.array_hash_map.Auto(InternPool.Index, AvMetadata); +const LazySymbolTable = std.array_hash_map.Auto(InternPool.Index, LazySymbolMetadata); const RelocationTable = std.ArrayList(std.ArrayList(Relocation)); -const TlvInitializerTable = std.AutoArrayHashMapUnmanaged(Atom.Index, TlvInitializer); +const TlvInitializerTable = std.array_hash_map.Auto(Atom.Index, TlvInitializer); const x86_64 = struct { fn writeTrampolineCode(source_addr: u64, target_addr: u64, buf: *[max_trampoline_len]u8) ![]u8 { diff --git a/src/link/SpirV/lower_invocation_globals.zig b/src/link/SpirV/lower_invocation_globals.zig index e2db1b33e5ca64c772082db596ceae64592c3bb9..227be842b9a93959269edbf75e59068858a7a422 100644 --- a/src/link/SpirV/lower_invocation_globals.zig +++ b/src/link/SpirV/lower_invocation_globals.zig @@ -23,14 +23,14 @@ const ModuleInfo = struct { /// The set of (result-id's of) invocation globals that are accessed /// in this function, or after resolution, that are accessed in this /// function or any of it's callees. - invocation_globals: std.AutoArrayHashMapUnmanaged(ResultId, void), + invocation_globals: std.array_hash_map.Auto(ResultId, void), }; /// Information about a particular invocation global const InvocationGlobal = struct { /// The list of invocation globals that this invocation global /// depends on. - dependencies: std.AutoArrayHashMapUnmanaged(ResultId, void), + dependencies: std.array_hash_map.Auto(ResultId, void), /// The invocation global's type ty: ResultId, /// Initializer function. May be `none`. @@ -39,13 +39,13 @@ const ModuleInfo = struct { }; /// Maps function result-id -> Fn information structure. - functions: std.AutoArrayHashMapUnmanaged(ResultId, Fn), + functions: std.array_hash_map.Auto(ResultId, Fn), /// Set of OpFunction result-ids in this module. - entry_points: std.AutoArrayHashMapUnmanaged(ResultId, void), + entry_points: std.array_hash_map.Auto(ResultId, void), /// For each function, a list of function result-ids that it calls. callee_store: []const ResultId, /// Maps each invocation global result-id to a type-id. - invocation_globals: std.AutoArrayHashMapUnmanaged(ResultId, InvocationGlobal), + invocation_globals: std.array_hash_map.Auto(ResultId, InvocationGlobal), /// Fetch the list of callees per function. Guaranteed to contain only unique IDs. fn callees(self: ModuleInfo, fn_id: ResultId) []const ResultId { @@ -342,9 +342,9 @@ const ModuleBuilder = struct { entry_point_new_id_base: u32, /// A set of all function types in the new program. SPIR-V mandates that these are unique, /// and until a general type deduplication pass is programmed, we just handle it here via this. - function_types: std.ArrayHashMapUnmanaged(FunctionType, ResultId, FunctionType.Context, true) = .empty, + function_types: std.array_hash_map.Custom(FunctionType, ResultId, FunctionType.Context, true) = .empty, /// Maps functions to new information required for creating the module - function_new_info: std.AutoArrayHashMapUnmanaged(ResultId, FunctionNewInfo) = .empty, + function_new_info: std.array_hash_map.Auto(ResultId, FunctionNewInfo) = .empty, /// Offset of the functions section in the new binary. new_functions_section: ?usize, diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 88502d8329e81c37e3dd3a7f8c48b7cd7bfd29a9..fd18419bab38858a538154f459cb683e2a345d2c 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -80,27 +80,27 @@ name: []const u8, /// List of relocatable files to be linked into the final binary. objects: std.ArrayList(Object) = .empty, -func_types: std.AutoArrayHashMapUnmanaged(FunctionType, void) = .empty, +func_types: std.array_hash_map.Auto(FunctionType, void) = .empty, /// Provides a mapping of both imports and provided functions to symbol name. /// Local functions may be unnamed. /// Key is symbol name, however the `FunctionImport` may have an name override for the import name. -object_function_imports: std.AutoArrayHashMapUnmanaged(String, FunctionImport) = .empty, +object_function_imports: std.array_hash_map.Auto(String, FunctionImport) = .empty, /// All functions for all objects. object_functions: std.ArrayList(ObjectFunction) = .empty, /// Provides a mapping of both imports and provided globals to symbol name. /// Local globals may be unnamed. -object_global_imports: std.AutoArrayHashMapUnmanaged(String, GlobalImport) = .empty, +object_global_imports: std.array_hash_map.Auto(String, GlobalImport) = .empty, /// All globals for all objects. object_globals: std.ArrayList(ObjectGlobal) = .empty, /// All table imports for all objects. -object_table_imports: std.AutoArrayHashMapUnmanaged(String, TableImport) = .empty, +object_table_imports: std.array_hash_map.Auto(String, TableImport) = .empty, /// All parsed table sections for all objects. object_tables: std.ArrayList(Table) = .empty, /// All memory imports for all objects. -object_memory_imports: std.AutoArrayHashMapUnmanaged(String, MemoryImport) = .empty, +object_memory_imports: std.array_hash_map.Auto(String, MemoryImport) = .empty, /// All parsed memory sections for all objects. object_memories: std.ArrayList(ObjectMemory) = .empty, @@ -119,15 +119,15 @@ object_data_segments: std.ArrayList(ObjectDataSegment) = .empty, /// Each segment has many data symbols, which correspond logically to global /// constants. object_datas: std.ArrayList(ObjectData) = .empty, -object_data_imports: std.AutoArrayHashMapUnmanaged(String, ObjectDataImport) = .empty, +object_data_imports: std.array_hash_map.Auto(String, ObjectDataImport) = .empty, /// Non-synthetic section that can essentially be mem-cpy'd into place after performing relocations. -object_custom_segments: std.AutoArrayHashMapUnmanaged(ObjectSectionIndex, CustomSegment) = .empty, +object_custom_segments: std.array_hash_map.Auto(ObjectSectionIndex, CustomSegment) = .empty, /// All comdat information for all objects. object_comdats: std.ArrayList(Comdat) = .empty, /// A table that maps the relocations to be performed where the key represents /// the section (across all objects) that the slice of relocations applies to. -object_relocations_table: std.AutoArrayHashMapUnmanaged(ObjectSectionIndex, ObjectRelocation.Slice) = .empty, +object_relocations_table: std.array_hash_map.Auto(ObjectSectionIndex, ObjectRelocation.Slice) = .empty, /// Incremented across all objects in order to enable calculation of `ObjectSectionIndex` values. object_total_sections: u32 = 0, /// All comdat symbols from all objects concatenated. @@ -150,7 +150,7 @@ nav_fixups: std.ArrayList(NavFixup) = .empty, func_table_fixups: std.ArrayList(FuncTableFixup) = .empty, /// Symbols to be emitted into an object file. Remains empty when not emitting /// an object file. -symbol_table: std.AutoArrayHashMapUnmanaged(String, void) = .empty, +symbol_table: std.array_hash_map.Auto(String, void) = .empty, /// When importing objects from the host environment, a name must be supplied. /// LLVM uses "env" by default when none is given. @@ -174,24 +174,24 @@ preloaded_strings: PreloadedStrings, /// This field is used when emitting an object; `navs_exe` used otherwise. /// Does not include externs since that data lives elsewhere. -navs_obj: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ZcuDataObj) = .empty, +navs_obj: std.array_hash_map.Auto(InternPool.Nav.Index, ZcuDataObj) = .empty, /// This field is unused when emitting an object; `navs_obj` used otherwise. /// Does not include externs since that data lives elsewhere. -navs_exe: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, ZcuDataExe) = .empty, +navs_exe: std.array_hash_map.Auto(InternPool.Nav.Index, ZcuDataExe) = .empty, /// Tracks all InternPool values referenced by codegen. Needed for outputting /// the data segment. This one does not track ref count because object files /// require using max LEB encoding for these references anyway. -uavs_obj: std.AutoArrayHashMapUnmanaged(InternPool.Index, ZcuDataObj) = .empty, +uavs_obj: std.array_hash_map.Auto(InternPool.Index, ZcuDataObj) = .empty, /// Tracks ref count to optimize LEB encodings for UAV references. -uavs_exe: std.AutoArrayHashMapUnmanaged(InternPool.Index, ZcuDataExe) = .empty, +uavs_exe: std.array_hash_map.Auto(InternPool.Index, ZcuDataExe) = .empty, /// Sparse table of uavs that need to be emitted with greater alignment than /// the default for the type. -overaligned_uavs: std.AutoArrayHashMapUnmanaged(InternPool.Index, Alignment) = .empty, +overaligned_uavs: std.array_hash_map.Auto(InternPool.Index, Alignment) = .empty, /// When the key is an enum type, this represents a `@tagName` function. -zcu_funcs: std.AutoArrayHashMapUnmanaged(InternPool.Index, ZcuFunc) = .empty, -nav_exports: std.AutoArrayHashMapUnmanaged(NavExport, Zcu.Export.Index) = .empty, -uav_exports: std.AutoArrayHashMapUnmanaged(UavExport, Zcu.Export.Index) = .empty, -imports: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty, +zcu_funcs: std.array_hash_map.Auto(InternPool.Index, ZcuFunc) = .empty, +nav_exports: std.array_hash_map.Auto(NavExport, Zcu.Export.Index) = .empty, +uav_exports: std.array_hash_map.Auto(UavExport, Zcu.Export.Index) = .empty, +imports: std.array_hash_map.Auto(InternPool.Nav.Index, void) = .empty, dwarf: ?Dwarf = null, @@ -200,19 +200,19 @@ flush_buffer: Flush = .{}, /// Empty until `prelink`. There it is populated based on object files. /// Next, it is copied into `Flush.missing_exports` just before `flush` /// and that data is used during `flush`. -missing_exports: std.AutoArrayHashMapUnmanaged(String, void) = .empty, +missing_exports: std.array_hash_map.Auto(String, void) = .empty, entry_resolution: FunctionImport.Resolution = .unresolved, /// Empty when outputting an object. -function_exports: std.AutoArrayHashMapUnmanaged(String, FunctionIndex) = .empty, -hidden_function_exports: std.AutoArrayHashMapUnmanaged(String, FunctionIndex) = .empty, +function_exports: std.array_hash_map.Auto(String, FunctionIndex) = .empty, +hidden_function_exports: std.array_hash_map.Auto(String, FunctionIndex) = .empty, global_exports: std.ArrayList(GlobalExport) = .empty, /// Tracks the value at the end of prelink. global_exports_len: u32 = 0, /// Ordered list of non-import functions that will appear in the final binary. /// Empty until prelink. -functions: std.AutoArrayHashMapUnmanaged(FunctionImport.Resolution, void) = .empty, +functions: std.array_hash_map.Auto(FunctionImport.Resolution, void) = .empty, /// Tracks the value at the end of prelink, at which point `functions` /// contains only object file functions, and nothing from the Zcu yet. functions_end_prelink: u32 = 0, @@ -230,7 +230,7 @@ data_imports_len_prelink: u32 = 0, /// `flush` gets a copy of this table, and then Zcu exports are applied to /// remove elements from the table, and the remainder are either undefined /// symbol errors, or import section entries depending on the output mode. -function_imports: std.AutoArrayHashMapUnmanaged(String, FunctionImportId) = .empty, +function_imports: std.array_hash_map.Auto(String, FunctionImportId) = .empty, /// At the end of prelink, this is populated with data symbols needed by /// objects. @@ -243,29 +243,29 @@ function_imports: std.AutoArrayHashMapUnmanaged(String, FunctionImportId) = .emp /// `flush` gets a copy of this table, and then Zcu exports are applied to /// remove elements from the table, and the remainder are either undefined /// symbol errors, or symbol table entries depending on the output mode. -data_imports: std.AutoArrayHashMapUnmanaged(String, DataImportId) = .empty, +data_imports: std.array_hash_map.Auto(String, DataImportId) = .empty, /// Set of data symbols that will appear in the final binary. Used to populate /// `Flush.data_segments` before sorting. -data_segments: std.AutoArrayHashMapUnmanaged(DataSegmentId, void) = .empty, +data_segments: std.array_hash_map.Auto(DataSegmentId, void) = .empty, /// Ordered list of non-import globals that will appear in the final binary. /// Empty until prelink. -globals: std.AutoArrayHashMapUnmanaged(GlobalImport.Resolution, void) = .empty, +globals: std.array_hash_map.Auto(GlobalImport.Resolution, void) = .empty, /// Tracks the value at the end of prelink, at which point `globals` /// contains only object file globals, and nothing from the Zcu yet. globals_end_prelink: u32 = 0, -global_imports: std.AutoArrayHashMapUnmanaged(String, GlobalImportId) = .empty, +global_imports: std.array_hash_map.Auto(String, GlobalImportId) = .empty, /// Ordered list of non-import tables that will appear in the final binary. /// Empty until prelink. -tables: std.AutoArrayHashMapUnmanaged(TableImport.Resolution, void) = .empty, -table_imports: std.AutoArrayHashMapUnmanaged(String, TableImport.Index) = .empty, +tables: std.array_hash_map.Auto(TableImport.Resolution, void) = .empty, +table_imports: std.array_hash_map.Auto(String, TableImport.Index) = .empty, /// All functions that have had their address taken and therefore might be /// called via a `call_indirect` function. -zcu_indirect_function_set: std.AutoArrayHashMapUnmanaged(InternPool.Nav.Index, void) = .empty, -object_indirect_function_import_set: std.AutoArrayHashMapUnmanaged(String, void) = .empty, -object_indirect_function_set: std.AutoArrayHashMapUnmanaged(ObjectFunctionIndex, void) = .empty, +zcu_indirect_function_set: std.array_hash_map.Auto(InternPool.Nav.Index, void) = .empty, +object_indirect_function_import_set: std.array_hash_map.Auto(String, void) = .empty, +object_indirect_function_set: std.array_hash_map.Auto(ObjectFunctionIndex, void) = .empty, error_name_table_ref_count: u32 = 0, tag_name_table_ref_count: u32 = 0, diff --git a/src/link/Wasm/Archive.zig b/src/link/Wasm/Archive.zig index 9424eeabf41db56a8fab5fc55464bdeaba49d857..65a1ee313b8c6bc5e8710728cd877284c47b544f 100644 --- a/src/link/Wasm/Archive.zig +++ b/src/link/Wasm/Archive.zig @@ -12,7 +12,7 @@ toc: Toc, /// Key points into `LazyArchive` `file_contents`. /// Value is allocated with gpa. -const Toc = std.StringArrayHashMapUnmanaged(std.ArrayList(u32)); +const Toc = std.array_hash_map.String(std.ArrayList(u32)); const ARMAG = std.elf.ARMAG; const ARFMAG = std.elf.ARFMAG; diff --git a/src/link/Wasm/Flush.zig b/src/link/Wasm/Flush.zig index 95bc18070facb84f8a5e5d5ab3286b2a6df8bc20..56b07cd158f0ab2b6fa79cc87daa15b76bbdb62f 100644 --- a/src/link/Wasm/Flush.zig +++ b/src/link/Wasm/Flush.zig @@ -24,22 +24,22 @@ const ArrayList = std.ArrayList; /// Ordered list of data segments that will appear in the final binary. /// When sorted, to-be-merged segments will be made adjacent. /// Values are virtual address. -data_segments: std.AutoArrayHashMapUnmanaged(Wasm.DataSegmentId, u32) = .empty, +data_segments: std.array_hash_map.Auto(Wasm.DataSegmentId, u32) = .empty, /// Each time a `data_segment` offset equals zero it indicates a new group, and /// the next element in this array will contain the total merged segment size. /// Value is the virtual memory address of the end of the segment. data_segment_groups: ArrayList(DataSegmentGroup) = .empty, binary_bytes: ArrayList(u8) = .empty, -missing_exports: std.AutoArrayHashMapUnmanaged(String, void) = .empty, -function_imports: std.AutoArrayHashMapUnmanaged(String, Wasm.FunctionImportId) = .empty, -global_imports: std.AutoArrayHashMapUnmanaged(String, Wasm.GlobalImportId) = .empty, -data_imports: std.AutoArrayHashMapUnmanaged(String, Wasm.DataImportId) = .empty, +missing_exports: std.array_hash_map.Auto(String, void) = .empty, +function_imports: std.array_hash_map.Auto(String, Wasm.FunctionImportId) = .empty, +global_imports: std.array_hash_map.Auto(String, Wasm.GlobalImportId) = .empty, +data_imports: std.array_hash_map.Auto(String, Wasm.DataImportId) = .empty, -indirect_function_table: std.AutoArrayHashMapUnmanaged(Wasm.OutputFunctionIndex, void) = .empty, +indirect_function_table: std.array_hash_map.Auto(Wasm.OutputFunctionIndex, void) = .empty, /// A subset of the full interned function type list created only during flush. -func_types: std.AutoArrayHashMapUnmanaged(Wasm.FunctionType.Index, void) = .empty, +func_types: std.array_hash_map.Auto(Wasm.FunctionType.Index, void) = .empty, /// For debug purposes only. memory_layout_finished: bool = false, diff --git a/src/main.zig b/src/main.zig index 142d5facb6dddffaa242d3e94081f2d549eb7a5c..44001796ff06962aae4168d2ae7ed7d241e84c42 100644 --- a/src/main.zig +++ b/src/main.zig @@ -987,7 +987,7 @@ fn buildOutputType( var test_no_exec = false; var test_execve = false; var entry: Compilation.CreateOptions.Entry = .default; - var force_undefined_symbols: std.StringArrayHashMapUnmanaged(void) = .empty; + var force_undefined_symbols: std.array_hash_map.String(void) = .empty; var stack_size: ?u64 = null; var image_base: ?u64 = null; var link_eh_frame_hdr = false; @@ -1024,7 +1024,7 @@ fn buildOutputType( // These are before resolving sysroot. var extra_cflags: std.ArrayList([]const u8) = .empty; var extra_rcflags: std.ArrayList([]const u8) = .empty; - var symbol_wrap_set: std.StringArrayHashMapUnmanaged(void) = .empty; + var symbol_wrap_set: std.array_hash_map.String(void) = .empty; var rc_includes: std.zig.RcIncludes = .any; var manifest_file: ?[]const u8 = null; var linker_export_symbol_names: std.ArrayList([]const u8) = .empty; @@ -3592,7 +3592,7 @@ fn buildOutputType( defer file_system_inputs.deinit(gpa); // Deduplicate rpath entries - var rpath_dedup = std.StringArrayHashMapUnmanaged(void){}; + var rpath_dedup = std.array_hash_map.String(void){}; for (create_module.rpath_list.items) |rpath| { try rpath_dedup.put(arena, rpath, {}); } @@ -3896,7 +3896,7 @@ fn buildOutputType( const CreateModule = struct { dirs: Compilation.Directories, - modules: std.StringArrayHashMapUnmanaged(CliModule), + modules: std.array_hash_map.String(CliModule), opts: Compilation.Config.Options, dynamic_linker: ?[]const u8, object_format: ?[]const u8, @@ -3908,7 +3908,7 @@ const CreateModule = struct { /// link_libcpp, and then the libraries are filtered into /// `unresolved_link_inputs` and `windows_libs`. cli_link_inputs: std.ArrayList(link.UnresolvedInput), - windows_libs: std.StringArrayHashMapUnmanaged(void), + windows_libs: std.array_hash_map.String(void), /// The local variable `unresolved_link_inputs` is fed into library /// resolution, mutating the input array, and producing this data as /// output. Allocated with gpa. @@ -3926,7 +3926,7 @@ const CreateModule = struct { lib_dir_args: std.ArrayList([]const u8), libc_installation: ?LibCInstallation, want_native_include_dirs: bool, - frameworks: std.StringArrayHashMapUnmanaged(Framework), + frameworks: std.array_hash_map.String(Framework), native_system_include_paths: []const []const u8, framework_dirs: std.ArrayList([]const u8), rpath_list: std.ArrayList([]const u8), @@ -4419,7 +4419,7 @@ fn serveUpdateResults(s: *Server, comp: *Compilation) !void { var file_name_bytes: std.ArrayList(u8) = .empty; defer file_name_bytes.deinit(gpa); - var files: std.AutoArrayHashMapUnmanaged(Zcu.File.Index, void) = .empty; + var files: std.array_hash_map.Auto(Zcu.File.Index, void) = .empty; defer files.deinit(gpa); var decl_data: std.ArrayList(u8) = .empty; defer decl_data.deinit(gpa); diff --git a/tools/dump-cov.zig b/tools/dump-cov.zig index 4a54d9f5199299a75dd8fcae46a7d3506ee53d50..c9a8aa8a32ccbe2fc063d30bda143f772bef0e19 100644 --- a/tools/dump-cov.zig +++ b/tools/dump-cov.zig @@ -67,7 +67,7 @@ pub fn main(init: std.process.Init) !void { try stdout.print("{any}\n", .{header.*}); const pcs = header.pcAddrs(); - var indexed_pcs: std.AutoArrayHashMapUnmanaged(usize, void) = .empty; + var indexed_pcs: std.array_hash_map.Auto(usize, void) = .empty; try indexed_pcs.entries.resize(arena, pcs.len); @memcpy(indexed_pcs.entries.items(.key), pcs); try indexed_pcs.reIndex(arena);