public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH] reader: Remove useless support for WIP types
Date: Thu, 09 Jul 2020 15:17:28 +0200	[thread overview]
Message-ID: <87blkorfo7.fsf@redhat.com> (raw)

Hello,

In the abixml reader, WIP types are tracked to know if a type has been
fully constructed yet or not.  This information is later useful to
know if a given type should be canonicalized right away, or if its
canonicalization should be delayed until the entire abixml file has
been read.

Right now, with all the evolutions that happened in the abixml reader,
only scalar types are canonicalized right away.  All other types are
canonicalized late, meaning, after the entire abixml file is read.
This doesn't have any noticeable performance impact because the volume
of types coming from an abixml file is relatively small enough,
compared to what we can see in a DWARF/ELF binary due to type
duplication.

So the whole WIP tracking becomes is now pretty much useless, in
practise.  So this patch does away with it altogether.

	* src/abg-reader.cc (read_context::m_wip_types_map): Remove data
	member.
	(read_context::{clear_wip_classes_map, mark_type_as_wip,
	unmark_type_as_wip, is_wip_type}): Remove member functions.
	(read_context::maybe_canonicalize_type): Remove use of
	is_wip_type.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

Applied to master.

---
 src/abg-reader.cc | 67 -------------------------------------------------------
 1 file changed, 67 deletions(-)

diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index ce90aca..e72a5de 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -119,7 +119,6 @@ private:
   unordered_map<string, vector<type_base_sptr> >	m_types_map;
   unordered_map<string, shared_ptr<function_tdecl> >	m_fn_tmpl_map;
   unordered_map<string, shared_ptr<class_tdecl> >	m_class_tmpl_map;
-  unordered_map<string, size_t>			m_wip_types_map;
   vector<type_base_sptr>				m_types_to_canonicalize;
   string_xml_node_map					m_id_xml_node_map;
   xml_node_decl_base_sptr_map				m_xml_node_decl_map;
@@ -518,65 +517,6 @@ public:
   clear_types_to_canonicalize()
   {m_types_to_canonicalize.clear();}
 
-  /// Clean the map of classes that are "Work In Progress"; that is,
-  /// the map of the class that are currently being built, but at not
-  /// yet fully built.
-  void
-  clear_wip_classes_map()
-  {m_wip_types_map.clear();}
-
-  /// Mark a given type as being "Work In Progress"; that is, mark it
-  /// as being currently built.
-  ///
-  /// @param t the class to mark as being "Work In Progress".
-  void
-  mark_type_as_wip(const type_base_sptr t)
-  {
-    if (!t)
-      return;
-    string qname = get_type_name(t, /*qualified=*/true);
-    unordered_map<string, size_t>::iterator it = m_wip_types_map.find(qname);
-    if (it == m_wip_types_map.end())
-      m_wip_types_map[qname] = 1;
-    else
-      ++it->second;
-  }
-
-  /// Mark a given class as being *NOT* "Work In Progress" anymore;
-  /// that is, mark it as being fully built.
-  ///
-  /// @param t the type to mark as being built.
-  void
-  unmark_type_as_wip(const type_base_sptr t)
-  {
-    if (!t)
-      return;
-
-    string qname = get_type_name(t, /*qualified=*/true);
-    unordered_map<string, size_t>::iterator it = m_wip_types_map.find(qname);
-    if (it == m_wip_types_map.end())
-      return;
-    if (it->second)
-      --it->second;
-    if (it->second == 0)
-      m_wip_types_map.erase(it);
-  }
-
-  /// Test if a type is being currently built; that is, if it's "Work
-  /// In Progress".
-  ///
-  /// @param t the type to consider.
-  bool
-  is_wip_type(const type_base_sptr t) const
-  {
-    if (!t)
-      return false;
-
-    string qname = get_type_name(t, /*qualified=*/true);
-    unordered_map<string, size_t>::const_iterator i =
-      m_wip_types_map.find(qname);
-    return i != m_wip_types_map.end();
-  }
 
   /// Test if two types are equal, without comparing them structurally.
   ///
@@ -883,7 +823,6 @@ public:
 	&& !type_has_non_canonicalized_subtype(t)
 	&& !is_class_type(t)
 	&& !is_union_type(t)
-	&& !is_wip_type(t)
 	// Below are types that *must* be canonicalized only after
 	// they are added to their context; but then this function
 	// might be called to early, before they are actually added to
@@ -3818,7 +3757,6 @@ build_function_type(read_context&	ctxt,
 						parms, size, align));
 
   ctxt.get_translation_unit()->bind_function_type_life_time(fn_type);
-  ctxt.mark_type_as_wip(fn_type);
   ctxt.key_type_decl(fn_type, id);
 
   for (xmlNodePtr n = node->children; n ; n = n->next)
@@ -3845,7 +3783,6 @@ build_function_type(read_context&	ctxt,
     }
 
   fn_type->set_parameters(parms);
-  ctxt.unmark_type_as_wip(fn_type);
 
   return fn_type;
 }
@@ -4543,7 +4480,6 @@ build_class_decl(read_context&		ctxt,
   ctxt.push_decl_to_current_scope(decl, add_to_current_scope);
 
   ctxt.map_xml_node_to_decl(node, decl);
-  ctxt.mark_type_as_wip(decl);
   ctxt.key_type_decl(decl, id);
 
   // If this class has a naming typedef, get it and refer to it.
@@ -4767,7 +4703,6 @@ build_class_decl(read_context&		ctxt,
     }
 
   ctxt.pop_scope_or_abort(decl);
-  ctxt.unmark_type_as_wip(decl);
 
   return decl;
 }
@@ -4950,7 +4885,6 @@ build_union_decl(read_context& ctxt,
   ctxt.push_decl_to_current_scope(decl, add_to_current_scope);
 
   ctxt.map_xml_node_to_decl(node, decl);
-  ctxt.mark_type_as_wip(decl);
   ctxt.key_type_decl(decl, id);
 
   for (xmlNodePtr n = node->children; !is_decl_only && n; n = n->next)
@@ -5102,7 +5036,6 @@ build_union_decl(read_context& ctxt,
     }
 
   ctxt.pop_scope_or_abort(decl);
-  ctxt.unmark_type_as_wip(decl);
 
   return decl;
 }
-- 
1.8.3.1


-- 
		Dodji


                 reply	other threads:[~2020-07-09 13:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87blkorfo7.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).