| ... | @@ -2759,13 +2759,19 @@ pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .Debug); | ... | @@ -2759,13 +2759,19 @@ pub const Trace = ConfigurableTrace(2, 4, builtin.mode == .Debug); |
| 2759 | | 2759 | |
| 2760 | pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type { | 2760 | pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize, comptime is_enabled: bool) type { |
| 2761 | return struct { | 2761 | return struct { |
| 2762 | addrs: [actual_size][stack_frame_count]usize = undefined, | 2762 | addrs: [actual_size][stack_frame_count]usize, |
| 2763 | notes: [actual_size][]const u8 = undefined, | 2763 | notes: [actual_size][]const u8, |
| 2764 | index: Index = 0, | 2764 | index: Index, |
| 2765 | | 2765 | |
| 2766 | const actual_size = if (enabled) size else 0; | 2766 | const actual_size = if (enabled) size else 0; |
| 2767 | const Index = if (enabled) usize else u0; | 2767 | const Index = if (enabled) usize else u0; |
| 2768 | | 2768 | |
| | 2769 | pub const init: @This() = .{ |
| | 2770 | .addrs = undefined, |
| | 2771 | .notes = undefined, |
| | 2772 | .index = 0, |
| | 2773 | }; |
| | 2774 | |
| 2769 | pub const enabled = is_enabled; | 2775 | pub const enabled = is_enabled; |
| 2770 | | 2776 | |
| 2771 | pub const add = if (enabled) addNoInline else addNoOp; | 2777 | pub const add = if (enabled) addNoInline else addNoOp; |