| author | |
| committer | |
| log | a558885321714ea1a21ee3d585b7f79f002adfd7 |
| tree | be8b75bf52518a2a0ea8750681816810cf39f86c |
| parent | 041bcbd10943bf78e315466b429ae0acfb5cd97a |
* delete dead code
* don't access stack trace too early
* revert unintended edit3 files changed, 3 insertions(+), 43 deletions(-)
src/Sema.zig-13| ... | @@ -9705,7 +9705,6 @@ fn funcCommon( | ... | @@ -9705,7 +9705,6 @@ fn funcCommon( |
| 9705 | func_inst, | 9705 | func_inst, |
| 9706 | cc_src, | 9706 | cc_src, |
| 9707 | is_noinline, | 9707 | is_noinline, |
| 9708 | is_generic, | ||
| 9709 | ); | 9708 | ); |
| 9710 | } | 9709 | } |
| 9711 | 9710 | ||
| ... | @@ -9745,7 +9744,6 @@ fn funcCommon( | ... | @@ -9745,7 +9744,6 @@ fn funcCommon( |
| 9745 | func_inst, | 9744 | func_inst, |
| 9746 | cc_src, | 9745 | cc_src, |
| 9747 | is_noinline, | 9746 | is_noinline, |
| 9748 | is_generic, | ||
| 9749 | ); | 9747 | ); |
| 9750 | } | 9748 | } |
| 9751 | 9749 | ||
| ... | @@ -9762,7 +9760,6 @@ fn funcCommon( | ... | @@ -9762,7 +9760,6 @@ fn funcCommon( |
| 9762 | func_inst, | 9760 | func_inst, |
| 9763 | cc_src, | 9761 | cc_src, |
| 9764 | is_noinline, | 9762 | is_noinline, |
| 9765 | is_generic, | ||
| 9766 | ); | 9763 | ); |
| 9767 | } | 9764 | } |
| 9768 | 9765 | ||
| ... | @@ -9779,14 +9776,11 @@ fn finishFunc( | ... | @@ -9779,14 +9776,11 @@ fn finishFunc( |
| 9779 | func_inst: Zir.Inst.Index, | 9776 | func_inst: Zir.Inst.Index, |
| 9780 | cc_src: LazySrcLoc, | 9777 | cc_src: LazySrcLoc, |
| 9781 | is_noinline: bool, | 9778 | is_noinline: bool, |
| 9782 | is_generic: bool, | ||
| 9783 | ) CompileError!Air.Inst.Ref { | 9779 | ) CompileError!Air.Inst.Ref { |
| 9784 | const pt = sema.pt; | 9780 | const pt = sema.pt; |
| 9785 | const zcu = pt.zcu; | 9781 | const zcu = pt.zcu; |
| 9786 | const ip = &zcu.intern_pool; | 9782 | const ip = &zcu.intern_pool; |
| 9787 | const gpa = sema.gpa; | 9783 | const gpa = sema.gpa; |
| 9788 | const target = zcu.getTarget(); | ||
| 9789 | const backend = target_util.zigBackend(target, zcu.comp.config.use_llvm); | ||
| 9790 | 9784 | ||
| 9791 | const return_type: Type = if (opt_func_index == .none or ret_poison) | 9785 | const return_type: Type = if (opt_func_index == .none or ret_poison) |
| 9792 | bare_return_type | 9786 | bare_return_type |
| ... | @@ -9913,13 +9907,6 @@ fn finishFunc( | ... | @@ -9913,13 +9907,6 @@ fn finishFunc( |
| 9913 | }), | 9907 | }), |
| 9914 | } | 9908 | } |
| 9915 | 9909 | ||
| 9916 | if (backend == .stage2_llvm and !is_generic and sema.wantErrorReturnTracing(return_type)) { | ||
| 9917 | // Make sure that StackTrace's fields are resolved so that the backend can | ||
| 9918 | // lower this fn type. | ||
| 9919 | const unresolved_stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace); | ||
| 9920 | try unresolved_stack_trace_ty.resolveFields(pt); | ||
| 9921 | } | ||
| 9922 | |||
| 9923 | return Air.internedToRef(if (opt_func_index != .none) opt_func_index else func_ty); | 9910 | return Air.internedToRef(if (opt_func_index != .none) opt_func_index else func_ty); |
| 9924 | } | 9911 | } |
| 9925 | 9912 |
src/codegen/llvm.zig+2-28| ... | @@ -1754,11 +1754,6 @@ pub const Object = struct { | ... | @@ -1754,11 +1754,6 @@ pub const Object = struct { |
| 1754 | } | 1754 | } |
| 1755 | } | 1755 | } |
| 1756 | 1756 | ||
| 1757 | pub fn freeDecl(self: *Object, decl_index: InternPool.DeclIndex) void { | ||
| 1758 | const global = self.decl_map.get(decl_index) orelse return; | ||
| 1759 | global.delete(&self.builder); | ||
| 1760 | } | ||
| 1761 | |||
| 1762 | fn getDebugFile(o: *Object, pt: Zcu.PerThread, file_index: Zcu.File.Index) Allocator.Error!Builder.Metadata { | 1757 | fn getDebugFile(o: *Object, pt: Zcu.PerThread, file_index: Zcu.File.Index) Allocator.Error!Builder.Metadata { |
| 1763 | const gpa = o.gpa; | 1758 | const gpa = o.gpa; |
| 1764 | const gop = try o.debug_file_map.getOrPut(gpa, file_index); | 1759 | const gop = try o.debug_file_map.getOrPut(gpa, file_index); |
| ... | @@ -2596,9 +2591,8 @@ pub const Object = struct { | ... | @@ -2596,9 +2591,8 @@ pub const Object = struct { |
| 2596 | } | 2591 | } |
| 2597 | 2592 | ||
| 2598 | if (fn_info.cc == .auto and zcu.comp.config.any_error_tracing) { | 2593 | if (fn_info.cc == .auto and zcu.comp.config.any_error_tracing) { |
| 2599 | const stack_trace_ty = zcu.builtin_decl_values.get(.StackTrace); | 2594 | // Stack trace pointer. |
| 2600 | const ptr_ty = try pt.ptrType(.{ .child = stack_trace_ty }); | 2595 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(pt, .fromInterned(.ptr_usize_type))); |
| 2601 | debug_param_types.appendAssumeCapacity(try o.lowerDebugType(pt, ptr_ty)); | ||
| 2602 | } | 2596 | } |
| 2603 | 2597 | ||
| 2604 | for (0..fn_info.param_types.len) |i| { | 2598 | for (0..fn_info.param_types.len) |i| { |
| ... | @@ -12901,26 +12895,6 @@ fn compilerRtIntBits(bits: u16) u16 { | ... | @@ -12901,26 +12895,6 @@ fn compilerRtIntBits(bits: u16) u16 { |
| 12901 | return bits; | 12895 | return bits; |
| 12902 | } | 12896 | } |
| 12903 | 12897 | ||
| 12904 | fn getStackTraceType(pt: Zcu.PerThread) Allocator.Error!Type { | ||
| 12905 | const zcu = pt.zcu; | ||
| 12906 | const ip = &zcu.intern_pool; | ||
| 12907 | |||
| 12908 | const std_file_index = zcu.module_roots.get(zcu.std_mod).?.unwrap().?; | ||
| 12909 | const builtin_str = try ip.getOrPutString(zcu.gpa, pt.tid, "builtin", .no_embedded_nulls); | ||
| 12910 | const std_file_root_type = Type.fromInterned(zcu.fileRootType(std_file_index)); | ||
| 12911 | const std_namespace = ip.namespacePtr(std_file_root_type.getNamespaceIndex(zcu)); | ||
| 12912 | const builtin_nav = std_namespace.pub_decls.getKeyAdapted(builtin_str, Zcu.Namespace.NameAdapter{ .zcu = zcu }).?; | ||
| 12913 | |||
| 12914 | const stack_trace_str = try ip.getOrPutString(zcu.gpa, pt.tid, "StackTrace", .no_embedded_nulls); | ||
| 12915 | // buffer is only used for int_type, `builtin` is a struct. | ||
| 12916 | const builtin_ty = zcu.navValue(builtin_nav).toType(); | ||
| 12917 | const builtin_namespace = zcu.namespacePtr(builtin_ty.getNamespaceIndex(zcu)); | ||
| 12918 | const stack_trace_nav = builtin_namespace.pub_decls.getKeyAdapted(stack_trace_str, Zcu.Namespace.NameAdapter{ .zcu = zcu }).?; | ||
| 12919 | |||
| 12920 | // Sema should have ensured that StackTrace was analyzed. | ||
| 12921 | return zcu.navValue(stack_trace_nav).toType(); | ||
| 12922 | } | ||
| 12923 | |||
| 12924 | fn buildAllocaInner( | 12898 | fn buildAllocaInner( |
| 12925 | wip: *Builder.WipFunction, | 12899 | wip: *Builder.WipFunction, |
| 12926 | llvm_ty: Builder.Type, | 12900 | llvm_ty: Builder.Type, |
src/link/Wasm.zig+1-2| ... | @@ -3807,11 +3807,10 @@ pub fn flush( | ... | @@ -3807,11 +3807,10 @@ pub fn flush( |
| 3807 | tid: Zcu.PerThread.Id, | 3807 | tid: Zcu.PerThread.Id, |
| 3808 | prog_node: std.Progress.Node, | 3808 | prog_node: std.Progress.Node, |
| 3809 | ) link.File.FlushError!void { | 3809 | ) link.File.FlushError!void { |
| 3810 | _ = tid; | ||
| 3811 | |||
| 3812 | // The goal is to never use this because it's only needed if we need to | 3810 | // The goal is to never use this because it's only needed if we need to |
| 3813 | // write to InternPool, but flush is too late to be writing to the | 3811 | // write to InternPool, but flush is too late to be writing to the |
| 3814 | // InternPool. | 3812 | // InternPool. |
| 3813 | _ = tid; | ||
| 3815 | const comp = wasm.base.comp; | 3814 | const comp = wasm.base.comp; |
| 3816 | const diags = &comp.link_diags; | 3815 | const diags = &comp.link_diags; |
| 3817 | const gpa = comp.gpa; | 3816 | const gpa = comp.gpa; |