Skip to content

Commit 041bcbd

Browse files
alichraghiandrewrk
authored andcommitted
Do not store StackTrace type
1 parent e3b79d6 commit 041bcbd

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/Sema.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.
310310
builtin_decl_values: BuiltinDecl.Memoized = .initFill(.none),
311-
stack_trace_type: InternPool.Index = .none,
312311

313312
incremental_debug_state: if (build_options.enable_debug_extensions) IncrementalDebugState else void =
314313
if (build_options.enable_debug_extensions) .init else {},

src/codegen/llvm.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)