authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-07-13 15:34:31-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-07-13 15:34:31-07:00
log204f61d7f5aa7b5e27bdaaab9237fca17096ad3e
tree374e2979a0f40ffe9ece7887353e59de3047524d
parent75a720565bb72e7fab03346df6a35e9a8f380962

stage2: Module: use StringHashMapUnmanaged


1 files changed, 3 insertions(+), 4 deletions(-)

src-self-hosted/Module.zig+3-4
...@@ -36,7 +36,7 @@ bin_file_path: []const u8,...@@ -36,7 +36,7 @@ bin_file_path: []const u8,
36decl_exports: std.AutoHashMapUnmanaged(*Decl, []*Export) = .{},36decl_exports: std.AutoHashMapUnmanaged(*Decl, []*Export) = .{},
37/// We track which export is associated with the given symbol name for quick37/// We track which export is associated with the given symbol name for quick
38/// detection of symbol collisions.38/// detection of symbol collisions.
39symbol_exports: std.StringHashMap(*Export),39symbol_exports: std.StringHashMapUnmanaged(*Export) = .{},
40/// This models the Decls that perform exports, so that `decl_exports` can be updated when a Decl40/// This models the Decls that perform exports, so that `decl_exports` can be updated when a Decl
41/// is modified. Note that the key of this table is not the Decl being exported, but the Decl that41/// is modified. Note that the key of this table is not the Decl being exported, but the Decl that
42/// is performing the export of another Decl.42/// is performing the export of another Decl.
...@@ -769,7 +769,6 @@ pub fn init(gpa: *Allocator, options: InitOptions) !Module {...@@ -769,7 +769,6 @@ pub fn init(gpa: *Allocator, options: InitOptions) !Module {
769 .bin_file_path = options.bin_file_path,769 .bin_file_path = options.bin_file_path,
770 .bin_file = bin_file,770 .bin_file = bin_file,
771 .optimize_mode = options.optimize_mode,771 .optimize_mode = options.optimize_mode,
772 .symbol_exports = std.StringHashMap(*Export).init(gpa),
773 .work_queue = std.fifo.LinearFifo(WorkItem, .Dynamic).init(gpa),772 .work_queue = std.fifo.LinearFifo(WorkItem, .Dynamic).init(gpa),
774 .keep_source_files_loaded = options.keep_source_files_loaded,773 .keep_source_files_loaded = options.keep_source_files_loaded,
775 };774 };
...@@ -812,7 +811,7 @@ pub fn deinit(self: *Module) void {...@@ -812,7 +811,7 @@ pub fn deinit(self: *Module) void {
812 }811 }
813 self.export_owners.deinit(gpa);812 self.export_owners.deinit(gpa);
814813
815 self.symbol_exports.deinit();814 self.symbol_exports.deinit(gpa);
816 self.root_scope.destroy(gpa);815 self.root_scope.destroy(gpa);
817 self.* = undefined;816 self.* = undefined;
818}817}
...@@ -2305,7 +2304,7 @@ fn analyzeExport(self: *Module, scope: *Scope, src: usize, symbol_name: []const...@@ -2305,7 +2304,7 @@ fn analyzeExport(self: *Module, scope: *Scope, src: usize, symbol_name: []const
2305 return;2304 return;
2306 }2305 }
23072306
2308 try self.symbol_exports.putNoClobber(symbol_name, new_export);2307 try self.symbol_exports.putNoClobber(self.gpa, symbol_name, new_export);
2309 self.bin_file.updateDeclExports(self, exported_decl, de_gop.entry.value) catch |err| switch (err) {2308 self.bin_file.updateDeclExports(self, exported_decl, de_gop.entry.value) catch |err| switch (err) {
2310 error.OutOfMemory => return error.OutOfMemory,2309 error.OutOfMemory => return error.OutOfMemory,
2311 else => {2310 else => {