diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-06-12 01:44:12 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-11 23:45:09 -0700 |
| commit | d37ebfcf231c68a0430840c4fbe649dd0076ae1e (patch) | |
| tree | d9f67acedf38600487a2d2ed08e1e202dfad5667 /src/link/Plan9.zig | |
| parent | 54460e39ace2140e6bfcb0bf4ae1709d128f9e8d (diff) | |
| download | zig-d37ebfcf231c68a0430840c4fbe649dd0076ae1e.tar.gz zig-d37ebfcf231c68a0430840c4fbe649dd0076ae1e.zip | |
InternPool: avoid as many slices pointing to `string_bytes` as possible
These are frequently invalidated whenever a string is interned, so avoid
creating pointers to `string_bytes` wherever possible. This is an
attempt to fix random CI failures.
Diffstat (limited to 'src/link/Plan9.zig')
| -rw-r--r-- | src/link/Plan9.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig index 5cf2add528..2606dd7aac 100644 --- a/src/link/Plan9.zig +++ b/src/link/Plan9.zig @@ -725,10 +725,10 @@ fn addDeclExports( const decl_block = self.getDeclBlock(metadata.index); for (exports) |exp| { - const exp_name = mod.intern_pool.stringToSlice(exp.name); + const exp_name = mod.intern_pool.stringToSlice(exp.opts.name); // plan9 does not support custom sections - if (mod.intern_pool.stringToSliceUnwrap(exp.section)) |section_name| { - if (!mem.eql(u8, section_name, ".text") or !mem.eql(u8, section_name, ".data")) { + if (exp.opts.section.unwrap()) |section_name| { + if (!mod.intern_pool.stringEqlSlice(section_name, ".text") and !mod.intern_pool.stringEqlSlice(section_name, ".data")) { try mod.failed_exports.put(mod.gpa, exp, try Module.ErrorMsg.create( self.base.allocator, mod.declPtr(decl_index).srcLoc(mod), @@ -972,7 +972,7 @@ pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void { const sym = self.syms.items[decl_block.sym_index.?]; try self.writeSym(writer, sym); if (self.base.options.module.?.decl_exports.get(decl_index)) |exports| { - for (exports.items) |e| if (decl_metadata.getExport(self, ip.stringToSlice(e.name))) |exp_i| { + for (exports.items) |e| if (decl_metadata.getExport(self, ip.stringToSlice(e.opts.name))) |exp_i| { try self.writeSym(writer, self.syms.items[exp_i]); }; } @@ -998,7 +998,7 @@ pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void { const sym = self.syms.items[decl_block.sym_index.?]; try self.writeSym(writer, sym); if (self.base.options.module.?.decl_exports.get(decl_index)) |exports| { - for (exports.items) |e| if (decl_metadata.getExport(self, ip.stringToSlice(e.name))) |exp_i| { + for (exports.items) |e| if (decl_metadata.getExport(self, ip.stringToSlice(e.opts.name))) |exp_i| { const s = self.syms.items[exp_i]; if (mem.eql(u8, s.name, "_start")) self.entry_val = s.value; |
