| ... | ... | @@ -2593,6 +2593,9 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2593 | 2593 | decl_struct: { |
| 2594 | 2594 | if (loaded_struct.zir_index == .none) break :decl_struct; |
| 2595 | 2595 | |
| 2596 | const type_inst_info = loaded_struct.zir_index.unwrap().?.resolveFull(ip).?; |
| 2597 | if (type_inst_info.file != inst_info.file) break :decl_struct; |
| 2598 | |
| 2596 | 2599 | const value_inst = value_inst: { |
| 2597 | 2600 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; |
| 2598 | 2601 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); |
| ... | ... | @@ -2608,7 +2611,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2608 | 2611 | }; |
| 2609 | 2612 | break :value_inst value_inst; |
| 2610 | 2613 | }; |
| 2611 | | const type_inst_info = loaded_struct.zir_index.unwrap().?.resolveFull(ip).?; |
| 2612 | 2614 | if (type_inst_info.inst != value_inst) break :decl_struct; |
| 2613 | 2615 | |
| 2614 | 2616 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); |
| ... | ... | @@ -2623,6 +2625,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2623 | 2625 | type_gop.value_ptr.* = nav_gop.value_ptr.*; |
| 2624 | 2626 | } |
| 2625 | 2627 | wip_nav.entry = nav_gop.value_ptr.*; |
| 2628 | |
| 2626 | 2629 | const diw = wip_nav.debug_info.writer(dwarf.gpa); |
| 2627 | 2630 | |
| 2628 | 2631 | switch (loaded_struct.layout) { |
| ... | ... | @@ -2714,6 +2717,9 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2714 | 2717 | decl_enum: { |
| 2715 | 2718 | if (loaded_enum.zir_index == .none) break :decl_enum; |
| 2716 | 2719 | |
| 2720 | const type_inst_info = loaded_enum.zir_index.unwrap().?.resolveFull(ip).?; |
| 2721 | if (type_inst_info.file != inst_info.file) break :decl_enum; |
| 2722 | |
| 2717 | 2723 | const value_inst = value_inst: { |
| 2718 | 2724 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; |
| 2719 | 2725 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); |
| ... | ... | @@ -2729,7 +2735,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2729 | 2735 | }; |
| 2730 | 2736 | break :value_inst value_inst; |
| 2731 | 2737 | }; |
| 2732 | | const type_inst_info = loaded_enum.zir_index.unwrap().?.resolveFull(ip).?; |
| 2733 | 2738 | if (type_inst_info.inst != value_inst) break :decl_enum; |
| 2734 | 2739 | |
| 2735 | 2740 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); |
| ... | ... | @@ -2797,6 +2802,9 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2797 | 2802 | } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private }; |
| 2798 | 2803 | |
| 2799 | 2804 | decl_union: { |
| 2805 | const type_inst_info = loaded_union.zir_index.resolveFull(ip).?; |
| 2806 | if (type_inst_info.file != inst_info.file) break :decl_union; |
| 2807 | |
| 2800 | 2808 | const value_inst = value_inst: { |
| 2801 | 2809 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; |
| 2802 | 2810 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); |
| ... | ... | @@ -2812,7 +2820,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2812 | 2820 | }; |
| 2813 | 2821 | break :value_inst value_inst; |
| 2814 | 2822 | }; |
| 2815 | | const type_inst_info = loaded_union.zir_index.resolveFull(ip).?; |
| 2816 | 2823 | if (type_inst_info.inst != value_inst) break :decl_union; |
| 2817 | 2824 | |
| 2818 | 2825 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); |
| ... | ... | @@ -2872,9 +2879,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2872 | 2879 | } |
| 2873 | 2880 | } |
| 2874 | 2881 | try uleb128(diw, @intFromEnum(AbbrevCode.null)); |
| 2875 | | |
| 2876 | | if (ip.indexToKey(loaded_union.enum_tag_ty).enum_type == .generated_tag) |
| 2877 | | try wip_nav.pending_types.append(dwarf.gpa, loaded_union.enum_tag_ty); |
| 2878 | 2882 | } else for (0..loaded_union.field_types.len) |field_index| { |
| 2879 | 2883 | try wip_nav.abbrevCode(.untagged_union_field); |
| 2880 | 2884 | try wip_nav.strp(loaded_tag.names.get(ip)[field_index].toSlice(ip)); |
| ... | ... | @@ -2919,6 +2923,9 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2919 | 2923 | } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private }; |
| 2920 | 2924 | |
| 2921 | 2925 | decl_opaque: { |
| 2926 | const type_inst_info = loaded_opaque.zir_index.resolveFull(ip).?; |
| 2927 | if (type_inst_info.file != inst_info.file) break :decl_opaque; |
| 2928 | |
| 2922 | 2929 | const value_inst = value_inst: { |
| 2923 | 2930 | const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body; |
| 2924 | 2931 | const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1])); |
| ... | ... | @@ -2934,7 +2941,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool |
| 2934 | 2941 | }; |
| 2935 | 2942 | break :value_inst value_inst; |
| 2936 | 2943 | }; |
| 2937 | | const type_inst_info = loaded_opaque.zir_index.resolveFull(ip).?; |
| 2938 | 2944 | if (type_inst_info.inst != value_inst) break :decl_opaque; |
| 2939 | 2945 | |
| 2940 | 2946 | const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern()); |
| ... | ... | @@ -3381,14 +3387,12 @@ fn updateType( |
| 3381 | 3387 | .Kernel, .Fragment, .Vertex => .nocall, |
| 3382 | 3388 | }))); |
| 3383 | 3389 | try wip_nav.refType(Type.fromInterned(func_type.return_type)); |
| 3384 | | if (!is_nullary) { |
| 3385 | | for (0..func_type.param_types.len) |param_index| { |
| 3386 | | try wip_nav.abbrevCode(.func_type_param); |
| 3387 | | try wip_nav.refType(Type.fromInterned(func_type.param_types.get(ip)[param_index])); |
| 3388 | | } |
| 3389 | | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); |
| 3390 | | try uleb128(diw, @intFromEnum(AbbrevCode.null)); |
| 3390 | for (0..func_type.param_types.len) |param_index| { |
| 3391 | try wip_nav.abbrevCode(.func_type_param); |
| 3392 | try wip_nav.refType(Type.fromInterned(func_type.param_types.get(ip)[param_index])); |
| 3391 | 3393 | } |
| 3394 | if (func_type.is_var_args) try wip_nav.abbrevCode(.is_var_args); |
| 3395 | if (!is_nullary) try uleb128(diw, @intFromEnum(AbbrevCode.null)); |
| 3392 | 3396 | }, |
| 3393 | 3397 | .error_set_type => |error_set_type| { |
| 3394 | 3398 | try wip_nav.abbrevCode(if (error_set_type.names.len > 0) .enum_type else .empty_enum_type); |
| ... | ... | @@ -3643,9 +3647,6 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP |
| 3643 | 3647 | } |
| 3644 | 3648 | } |
| 3645 | 3649 | try uleb128(diw, @intFromEnum(AbbrevCode.null)); |
| 3646 | | |
| 3647 | | if (ip.indexToKey(loaded_union.enum_tag_ty).enum_type == .generated_tag) |
| 3648 | | try wip_nav.pending_types.append(dwarf.gpa, loaded_union.enum_tag_ty); |
| 3649 | 3650 | } else for (0..loaded_union.field_types.len) |field_index| { |
| 3650 | 3651 | try wip_nav.abbrevCode(.untagged_union_field); |
| 3651 | 3652 | try wip_nav.strp(loaded_tag.names.get(ip)[field_index].toSlice(ip)); |
| ... | ... | @@ -3824,7 +3825,7 @@ pub fn flushModule(dwarf: *Dwarf, pt: Zcu.PerThread) FlushError!void { |
| 3824 | 3825 | sleb128(header.fixedWriter(), dwarf.debug_frame.header.data_alignment_factor) catch unreachable; |
| 3825 | 3826 | uleb128(header.fixedWriter(), dwarf.debug_frame.header.return_address_register) catch unreachable; |
| 3826 | 3827 | uleb128(header.fixedWriter(), 1) catch unreachable; |
| 3827 | | header.appendAssumeCapacity(0x10 | 0x08 | 0x03); |
| 3828 | header.appendAssumeCapacity(DW.EH.PE.pcrel | DW.EH.PE.sdata4); |
| 3828 | 3829 | header.appendAssumeCapacity(DW.CFA.def_cfa_sf); |
| 3829 | 3830 | uleb128(header.fixedWriter(), Register.rsp.dwarfNum()) catch unreachable; |
| 3830 | 3831 | sleb128(header.fixedWriter(), -1) catch unreachable; |