public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH, applied] dwarf-reader,ir: Unify type sorting & sort types before c14n
@ 2024-05-09 22:34 Dodji Seketeli
  0 siblings, 0 replies; only message in thread
From: Dodji Seketeli @ 2024-05-09 22:34 UTC (permalink / raw)
  To: libabigail

[-- Attachment #1: Type: text/plain, Size: 7052 bytes --]

Hello,

This fixes the temporary breakage I have introduced by committing too
soon the patch below that should have been committed after the type
hashing patch:

    d26bd3d2 dwarf-reader,ir: Merge member fns of classes

Oops.

That patch introduces some instability in the ABIXML output due to the
fact that sorting of function types in particular is not deterministic
enough.  I believe that because the sorting is using the internal
pretty representation of function types, it can introduce instability
in the sorting of two types that are equivalent modulo one typedef,
because the internal pretty representation strips typedefs off of
function return and parameter types.  This patch fixes that by using
the type_topo_comp operator used in the IR for sorting types, instead
of having a different sorting routine in the ABIXML writer.  Another
instability is due to the fact that method types where there is no
parameter beside the implicit "this" parameter and that are different
due to const-ness of the enclosing class could not be told apart.  The
patch fixes that as well.

The patch also sorts types before canonicalizing them in the ABIXML
reader, so that type canonicalization happens in the same order (in
DWARF and ABIXML) to minimize changes in canonicalization results
between DWARF and ABIXML.  This should hopefully help minimize
self-comparison errors.

Note that sorting types (based on their pretty representation) before
canonicalizing them might incur some (temporary) slowness that I
believe should be handled by the coming type hashing patch set.  If we
see that the slowness is not bearable, we might remove that sorting at
some point.  For now, let's keep it for testing purposes.

	* src/abg-ctf-reader.cc (reader::canonicalize_all_types): Use a
	temporary vector as input for ir::canonicalize_types because it
	needs an ordered container as it now sorts types before
	canonicalizing them.
	* src/abg-dwarf-reader.cc (reader::types_to_canonicalize): Add a
	non-const overload for this accessor.
	* src/abg-ir-priv.h (compare_using_locations)
	(is_ptr_ref_or_qual_type): Add a declaration for these functions
	defined in abg-ir.cc.
	(struct decl_topo_comp, struct type_topo_comp): Move these here,
	from abg-ir.cc.
	(canonicalize_types): Sort the types before canonicalizing them.
	* src/abg-ir.cc (compare_using_locations): Turn this from static
	to non-static, now that it's declared in abg-ir-priv.h.
	(struct decl_topo_comp, struct type_topo_comp): Move these into
	abg-ir-priv.h.
	* src/abg-reader.cc: Include abg-ir-priv.h.
	(reader::perform_late_type_canonicalizing): Use
	ir::canonicalize_types, rather than canonicalizing types one by
	one.
	* src/abg-writer.cc: Include abg-ir-priv.h.
	(struct type_topo_comp): Remove.
	(write_context::sort_types): Use type_topo_comp from abg-ir-priv.h
	instead of type_topo_comp that was removed.
	* tests/data/test-annotate/test13-pr18894.so.abi: Adjust.
	* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
	* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
	* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR22015-libboost_iostreams.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.
	* tests/data/test-read-dwarf/test-libandroid.so.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise.
	* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.
	* tests/data/test-read-write/test28-without-std-fns-ref.xml:
	Likewise.
	* tests/data/test-read-write/test28-without-std-vars-ref.xml:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master branch.
---
 src/abg-ctf-reader.cc                         |    10 +-
 src/abg-dwarf-reader.cc                       |    15 +-
 src/abg-ir-priv.h                             |   289 +-
 src/abg-ir.cc                                 |   268 +-
 src/abg-reader.cc                             |    14 +-
 src/abg-writer.cc                             |    94 +-
 .../data/test-annotate/test13-pr18894.so.abi  |   366 +-
 .../data/test-annotate/test14-pr18893.so.abi  |  1800 +-
 .../data/test-annotate/test15-pr18892.so.abi  |  1032 +-
 .../data/test-annotate/test17-pr19027.so.abi  |   372 +-
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi |   150 +-
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |  1720 +-
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi |   318 +-
 .../data/test-annotate/test21-pr19092.so.abi  |    14 +-
 .../PR22015-libboost_iostreams.so.abi         |   110 +-
 .../test-read-dwarf/PR22122-libftdc.so.abi    |  2700 +-
 .../data/test-read-dwarf/PR25007-sdhci.ko.abi |  1550 +-
 .../test-read-dwarf/test-libandroid.so.abi    |  2412 +-
 .../test-read-dwarf/test10-pr18818-gcc.so.abi |    38 +-
 .../test-read-dwarf/test11-pr18828.so.abi     |  3884 +--
 .../test-read-dwarf/test12-pr18844.so.abi     | 13622 ++++-----
 .../test-read-dwarf/test13-pr18894.so.abi     |   346 +-
 .../test-read-dwarf/test14-pr18893.so.abi     |  1704 +-
 .../test-read-dwarf/test15-pr18892.so.abi     |   538 +-
 .../test-read-dwarf/test16-pr18904.so.abi     |  3354 +--
 .../test-read-dwarf/test17-pr19027.so.abi     |   278 +-
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi |   116 +-
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |  1550 +-
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi |   182 +-
 .../test-read-dwarf/test21-pr19092.so.abi     |     8 +-
 .../test22-pr19097-libstdc++.so.6.0.17.so.abi | 22995 ++++++++--------
 .../test9-pr18818-clang.so.abi                |  1122 +-
 .../test28-without-std-fns-ref.xml            |    18 +-
 .../test28-without-std-vars-ref.xml           |    18 +-
 34 files changed, 31466 insertions(+), 31541 deletions(-)

The patch is rather big for the mailing list so I am attaching a gzipped
version of it.


[-- Attachment #2: 0005-dwarf-reader-ir-Unify-type-sorting-sort-types-before.patch.gz --]
[-- Type: application/gzip, Size: 688799 bytes --]

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]



-- 
		Dodji

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-09 22:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-09 22:34 [PATCH, applied] dwarf-reader,ir: Unify type sorting & sort types before c14n Dodji Seketeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).