Dwarf: remove redundant debug info

This commit is contained in:
Jacob Young
2024-12-18 06:15:42 -05:00
parent 0ff0bdb4a7
commit 06206479a9
3 changed files with 28 additions and 68 deletions

View File

@@ -225,7 +225,6 @@ pub const ZIG_padding = 0x2cce;
pub const ZIG_relative_decl = 0x2cd0;
pub const ZIG_decl_line_relative = 0x2cd1;
pub const ZIG_comptime_value = 0x2cd2;
pub const ZIG_comptime_default_value = 0x2cd3;
pub const ZIG_sentinel = 0x2ce2;
// UPC extension.

View File

@@ -2687,23 +2687,19 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
},
};
try wip_nav.abbrevCode(if (is_comptime)
if (has_runtime_bits and has_comptime_state)
.struct_field_comptime_runtime_bits_comptime_state
else if (has_comptime_state)
if (has_comptime_state)
.struct_field_comptime_comptime_state
else if (has_runtime_bits)
.struct_field_comptime_runtime_bits
else
.struct_field_comptime
else if (field_init != .none)
if (has_runtime_bits and has_comptime_state)
.struct_field_default_runtime_bits_comptime_state
else if (has_comptime_state)
if (has_comptime_state)
.struct_field_default_comptime_state
else if (has_runtime_bits)
.struct_field_default_runtime_bits
else
.struct_field_default
.struct_field
else
.struct_field);
if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {
@@ -2717,8 +2713,10 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
field_type.abiAlignment(zcu).toByteUnits().?);
}
if (has_runtime_bits) try wip_nav.blockValue(nav_src_loc, .fromInterned(field_init));
if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));
if (has_comptime_state)
try wip_nav.refValue(.fromInterned(field_init))
else if (has_runtime_bits)
try wip_nav.blockValue(nav_src_loc, .fromInterned(field_init));
}
try uleb128(diw, @intFromEnum(AbbrevCode.null));
}
@@ -3363,9 +3361,7 @@ fn updateLazyType(
field_type.comptimeOnly(zcu) and try field_type.onePossibleValue(pt) == null,
},
};
try wip_nav.abbrevCode(if (has_runtime_bits and has_comptime_state)
.struct_field_comptime_runtime_bits_comptime_state
else if (has_comptime_state)
try wip_nav.abbrevCode(if (has_comptime_state)
.struct_field_comptime_comptime_state
else if (has_runtime_bits)
.struct_field_comptime_runtime_bits
@@ -3386,8 +3382,10 @@ fn updateLazyType(
try uleb128(diw, field_type.abiAlignment(zcu).toByteUnits().?);
field_byte_offset += field_type.abiSize(zcu);
}
if (has_runtime_bits) try wip_nav.blockValue(src_loc, .fromInterned(comptime_value));
if (has_comptime_state) try wip_nav.refValue(.fromInterned(comptime_value));
if (has_comptime_state)
try wip_nav.refValue(.fromInterned(comptime_value))
else if (has_runtime_bits)
try wip_nav.blockValue(src_loc, .fromInterned(comptime_value));
}
try uleb128(diw, @intFromEnum(AbbrevCode.null));
},
@@ -3956,23 +3954,19 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
},
};
try wip_nav.abbrevCode(if (is_comptime)
if (has_runtime_bits and has_comptime_state)
.struct_field_comptime_runtime_bits_comptime_state
else if (has_comptime_state)
if (has_comptime_state)
.struct_field_comptime_comptime_state
else if (has_runtime_bits)
.struct_field_comptime_runtime_bits
else
.struct_field_comptime
else if (field_init != .none)
if (has_runtime_bits and has_comptime_state)
.struct_field_default_runtime_bits_comptime_state
else if (has_comptime_state)
if (has_comptime_state)
.struct_field_default_comptime_state
else if (has_runtime_bits)
.struct_field_default_runtime_bits
else
.struct_field_default
.struct_field
else
.struct_field);
if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {
@@ -3986,8 +3980,10 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
field_type.abiAlignment(zcu).toByteUnits().?);
}
if (has_runtime_bits) try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));
if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));
if (has_comptime_state)
try wip_nav.refValue(.fromInterned(field_init))
else if (has_runtime_bits)
try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));
}
try uleb128(diw, @intFromEnum(AbbrevCode.null));
}
@@ -4064,23 +4060,19 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
},
};
try wip_nav.abbrevCode(if (is_comptime)
if (has_runtime_bits and has_comptime_state)
.struct_field_comptime_runtime_bits_comptime_state
else if (has_comptime_state)
if (has_comptime_state)
.struct_field_comptime_comptime_state
else if (has_runtime_bits)
.struct_field_comptime_runtime_bits
else
.struct_field_comptime
else if (field_init != .none)
if (has_runtime_bits and has_comptime_state)
.struct_field_default_runtime_bits_comptime_state
else if (has_comptime_state)
if (has_comptime_state)
.struct_field_default_comptime_state
else if (has_runtime_bits)
.struct_field_default_runtime_bits
else
.struct_field_default
.struct_field
else
.struct_field);
if (loaded_struct.fieldName(ip, field_index).unwrap()) |field_name| try wip_nav.strp(field_name.toSlice(ip)) else {
@@ -4094,8 +4086,10 @@ pub fn updateContainerType(dwarf: *Dwarf, pt: Zcu.PerThread, type_index: InternP
try uleb128(diw, loaded_struct.fieldAlign(ip, field_index).toByteUnits() orelse
field_type.abiAlignment(zcu).toByteUnits().?);
}
if (has_runtime_bits) try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));
if (has_comptime_state) try wip_nav.refValue(.fromInterned(field_init));
if (has_comptime_state)
try wip_nav.refValue(.fromInterned(field_init))
else if (has_runtime_bits)
try wip_nav.blockValue(ty_src_loc, .fromInterned(field_init));
}
try uleb128(diw, @intFromEnum(AbbrevCode.null));
}
@@ -4680,14 +4674,11 @@ const AbbrevCode = enum {
big_enum_field,
generated_field,
struct_field,
struct_field_default,
struct_field_default_runtime_bits,
struct_field_default_comptime_state,
struct_field_default_runtime_bits_comptime_state,
struct_field_comptime,
struct_field_comptime_runtime_bits,
struct_field_comptime_comptime_state,
struct_field_comptime_runtime_bits_comptime_state,
packed_struct_field,
untagged_union_field,
tagged_union,
@@ -4980,15 +4971,6 @@ const AbbrevCode = enum {
.{ .alignment, .udata },
},
},
.struct_field_default = .{
.tag = .member,
.attrs = &.{
.{ .name, .strp },
.{ .type, .ref_addr },
.{ .data_member_location, .udata },
.{ .alignment, .udata },
},
},
.struct_field_default_runtime_bits = .{
.tag = .member,
.attrs = &.{
@@ -5006,18 +4988,7 @@ const AbbrevCode = enum {
.{ .type, .ref_addr },
.{ .data_member_location, .udata },
.{ .alignment, .udata },
.{ .ZIG_comptime_default_value, .ref_addr },
},
},
.struct_field_default_runtime_bits_comptime_state = .{
.tag = .member,
.attrs = &.{
.{ .name, .strp },
.{ .type, .ref_addr },
.{ .data_member_location, .udata },
.{ .alignment, .udata },
.{ .default_value, .block },
.{ .ZIG_comptime_default_value, .ref_addr },
.{ .ZIG_comptime_value, .ref_addr },
},
},
.struct_field_comptime = .{
@@ -5046,16 +5017,6 @@ const AbbrevCode = enum {
.{ .ZIG_comptime_value, .ref_addr },
},
},
.struct_field_comptime_runtime_bits_comptime_state = .{
.tag = .member,
.attrs = &.{
.{ .const_expr, .flag_present },
.{ .name, .strp },
.{ .type, .ref_addr },
.{ .const_value, .block },
.{ .ZIG_comptime_value, .ref_addr },
},
},
.packed_struct_field = .{
.tag = .member,
.attrs = &.{

View File

@@ -702,7 +702,7 @@ class root_InternPool_Local_List_SynthProvider:
def __init__(self, value, _=None): self.value = value
def update(self):
capacity = self.value.EvaluateExpression('@as(*@This().Header, @alignCast(@ptrCast(@this().bytes - @This().bytes_offset))).capacity')
self.view = create_struct('view', self.value.EvaluateExpression('@This().View').GetValueAsType(), bytes=self.value.GetChildMemberWithName('bytes'), len=capacity, capacity=capacity).GetNonSyntheticValue()
self.view = create_struct('view', self.value.type.FindDirectNestedType('View'), bytes=self.value.GetChildMemberWithName('bytes'), len=capacity, capacity=capacity).GetNonSyntheticValue()
def has_children(self): return True
def num_children(self): return 1
def get_child_index(self, name):