summaryrefslogtreecommitdiff
path: root/libctf/ChangeLog
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2021-03-18 12:37:52 +0000
committerNick Alcock <nick.alcock@oracle.com>2021-03-18 12:40:40 +0000
commit08c428aff4a793b63c7dd2229ae172879623e3a2 (patch)
treed6c1e1a4945afb465889f9ff8d0337b548c6e111 /libctf/ChangeLog
parent77d724a7ecdb3fa84557b0ee5c8b7ea949ce56a5 (diff)
downloadbinutils-gdb-08c428aff4a793b63c7dd2229ae172879623e3a2.tar.gz
libctf: eliminate dtd_u, part 5: structs / unions
Eliminate the dynamic member storage for structs and unions as we have for other dynamic types. This is much like the previous enum elimination, except that structs and unions are the only types for which a full-sized ctf_type_t might be needed. Up to now, this decision has been made in the individual ctf_add_{struct,union}_sized functions and duplicated in ctf_add_member_offset. The vlen machinery lets us simplify this, always allocating a ctf_lmember_t and setting the dtd_data's ctt_size to CTF_LSIZE_SENT: we figure out whether this is really justified and (almost always) repack things down into a ctf_stype_t at ctf_serialize time. This allows us to eliminate the dynamic member paths from the iterators and query functions in ctf-types.c in favour of always using the large-structure vlen stuff for dynamic types (the diff is ugly but that's just because of the volume of reindentation this calls for). This also means the large-structure vlen stuff gets more heavily tested, which is nice because it was an almost totally unused code path before now (it only kicked in for structures of size >4GiB, and how often do you see those?) The only extra complexity here is ctf_add_type. Back in the days of the nondeduplicating linker this was called a ridiculous number of times for countless identical copies of structures: eschewing the repeated lookups of the dtd in ctf_add_member_offset and adding the members directly saved an amazing amount of time. Now the nondeduplicating linker is gone, this is extreme overoptimization: we can rip out the direct addition and use ctf_member_next and ctf_add_member_offset, just like ctf_dedup_emit does. We augment a ctf_add_type test to try adding a self-referential struct, the only thing the ctf_add_type part of this change really perturbs. This completes the elimination of dtd_u. libctf/ChangeLog 2021-03-18 Nick Alcock <nick.alcock@oracle.com> * ctf-impl.h (ctf_dtdef_t) <dtu_members>: Remove. <dtd_u>: Likewise. (ctf_dmdef_t): Remove. (struct ctf_next) <u.ctn_dmd>: Remove. * ctf-create.c (INITIAL_VLEN): New, more-or-less arbitrary initial vlen size. (ctf_add_enum): Use it. (ctf_dtd_delete): Do not free the (removed) dmd; remove string refs from the vlen on struct deletion. (ctf_add_struct_sized): Populate the vlen: do it by hand if promoting forwards. Always populate the full-size lsizehi/lsizelo members. (ctf_add_union_sized): Likewise. (ctf_add_member_offset): Set up the vlen rather than the dmd. Expand it as needed, repointing string refs via ctf_str_move_pending. Add the member names as pending strings. Always populate the full-size lsizehi/lsizelo members. (membadd): Remove, folding back into... (ctf_add_type_internal): ... here, adding via an ordinary ctf_add_struct_sized and _next iteration rather than doing everything by hand. * ctf-serialize.c (ctf_copy_smembers): Remove this... (ctf_copy_lmembers): ... and this... (ctf_emit_type_sect): ... folding into here. Figure out if a ctf_stype_t is needed here, not in ctf_add_*_sized. (ctf_type_sect_size): Figure out the ctf_stype_t stuff the same way here. * ctf-types.c (ctf_member_next): Remove the dmd path and always use the vlen. Force large-structure usage for dynamic types. (ctf_type_align): Likewise. (ctf_member_info): Likewise. (ctf_type_rvisit): Likewise. * testsuite/libctf-regression/type-add-unnamed-struct-ctf.c: Add a self-referential type to this test. * testsuite/libctf-regression/type-add-unnamed-struct.c: Adjusted accordingly. * testsuite/libctf-regression/type-add-unnamed-struct.lk: Likewise.
Diffstat (limited to 'libctf/ChangeLog')
-rw-r--r--libctf/ChangeLog40
1 files changed, 40 insertions, 0 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index fa333d5c2bd..7874a776305 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,45 @@
2021-03-18 Nick Alcock <nick.alcock@oracle.com>
+ * ctf-impl.h (ctf_dtdef_t) <dtu_members>: Remove.
+ <dtd_u>: Likewise.
+ (ctf_dmdef_t): Remove.
+ (struct ctf_next) <u.ctn_dmd>: Remove.
+ * ctf-create.c (INITIAL_VLEN): New, more-or-less arbitrary initial
+ vlen size.
+ (ctf_add_enum): Use it.
+ (ctf_dtd_delete): Do not free the (removed) dmd; remove string
+ refs from the vlen on struct deletion.
+ (ctf_add_struct_sized): Populate the vlen: do it by hand if
+ promoting forwards. Always populate the full-size
+ lsizehi/lsizelo members.
+ (ctf_add_union_sized): Likewise.
+ (ctf_add_member_offset): Set up the vlen rather than the dmd.
+ Expand it as needed, repointing string refs via
+ ctf_str_move_pending. Add the member names as pending strings.
+ Always populate the full-size lsizehi/lsizelo members.
+ (membadd): Remove, folding back into...
+ (ctf_add_type_internal): ... here, adding via an ordinary
+ ctf_add_struct_sized and _next iteration rather than doing
+ everything by hand.
+ * ctf-serialize.c (ctf_copy_smembers): Remove this...
+ (ctf_copy_lmembers): ... and this...
+ (ctf_emit_type_sect): ... folding into here. Figure out if a
+ ctf_stype_t is needed here, not in ctf_add_*_sized.
+ (ctf_type_sect_size): Figure out the ctf_stype_t stuff the same
+ way here.
+ * ctf-types.c (ctf_member_next): Remove the dmd path and always
+ use the vlen. Force large-structure usage for dynamic types.
+ (ctf_type_align): Likewise.
+ (ctf_member_info): Likewise.
+ (ctf_type_rvisit): Likewise.
+ * testsuite/libctf-regression/type-add-unnamed-struct-ctf.c: Add a
+ self-referential type to this test.
+ * testsuite/libctf-regression/type-add-unnamed-struct.c: Adjusted
+ accordingly.
+ * testsuite/libctf-regression/type-add-unnamed-struct.lk: Likewise.
+
+2021-03-18 Nick Alcock <nick.alcock@oracle.com>
+
* ctf-impl.h (ctf_dtdef_t) <dtd_vlen_alloc>: New.
(ctf_str_move_pending): Declare.
* ctf-string.c (ctf_str_add_ref_internal): Fix error return.