XML writer: map type ids by bare pointer

This is a performance and safety improvement made possible by previous
changes which ensure that the same pointers are used for insertion and
look-up.

This change affects two test cases. In more detail:

The test case test-read-dwarf/PR22122-libftdc.so.abi has many
duplicate type-id-60 which appear to all be types defined with a DWARF
DW_AT_signature attribute. These are made into separate types by this
change, but remain incomplete.

The test case test-read-dwarf/PR25007-sdhci.ko.abi has duplicate
declarations and these get split into duplicate declarations with new
type ids following this change. The test suite runs with an implicit
--no-linux-kernel-mode so the duplicates are treated separately. They
presumably had the same type ids before this change due to deep
equality considering them equal.

	* src/abg-writer.cc (type_ptr_map): use default equality on
	type_base pointer.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Refresh
	test case, as described above.
	* tests/data/test-read-dwarf/PR25007-sdhci.ko.abi: Likewise.

Reviewed-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Matthias Maennich <maennich@google.com>
This commit is contained in:
Matthias Maennich 2021-12-03 11:46:22 +00:00 committed by Dodji Seketeli
parent 4565679f3d
commit 16e3d3a6f3
3 changed files with 3167 additions and 3170 deletions

View File

@ -31,7 +31,6 @@ ABG_BEGIN_EXPORT_DECLARATIONS
#include "abg-config.h"
#include "abg-corpus.h"
#include "abg-diff-utils.h"
#include "abg-hash.h"
#include "abg-sptr-utils.h"
@ -119,9 +118,7 @@ struct type_hasher
/// A convenience typedef for a map that associates a pointer to type
/// to a string. The pointer to type is hashed as fast as possible.
typedef unordered_map<type_base*,
interned_string,
type_hasher,
abigail::diff_utils::deep_ptr_eq_functor> type_ptr_map;
interned_string> type_ptr_map;
// A convenience typedef for a set of type_base*.
typedef std::unordered_set<const type_base*> type_ptr_set_type;

File diff suppressed because it is too large Load Diff

View File

@ -11479,46 +11479,46 @@
</function-type>
</abi-instr>
<abi-instr address-size='64' path='drivers/mmc/host/sdhci.mod.c' comp-dir-path='/ws/android/kernel/aosp/common-mainline/out/android-mainline/common' language='LANG_C89'>
<class-decl name='anon_vma' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1086'/>
<class-decl name='audit_context' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1089'/>
<class-decl name='backing_dev_info' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1091'/>
<class-decl name='bio_list' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1094'/>
<class-decl name='blk_plug' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1095'/>
<class-decl name='capture_control' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1097'/>
<class-decl name='cfs_rq' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1099'/>
<class-decl name='files_struct' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1202'/>
<class-decl name='fs_struct' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1205'/>
<class-decl name='ftrace_ret_stack' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1208'/>
<class-decl name='kernfs_iattrs' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1342'/>
<class-decl name='kernfs_open_node' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1344'/>
<class-decl name='kioctx_table' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1348'/>
<class-decl name='kmem_cache' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1349'/>
<class-decl name='linux_binfmt' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1359'/>
<class-decl name='mem_cgroup' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1365'/>
<class-decl name='module_notes_attrs' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1370'/>
<class-decl name='module_param_attrs' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1371'/>
<class-decl name='module_sect_attrs' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1372'/>
<class-decl name='nameidata' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1374'/>
<class-decl name='perf_event' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1380'/>
<class-decl name='pipe_inode_info' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1382'/>
<class-decl name='poll_table_struct' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1383'/>
<class-decl name='pollfd' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1385'/>
<class-decl name='rcu_node' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1394'/>
<class-decl name='reclaim_state' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1395'/>
<class-decl name='request_queue' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1397'/>
<class-decl name='rt_mutex_waiter' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1400'/>
<class-decl name='rt_rq' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1401'/>
<class-decl name='sched_class' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1172'/>
<class-decl name='seccomp_filter' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1405'/>
<class-decl name='seq_file' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1407'/>
<class-decl name='sock' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1411'/>
<class-decl name='task_group' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1416'/>
<class-decl name='trace_eval_map' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1420'/>
<class-decl name='trace_event_call' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1422'/>
<class-decl name='uprobe' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1471'/>
<class-decl name='user_namespace' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1472'/>
<class-decl name='workqueue_struct' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1551'/>
<class-decl name='xol_area' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1554'/>
<class-decl name='anon_vma' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1555'/>
<class-decl name='audit_context' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1556'/>
<class-decl name='backing_dev_info' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1557'/>
<class-decl name='bio_list' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1558'/>
<class-decl name='blk_plug' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1559'/>
<class-decl name='capture_control' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1560'/>
<class-decl name='cfs_rq' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1561'/>
<class-decl name='files_struct' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1562'/>
<class-decl name='fs_struct' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1563'/>
<class-decl name='ftrace_ret_stack' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1564'/>
<class-decl name='kernfs_iattrs' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1565'/>
<class-decl name='kernfs_open_node' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1566'/>
<class-decl name='kioctx_table' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1567'/>
<class-decl name='kmem_cache' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1568'/>
<class-decl name='linux_binfmt' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1569'/>
<class-decl name='mem_cgroup' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1570'/>
<class-decl name='module_notes_attrs' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1571'/>
<class-decl name='module_param_attrs' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1572'/>
<class-decl name='module_sect_attrs' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1573'/>
<class-decl name='nameidata' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1574'/>
<class-decl name='perf_event' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1575'/>
<class-decl name='pipe_inode_info' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1576'/>
<class-decl name='poll_table_struct' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1577'/>
<class-decl name='pollfd' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1578'/>
<class-decl name='rcu_node' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1579'/>
<class-decl name='reclaim_state' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1580'/>
<class-decl name='request_queue' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1581'/>
<class-decl name='rt_mutex_waiter' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1582'/>
<class-decl name='rt_rq' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1583'/>
<class-decl name='sched_class' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1584'/>
<class-decl name='seccomp_filter' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1585'/>
<class-decl name='seq_file' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1586'/>
<class-decl name='sock' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1587'/>
<class-decl name='task_group' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1588'/>
<class-decl name='trace_eval_map' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1589'/>
<class-decl name='trace_event_call' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1590'/>
<class-decl name='uprobe' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1591'/>
<class-decl name='user_namespace' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1592'/>
<class-decl name='workqueue_struct' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1593'/>
<class-decl name='xol_area' is-struct='yes' visibility='default' is-declaration-only='yes' id='type-id-1594'/>
<var-decl name='__this_module' type-id='type-id-789' mangled-name='__this_module' visibility='default' filepath='/ws/android/kernel/aosp/common-mainline/out/android-mainline/common/drivers/mmc/host/sdhci.mod.c' line='11' column='1' elf-symbol-id='__this_module'/>
</abi-instr>
</abi-corpus>