[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>