[PERF] Access naked pointers for canonical types and function types
authorDodji Seketeli <dodji@redhat.com>
Fri, 11 Dec 2015 09:45:05 +0000 (10:45 +0100)
committerDodji Seketeli <dodji@redhat.com>
Fri, 11 Dec 2015 10:19:57 +0000 (11:19 +0100)
commitb0171438765365d3f3d253a5068001be2224acd6
treeac92f9fb3b86135d628b7c67e2ce8817c69b62e8
parentc0de97846c0ac882f910825a7f904cf76478b9dc
[PERF] Access naked pointers for canonical types and function types

Performance profiling has shown that accessing shared_ptr to canonical
types and function type during type comparison was noticeable slowing
down the process.  This patch thus access naked pointers for canonical
types and function types at these performance hot spots.

The profiling took place while running abidw --abidiff on the
r300_dri.so binary.

* include/abg-ir.h (type_base::get_naked_canonical_type): Declare
new accessor.
(function_decl::get_naked_canonical_type): Likewise.
(function_decl::set_type): Pass a reference to the shared_ptr.
* src/abg-ir.cc (type_base::priv::naked_canonical_type): New data
member.
(type_base::priv::priv): Initialize it.
(canonicalize): Set the naked canonicalize type when we set its
shared pointer.
(type_base::get_naked_canonical_type): Define new accessor.
({pointer_type_def,reference_type_def,function_type,class_decl}::operator==):
Use naked canonical pointers rather than the slower shared_ptr to
canonical pointers.
(function_decl::priv::naked_type_): New data member.
(function_decl::priv::priv): Initialize it.
(function_decl::get_naked_type): Define new accessor.
(function_decl::set_type): Pass a reference to the shared_ptr .
(equals): In the overload for function_decl, use the faster naked
pointers to the type of the function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-ir.h
src/abg-ir.cc