diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2024-08-06 11:22:37 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2024-08-16 15:22:55 -0400 |
| commit | ef11bc9899002620d67cfce9c79b6c0dc0f5ea61 (patch) | |
| tree | 7b05fe17340c06e4c40c45ebe249361c0c281c72 /src/Zcu.zig | |
| parent | 90989be0e31a91335f8d1c1eafb84c3b34792a8c (diff) | |
| download | zig-ef11bc9899002620d67cfce9c79b6c0dc0f5ea61.tar.gz zig-ef11bc9899002620d67cfce9c79b6c0dc0f5ea61.zip | |
Dwarf: rework self-hosted debug info from scratch
This is in preparation for incremental and actually being able to debug
executables built by the x86_64 backend.
Diffstat (limited to 'src/Zcu.zig')
| -rw-r--r-- | src/Zcu.zig | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Zcu.zig b/src/Zcu.zig index 10fa45a62b..da78e20cf3 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -2737,7 +2737,7 @@ pub fn addUnitReference(zcu: *Zcu, src_unit: AnalUnit, referenced_unit: AnalUnit pub fn errorSetBits(mod: *Zcu) u16 { if (mod.error_limit == 0) return 0; - return std.math.log2_int_ceil(ErrorInt, mod.error_limit + 1); // +1 for no error + return @as(u16, std.math.log2_int(ErrorInt, mod.error_limit)) + 1; } pub fn errNote( @@ -3005,6 +3005,14 @@ pub const UnionLayout = struct { tag_align: Alignment, tag_size: u64, padding: u32, + + pub fn tagOffset(layout: UnionLayout) u64 { + return if (layout.tag_align.compare(.lt, layout.payload_align)) layout.payload_size else 0; + } + + pub fn payloadOffset(layout: UnionLayout) u64 { + return if (layout.tag_align.compare(.lt, layout.payload_align)) 0 else layout.tag_size; + } }; /// Returns the index of the active field, given the current tag value |
