Avoid unnecessary updates to type lookup maps
authorDodji Seketeli <dodji@redhat.com>
Wed, 4 Jan 2017 23:50:34 +0000 (00:50 +0100)
committerDodji Seketeli <dodji@redhat.com>
Thu, 5 Jan 2017 11:47:20 +0000 (12:47 +0100)
In class_or_union::set_is_declaration_only we should update the type
lookup maps only when a class type that was previously a
declaration-only type is now a defined type.  Otherwise, updating the type
lookup maps is unnecessary and profiling shows that it takes a
significant amount of time.

This patch does away with the unnecessary attempts to update type
lookup maps.

* src/abg-ir.cc (class_or_union::get_is_declaration_only): Try
          to update the type maps only when a declaration-only class
          type is now defined.

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

index 507cfd9a7ccca8f5e77eb753696eda18fedda252..44a6e0f8064917f1db3122d8034e934e1cf876c9 100644 (file)
@@ -14669,15 +14669,18 @@ class_or_union::get_is_declaration_only() const
 void
 class_or_union::set_is_declaration_only(bool f)
 {
+  bool update_types_lookup_map = !f && priv_->is_declaration_only_;
+
   priv_->is_declaration_only_ = f;
-  if (!f)
+
+  if (update_types_lookup_map)
     if (scope_decl* s = get_scope())
       {
        declarations::iterator i;
        if (s->find_iterator_for_member(this, i))
          maybe_update_types_lookup_map(*i);
        else
-         abort();
+         ABG_ASSERT_NOT_REACHED;
       }
 }