mirror of
git://sourceware.org/git/libabigail.git
synced 2025-03-07 07:07:36 +00:00
Profiling showed that a number of use of dynamic_cast are a speed bottleneck. This patch implements a poor-man's RTTI that allows us to implement a form of dynamic_cast that is specific to the types of the internal reprenstation that are in the namespace abigail::ir. It speeds up things greatly. Basically, the base type of all ABI artifacts (abigail::ir::type_or_decl_base) now contains three new data members. The first one contains a bitmap that identifies the type of artifact. The second one contains a pointer to the dynamic type sub-object of the current instance of the artifact. The last one contains either a pointer to the type_base sub-object of the current instance of ABI artifact if it's a type, or a pointer to the type_decl sub-object of the current instance. Together these three data members allow the patch to implement the abigail::ir::{is_type(), is_decl(), is_<type_kind>_type} functions that we need to make the code base noticeably faster when using abidw on a big vmlinux binary. * include/abg-fwd.h (is_type_decl): Replace the overloads that takes a type_base* and/or a decl_base* by one that takes a type_or_decl_base*. * include/abg-ir.h (type_or_decl_base::type_or_decl_kind): Define new enum. (type_or_decl_base::{kind, runtime_type_instance, type_or_decl_base_pointer}): Declare new accessors. (operator{|,|=,&,&=): Declare new operators for the new type_or_decl_base::type_or_decl_kind enum. (global_scope::global_scope): Move the definition of this constructor to ... * src/abg-ir.cc (global_scope::global_scope): ... here. (type_or_decl_base::priv::{kind_, rtti_, type_or_decl_ptr_}): Add new data members. (type_or_decl_base::priv::priv): Take a type_or_decl_base::type_or_decl_kind enum. (type_or_decl_base::priv::kind): Define new accessors. (operator{|,|=,&,&=): Define new operators for the new type_or_decl_base::type_or_decl_kind enum. (type_or_decl_base::type_or_decl_base): Take a type_or_decl_base::type_or_decl_kind enum. (type_or_decl_base::{kind, runtime_type_instance, type_or_decl_base_pointer}): Define new accessors. (decl_base::decl_base, scope_decl::scope_decl) (type_base::type_base, scope_type_decl::scope_type_decl) (class_or_union::class_or_union) : Adjust to set the runtime type identifier of the instances of these types. (global_scope::global_scope, type_decl::type_decl) (qualified_type_def::qualified_type_def) (pointer_type_def::pointer_type_def) (reference_type_def::reference_type_def array_type_def::subrange_type::subrange_type) (array_type_def::array_type_def, enum_type_decl::enum_type_decl) (typedef_decl::typedef_decl, var_decl::var_decl) (function_type::function_type, method_type::method_type) (function_decl::function_decl) (function_decl::parameter::parameter, method_decl::method_decl) (class_decl::class_decl, class_decl::base_spec::base_spec) (union_decl::union_decl, template_decl::template_decl) (type_tparameter::type_tparameter) (non_type_tparameter::non_type_tparameter) (template_tparameter::template_tparameter) (type_composition::type_composition) (function_tdecl::function_tdecl, function_tdecl::function_tdecl) (class_tdecl::class_tdecl): Likewise and call runtime_type_instance() here to set the runtime type instance pointers of the current instance. (is_decl, is_type, is_class_type, is_pointer_type): Adjust to use the new poor-man's rtti machinery. (is_type_decl): Replace the overloads that takes a type_base* and/or a decl_base* by one that takes a type_or_decl_base*. (pointer_type_def::operator==, class_decl::operator==): Use the poor-man's rtti machinery to replace dynamic_cast. hash_type_or_decl: Replace dynamic_cast<const type_base> by is_type() and dynamic_cast<const decl_base*> by is_decl(). Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
abg-comp-filter.h | ||
abg-comparison.h | ||
abg-config.h | ||
abg-corpus.h | ||
abg-diff-utils.h | ||
abg-dwarf-reader.h | ||
abg-fwd.h | ||
abg-hash.h | ||
abg-ini.h | ||
abg-interned-str.h | ||
abg-ir.h | ||
abg-libxml-utils.h | ||
abg-libzip-utils.h | ||
abg-reader.h | ||
abg-reporter.h | ||
abg-sptr-utils.h | ||
abg-suppression.h | ||
abg-tools-utils.h | ||
abg-traverse.h | ||
abg-version.h.in | ||
abg-viz-common.h | ||
abg-viz-dot.h | ||
abg-viz-svg.h | ||
abg-workers.h | ||
abg-writer.h | ||
Makefile.am |