public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Giuliano Procida <gprocida@google.com>
To: libabigail@sourceware.org
Cc: dodji@seketeli.org, kernel-team@android.com, gprocida@google.com,
	 maennich@google.com
Subject: [PATCH 3/3] abg-reader: create a fresh corpus object per corpus
Date: Tue, 27 Apr 2021 12:28:53 +0100	[thread overview]
Message-ID: <20210427112853.1338240-4-gprocida@google.com> (raw)
In-Reply-To: <20210427112853.1338240-1-gprocida@google.com>

Currently the XML reader reuses the same corpus object for all
corpora in a corpus group. This has an unwanted side-effect: any
abi-instr with the same path in different corpora will collide and
parts of the ABI will be lost.

Creating a new corpus object for every abi-corpus element seems like
the right thing to do. Testing with large ABIs containing many corpora
also shows a modest (~10%) abidiff speed improvement.

	* src/abg-reader.cc (read_corpus_from_input): Always create a
	fresh corpus object for each abi-corpus XML element.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-reader.cc | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/abg-reader.cc b/src/abg-reader.cc
index 313af4c9..e32c9bf3 100644
--- a/src/abg-reader.cc
+++ b/src/abg-reader.cc
@@ -1776,11 +1776,7 @@ read_corpus_from_input(read_context& ctxt)
 				       BAD_CAST("abi-corpus")))
 	return nil;
 
-      if (!ctxt.get_corpus())
-	{
-	  corpus_sptr c(new corpus(ctxt.get_environment(), ""));
-	  ctxt.set_corpus(c);
-	}
+      ctxt.set_corpus(std::make_shared<corpus>(ctxt.get_environment(), ""));
 
       if (!ctxt.get_corpus_group())
 	ctxt.clear_per_corpus_data();
@@ -1834,11 +1830,7 @@ read_corpus_from_input(read_context& ctxt)
     }
   else
     {
-      if (!ctxt.get_corpus())
-	{
-	  corpus_sptr c(new corpus(ctxt.get_environment(), ""));
-	  ctxt.set_corpus(c);
-	}
+      ctxt.set_corpus(std::make_shared<corpus>(ctxt.get_environment(), ""));
 
       if (!ctxt.get_corpus_group())
 	ctxt.clear_per_corpus_data();
-- 
2.31.1.498.g6c1eba8ee3d-goog


  parent reply	other threads:[~2021-04-27 11:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27 11:28 [PATCH 0/3] always create fresh corpus objects Giuliano Procida
2021-04-27 11:28 ` [PATCH 1/3] abg-dwarf-reader: create new corpus unconditionally Giuliano Procida
2021-04-27 11:28 ` [PATCH 2/3] abg-reader: ensure corpus always has a symtab reader Giuliano Procida
2021-04-27 11:28 ` Giuliano Procida [this message]
2021-06-10 16:54   ` [PATCH 3/3] abg-reader: create a fresh corpus object per corpus Dodji Seketeli
2021-05-27  8:53 ` [PATCH v2 0/3] always create fresh corpus objects Giuliano Procida
2021-05-27  8:53   ` [PATCH v2 1/3] abg-dwarf-reader: create new corpus unconditionally Giuliano Procida
2021-06-01  7:38     ` Giuliano Procida
2021-06-10 15:58     ` [PATCH v2 1/3, applied] " Dodji Seketeli
2021-06-10 16:52     ` [PATCH v2 1/3] " Dodji Seketeli
2021-05-27  8:53   ` [PATCH v2 2/3] abg-reader: ensure corpus always has a symtab reader Giuliano Procida
2021-06-10 16:53     ` Dodji Seketeli
2021-05-27  8:53   ` [PATCH v2 3/3] abg-reader: create a fresh corpus object per corpus Giuliano Procida

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=20210427112853.1338240-4-gprocida@google.com \
    --to=gprocida@google.com \
    --cc=dodji@seketeli.org \
    --cc=kernel-team@android.com \
    --cc=libabigail@sourceware.org \
    --cc=maennich@google.com \
    /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).