| author | |
| committer | |
| log | 2a122576c3042c30f9a78492252cbbc4c0424a40 |
| tree | 693b48f7dbd595d24c750e770e7ffe4c236b9731 |
| parent | e761d5200a0888e4c56e04a725979c70de457e71 |
These are not planned to ever be deterministic.7 files changed, 29 insertions(+), 34 deletions(-)
src/Compilation.zig+1| ... | ... | @@ -2101,6 +2101,7 @@ pub fn create(gpa: Allocator, arena: Allocator, io: Io, diag: *CreateDiagnostic, |
| 2101 | 2101 | .analysis_roots_buffer = undefined, |
| 2102 | 2102 | .analysis_roots_len = 0, |
| 2103 | 2103 | .codegen_task_pool = try .init(arena), |
| 2104 | .anon_name_counter = 0, | |
| 2104 | 2105 | }; |
| 2105 | 2106 | try zcu.init(gpa, io, options.thread_limit); |
| 2106 | 2107 | break :blk zcu; |
src/InternPool.zig+7-2| ... | ... | @@ -9503,6 +9503,7 @@ pub const GetFuncInstanceKey = struct { |
| 9503 | 9503 | is_noinline: bool, |
| 9504 | 9504 | generic_owner: Index, |
| 9505 | 9505 | inferred_error_set: bool, |
| 9506 | anon_name_counter: *u32, | |
| 9506 | 9507 | }; |
| 9507 | 9508 | |
| 9508 | 9509 | pub fn getFuncInstance( |
| ... | ... | @@ -9580,6 +9581,7 @@ pub fn getFuncInstance( |
| 9580 | 9581 | generic_owner, |
| 9581 | 9582 | func_index, |
| 9582 | 9583 | func_extra_index, |
| 9584 | arg.anon_name_counter, | |
| 9583 | 9585 | ); |
| 9584 | 9586 | return gop.put(); |
| 9585 | 9587 | } |
| ... | ... | @@ -9731,6 +9733,7 @@ fn getFuncInstanceIes( |
| 9731 | 9733 | generic_owner, |
| 9732 | 9734 | func_index, |
| 9733 | 9735 | func_extra_index, |
| 9736 | arg.anon_name_counter, | |
| 9734 | 9737 | ); |
| 9735 | 9738 | |
| 9736 | 9739 | func_gop.putFinal(func_index); |
| ... | ... | @@ -9749,14 +9752,16 @@ fn finishFuncInstance( |
| 9749 | 9752 | generic_owner: Index, |
| 9750 | 9753 | func_index: Index, |
| 9751 | 9754 | func_extra_index: u32, |
| 9755 | anon_name_counter: *u32, | |
| 9752 | 9756 | ) Allocator.Error!void { |
| 9753 | 9757 | const fn_owner_nav = ip.getNav(ip.funcDeclInfo(generic_owner).owner_nav); |
| 9754 | 9758 | const fn_namespace = fn_owner_nav.analysis.?.namespace; |
| 9755 | 9759 | |
| 9756 | 9760 | // TODO: improve this name |
| 9757 | const nav_name = try ip.getOrPutStringFmt(gpa, io, tid, "{f}__anon_{d}", .{ | |
| 9758 | fn_owner_nav.name.fmt(ip), @backingInt(func_index), | |
| 9761 | const nav_name = try ip.getOrPutStringFmt(gpa, io, tid, "{f}__func_{d}", .{ | |
| 9762 | fn_owner_nav.name.fmt(ip), anon_name_counter.*, | |
| 9759 | 9763 | }, .no_embedded_nulls); |
| 9764 | anon_name_counter.* += 1; | |
| 9760 | 9765 | const nav_fqn = try ip.namespacePtr(fn_namespace).internFullyQualifiedName(ip, gpa, io, tid, nav_name); |
| 9761 | 9766 | const nav_index = try ip.createNav(gpa, io, tid, nav_name, nav_fqn, .{ |
| 9762 | 9767 | .type = ip.typeOf(func_index), |
src/Sema.zig+3-1| ... | ... | @@ -7039,6 +7039,7 @@ fn analyzeCall( |
| 7039 | 7039 | .inferred_error_set = fn_zir_info.inferred_error_set, |
| 7040 | 7040 | .generic_owner = func_val.?.toIntern(), |
| 7041 | 7041 | .comptime_args = comptime_args, |
| 7042 | .anon_name_counter = &zcu.anon_name_counter, | |
| 7042 | 7043 | }); |
| 7043 | 7044 | if (zcu.comp.debugIncremental()) { |
| 7044 | 7045 | const nav = ip.indexToKey(func_instance).func.owner_nav; |
| ... | ... | @@ -35222,9 +35223,10 @@ pub fn setTypeName( |
| 35222 | 35223 | io, |
| 35223 | 35224 | pt.tid, |
| 35224 | 35225 | "{f}__{s}_{d}", |
| 35225 | .{ block.type_name_ctx.fmt(ip), anon_prefix, @backingInt(wip.index) }, | |
| 35226 | .{ block.type_name_ctx.fmt(ip), anon_prefix, zcu.anon_name_counter }, | |
| 35226 | 35227 | .no_embedded_nulls, |
| 35227 | 35228 | ), .none); |
| 35229 | zcu.anon_name_counter += 1; | |
| 35228 | 35230 | }, |
| 35229 | 35231 | .parent => wip.setName(ip, block.type_name_ctx, sema.owner.unwrap().nav_val.toOptional()), |
| 35230 | 35232 | .func => { |
src/Zcu.zig+3| ... | ... | @@ -348,6 +348,9 @@ codegen_task_pool: CodegenTaskPool, |
| 348 | 348 | |
| 349 | 349 | generation: u32 = 0, |
| 350 | 350 | |
| 351 | /// Only access from the Sema thread. | |
| 352 | anon_name_counter: u32, | |
| 353 | ||
| 351 | 354 | pub const DependencyReason = struct { |
| 352 | 355 | src: LazySrcLoc, |
| 353 | 356 | /// Only populated if this is for a `.type_layout` unit. |
src/link/Coff.zig+10-11| ... | ... | @@ -3108,7 +3108,7 @@ fn ensureMemberSymbol(coff: *Coff, mi: Member.Index, name: String) !void { |
| 3108 | 3108 | coff.member_prog_node.increaseEstimatedTotalItems(1); |
| 3109 | 3109 | } |
| 3110 | 3110 | |
| 3111 | fn flushSymbolTableEntry(coff: *Coff, index: u32, pt: Zcu.PerThread) !void { | |
| 3111 | fn flushSymbolTableEntry(coff: *Coff, index: u32) !void { | |
| 3112 | 3112 | assert(!coff.isImage()); |
| 3113 | 3113 | const gpa = coff.base.comp.gpa; |
| 3114 | 3114 | |
| ... | ... | @@ -3119,7 +3119,6 @@ fn flushSymbolTableEntry(coff: *Coff, index: u32, pt: Zcu.PerThread) !void { |
| 3119 | 3119 | assert(sym.ni != .none or sym.gmi != .none); |
| 3120 | 3120 | |
| 3121 | 3121 | const entry = coff.symbolTableEntryPtr(sti.*) orelse entry: { |
| 3122 | var buf: [15]u8 = undefined; | |
| 3123 | 3122 | const symbol_name, const num_aux_symbols: u8, const complex_type: std.coff.ComplexType = |
| 3124 | 3123 | if (sym.gmi != .none) blk: { |
| 3125 | 3124 | const name = sym.gmi.name(coff); |
| ... | ... | @@ -3148,21 +3147,22 @@ fn flushSymbolTableEntry(coff: *Coff, index: u32, pt: Zcu.PerThread) !void { |
| 3148 | 3147 | }; |
| 3149 | 3148 | }, |
| 3150 | 3149 | .uav => |umi| { |
| 3151 | var w = Io.Writer.fixed(&buf); | |
| 3152 | w.print("__anon_{x}", .{umi.uavValue(coff)}) catch unreachable; | |
| 3150 | var name_buf: [std.fmt.count("__anon_{d}", .{std.math.maxInt(u32)})]u8 = undefined; | |
| 3151 | const name = std.mem.print(&name_buf, "__anon_{d}", .{umi}) catch unreachable; | |
| 3153 | 3152 | break :blk .{ |
| 3154 | try coff.getOrPutSymbolName(w.buffered(), null), | |
| 3153 | try coff.getOrPutSymbolName(name, null), | |
| 3155 | 3154 | 0, |
| 3156 | 3155 | .NULL, |
| 3157 | 3156 | }; |
| 3158 | 3157 | }, |
| 3159 | 3158 | inline .lazy_code, .lazy_const_data => |mi, tag| { |
| 3160 | 3159 | const lazy_sym = mi.lazySymbol(coff); |
| 3161 | const name = try gpa.print("__lazy_{s}_{f}", .{ | |
| 3162 | @tagName(lazy_sym.kind), | |
| 3163 | Type.fromInterned(lazy_sym.ty).fmt(pt), | |
| 3164 | }); | |
| 3165 | defer gpa.free(name); | |
| 3160 | var name_buf: [ | |
| 3161 | std.fmt.count("__lazy_const_data_{d}", .{std.math.maxInt(u32)}) | |
| 3162 | ]u8 = undefined; | |
| 3163 | const name = std.mem.print(&name_buf, "__lazy_{t}_{d}", .{ | |
| 3164 | lazy_sym.kind, mi, | |
| 3165 | }) catch unreachable; | |
| 3166 | 3166 | |
| 3167 | 3167 | const string = try coff.getOrPutString(name); |
| 3168 | 3168 | break :blk .{ |
| ... | ... | @@ -6023,7 +6023,6 @@ fn resolve(coff: *Coff, tid: Zcu.PerThread.Id) !bool { |
| 6023 | 6023 | defer sub_prog_node.end(); |
| 6024 | 6024 | coff.flushSymbolTableEntry( |
| 6025 | 6025 | coff.symbol_table.pending_symbol_index, |
| 6026 | .{ .zcu = comp.zcu.?, .tid = tid }, | |
| 6027 | 6026 | ) catch |err| switch (err) { |
| 6028 | 6027 | error.OutOfMemory => return error.OutOfMemory, |
| 6029 | 6028 | else => |e| return comp.link_diags.fail( |
src/link/Elf2.zig+3-10| ... | ... | @@ -3309,11 +3309,8 @@ fn lazySymbolInner(elf: *Elf, pt: Zcu.PerThread, lazy: link.File.LazySymbol) Err |
| 3309 | 3309 | }; |
| 3310 | 3310 | const node = try shndx.get(elf).ni.addFloatingChild(&elf.mf, gpa, .{}); |
| 3311 | 3311 | var name_buf: [std.fmt.count("__lazy_const_data_{d}", .{std.math.maxInt(u32)})]u8 = undefined; |
| 3312 | const name = std.mem.print( | |
| 3313 | &name_buf, | |
| 3314 | "__lazy_{t}_{d}", | |
| 3315 | .{ lazy.kind, @backingInt(lazy.ty) }, | |
| 3316 | ) catch unreachable; | |
| 3312 | const name = std.mem.print(&name_buf, "__lazy_{t}_{d}", .{ lazy.kind, gop.index }) catch | |
| 3313 | unreachable; | |
| 3317 | 3314 | gop.value_ptr.* = .{ |
| 3318 | 3315 | .lsi = elf.addLocalSymbolAssumeCapacity(.{ |
| 3319 | 3316 | .node = .wrap(node), |
| ... | ... | @@ -5921,11 +5918,7 @@ fn uavMapIndex( |
| 5921 | 5918 | .alignment = resolved_align, |
| 5922 | 5919 | }); |
| 5923 | 5920 | var name_buf: [std.fmt.count("__anon_{d}", .{std.math.maxInt(u32)})]u8 = undefined; |
| 5924 | const name = std.mem.print( | |
| 5925 | &name_buf, | |
| 5926 | "__anon_{d}", | |
| 5927 | .{@backingInt(uav_val)}, | |
| 5928 | ) catch unreachable; | |
| 5921 | const name = std.mem.print(&name_buf, "__anon_{d}", .{umi}) catch unreachable; | |
| 5929 | 5922 | uav_gop.value_ptr.* = .{ |
| 5930 | 5923 | .lsi = elf.addLocalSymbolAssumeCapacity(.{ |
| 5931 | 5924 | .node = .wrap(node), |
src/link/Wasm.zig+2-10| ... | ... | @@ -1374,11 +1374,7 @@ pub const GlobalImport = extern struct { |
| 1374 | 1374 | .__tls_base => @tagName(Unpacked.__tls_base), |
| 1375 | 1375 | .__tls_size => @tagName(Unpacked.__tls_size), |
| 1376 | 1376 | .object_global => |i| i.name(wasm).slice(wasm), |
| 1377 | inline .uav_obj, .uav_exe => |i| std.mem.print( | |
| 1378 | buf, | |
| 1379 | "__anon_{d}", | |
| 1380 | .{@backingInt(i.key(wasm).*)}, | |
| 1381 | ) catch unreachable, | |
| 1377 | inline .uav_obj, .uav_exe => |i| std.mem.print(buf, "__anon_{d}", .{i}) catch unreachable, | |
| 1382 | 1378 | .nav_obj => |i| i.name(wasm), |
| 1383 | 1379 | .nav_exe => |i| i.name(wasm), |
| 1384 | 1380 | }; |
| ... | ... | @@ -1997,11 +1993,7 @@ pub const ObjectDataImport = extern struct { |
| 1997 | 1993 | .__heap_base => @tagName(.__heap_base), |
| 1998 | 1994 | .__heap_end => @tagName(.__heap_end), |
| 1999 | 1995 | .__wasm_first_page_end => @tagName(.__wasm_first_page_end), |
| 2000 | inline .uav_exe, .uav_obj => |i| std.mem.print( | |
| 2001 | buf, | |
| 2002 | "__anon_{d}", | |
| 2003 | .{@backingInt(i.key(wasm).*)}, | |
| 2004 | ) catch unreachable, | |
| 1996 | inline .uav_exe, .uav_obj => |i| std.mem.print(buf, "__anon_{d}", .{i}) catch unreachable, | |
| 2005 | 1997 | inline .nav_exe, .nav_obj => |i| i.name(wasm), |
| 2006 | 1998 | }; |
| 2007 | 1999 | } |