authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2025-04-13 21:24:08+03:30
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-13 12:16:31-07:00
log041bcbd10943bf78e315466b429ae0acfb5cd97a
tree5d788b87754c109423145f6a9a3c0bca6e666f75
parente3b79d65d808700d6308996a52186dcb3ff48b06

Do not store StackTrace type


3 files changed, 7 insertions(+), 6 deletions(-)

src/Sema.zig+3-3
......@@ -9785,6 +9785,8 @@ fn finishFunc(
97859785 const zcu = pt.zcu;
97869786 const ip = &zcu.intern_pool;
97879787 const gpa = sema.gpa;
9788 const target = zcu.getTarget();
9789 const backend = target_util.zigBackend(target, zcu.comp.config.use_llvm);
97889790
97899791 const return_type: Type = if (opt_func_index == .none or ret_poison)
97909792 bare_return_type
......@@ -9911,13 +9913,11 @@ fn finishFunc(
99119913 }),
99129914 }
99139915
9914 if (!is_generic and sema.wantErrorReturnTracing(return_type)) {
9916 if (backend == .stage2_llvm and !is_generic and sema.wantErrorReturnTracing(return_type)) {
99159917 // Make sure that StackTrace's fields are resolved so that the backend can
99169918 // lower this fn type.
99179919 const unresolved_stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace);
99189920 try unresolved_stack_trace_ty.resolveFields(pt);
9919
9920 if (zcu.stack_trace_type == .none) zcu.stack_trace_type = unresolved_stack_trace_ty.toIntern();
99219921 }
99229922
99239923 return Air.internedToRef(if (opt_func_index != .none) opt_func_index else func_ty);
src/Zcu.zig-1
......@@ -308,7 +308,6 @@ free_type_references: std.ArrayListUnmanaged(u32) = .empty,
308308
309309/// Populated by analysis of `AnalUnit.wrap(.{ .memoized_state = s })`, where `s` depends on the element.
310310builtin_decl_values: BuiltinDecl.Memoized = .initFill(.none),
311stack_trace_type: InternPool.Index = .none,
312311
313312incremental_debug_state: if (build_options.enable_debug_extensions) IncrementalDebugState else void =
314313 if (build_options.enable_debug_extensions) .init else {},
src/codegen/llvm.zig+4-2
......@@ -2596,7 +2596,8 @@ pub const Object = struct {
25962596 }
25972597
25982598 if (fn_info.cc == .auto and zcu.comp.config.any_error_tracing) {
2599 const ptr_ty = try pt.ptrType(.{ .child = zcu.stack_trace_type });
2599 const stack_trace_ty = zcu.builtin_decl_values.get(.StackTrace);
2600 const ptr_ty = try pt.ptrType(.{ .child = stack_trace_ty });
26002601 debug_param_types.appendAssumeCapacity(try o.lowerDebugType(pt, ptr_ty));
26012602 }
26022603
......@@ -3508,7 +3509,8 @@ pub const Object = struct {
35083509 }
35093510
35103511 if (fn_info.cc == .auto and zcu.comp.config.any_error_tracing) {
3511 const ptr_ty = try pt.ptrType(.{ .child = zcu.stack_trace_type });
3512 const stack_trace_ty = zcu.builtin_decl_values.get(.StackTrace);
3513 const ptr_ty = try pt.ptrType(.{ .child = stack_trace_ty });
35123514 try llvm_params.append(o.gpa, try o.lowerType(pt, ptr_ty));
35133515 }
35143516