aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/net/main_plan9_test.go
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2025-04-24 10:29:34 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2025-04-24 10:29:34 +0200
commit1d52798ea907471b992616911ef4991ba704195f (patch)
treeeb19bee357bad73751438c7e5881d4fb4d1ddfcd /libgo/go/net/main_plan9_test.go
parent599bca27dc37b3f7979bd6af30a357104f2b90c1 (diff)
downloadgcc-master.zip
gcc-master.tar.gz
gcc-master.tar.bz2
dwarf2out: Decrease dw_loc_descr_node and dw_attr_struct struct sizes [PR119711]HEADtrunkmaster
As noted by Richi on a large testcase, there are unnecessary paddings in some heavily used dwarf2out.{h,cc} structures on 64-bit hosts. struct dw_val_node { enum dw_val_class val_class; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ struct addr_table_entry * val_entry; /* 8 8 */ union dw_val_struct_union v; /* 16 16 */ /* size: 32, cachelines: 1, members: 3 */ /* sum members: 28, holes: 1, sum holes: 4 */ /* last cacheline: 32 bytes */ }; struct dw_loc_descr_node { dw_loc_descr_ref dw_loc_next; /* 0 8 */ enum dwarf_location_atom dw_loc_opc:8; /* 8: 0 4 */ unsigned int dtprel:1; /* 8: 8 4 */ unsigned int frame_offset_rel:1; /* 8: 9 4 */ /* XXX 22 bits hole, try to pack */ int dw_loc_addr; /* 12 4 */ struct dw_val_node dw_loc_oprnd1; /* 16 32 */ struct dw_val_node dw_loc_oprnd2; /* 48 32 */ /* size: 80, cachelines: 2, members: 7 */ /* sum members: 76 */ /* sum bitfield members: 10 bits, bit holes: 1, sum bit holes: 22 bits */ /* last cacheline: 16 bytes */ }; struct dw_attr_struct { enum dwarf_attribute dw_attr; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ struct dw_val_node dw_attr_val; /* 8 32 */ /* size: 40, cachelines: 1, members: 2 */ /* sum members: 36, holes: 1, sum holes: 4 */ /* last cacheline: 40 bytes */ }; The following patch is an (not very clean admittedly) attempt to decrease size of dw_loc_descr_node from 80 bytes to 72 and (more importantly) dw_attr_struct from 40 bytes to 32 by moving the dw_attr member from dw_attr_struct into dw_attr_val's padding and similarly move dw_loc_opc/dtprel/frame_offset_rel members into dw_loc_oprnd1 padding and dw_loc_addr into dw_loc_oprnd2 padding. All we need to ensure is that nothing tries to copy whole dw_val_node structs unless it is copied as part of whole dw_loc_descr_node or dw_attr_struct copy. To verify that wasn't the case, I've temporarily added a deleted copy ctor to dw_val_node and then looked at all the errors/warnings caused by that, and those were just from memcpy/memmove or structure assignments of whole dw_loc_descr_node/dw_attr_struct. 2025-04-24 Jakub Jelinek <jakub@redhat.com> PR debug/119711 * dwarf2out.h (struct dw_val_node): Add u member. (struct dw_loc_descr_node): Remove dw_loc_opc, dtprel, frame_offset_rel and dw_loc_addr members. (dw_loc_opc, dw_loc_dtprel, dw_loc_frame_offset_rel, dw_loc_addr): Define. (struct dw_attr_struct): Remove dw_attr member. (dw_attr): Define. * dwarf2out.cc (loc_descr_equal_p_1): Use dw_loc_dtprel instead of dtprel. (output_loc_operands, new_addr_loc_descr, loc_checksum, loc_checksum_ordered): Likewise. (resolve_args_picking_1): Use dw_loc_frame_offset_rel instead of frame_offset_rel. (loc_list_from_tree_1): Likewise. (resolve_addr_in_expr): Use dw_loc_dtprel instead of dtprel. (copy_deref_exprloc): Copy val_class, val_entry and v members instead of whole dw_loc_oprnd1 and dw_loc_oprnd2. (optimize_string_length): Copy val_class, val_entry and v members instead of whole dw_attr_val. (hash_loc_operands): Use dw_loc_dtprel instead of dtprel. (compare_loc_operands, compare_locs): Likewise.
Diffstat (limited to 'libgo/go/net/main_plan9_test.go')
0 files changed, 0 insertions, 0 deletions