From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Restructure new_size calculation
Date: Wed, 01 Jan 2020 00:00:00 -0000 [thread overview]
Message-ID: <20200213141135.GA14380@delia> (raw)
Hi,
Restructure the calculation of new_size in partition_dups_1, by introducing
variables for various quantities.
Committed to trunk.
Thanks,
- Tom
Restructure new_size calculation
2020-02-11 Tom de Vries <tdevries@suse.de>
* dwz.c (partition_dups_1): Restructure the calculation of new_size.
---
dwz.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/dwz.c b/dwz.c
index 05dfe05..35d3072 100644
--- a/dwz.c
+++ b/dwz.c
@@ -6893,16 +6893,25 @@ partition_dups_1 (dw_die_ref *arr, size_t vec_size,
orig_size = size * cnt;
/* Estimated size of CU header and DW_TAG_partial_unit
with DW_AT_stmt_list and DW_AT_comp_dir attributes
- 21 (also child end byte), plus in each CU referencing it
- DW_TAG_imported_unit with DW_AT_import attribute
- (5 or 9 bytes (the latter for DWARF2 and ptr_size 8)).
- For DW_TAG_namespace or DW_TAG_module needed as
+ 21 (also child end byte). */
+ size_t pu_size = 21;
+ /* DW_TAG_imported_unit with DW_AT_import attribute
+ (5 or 9 bytes (the latter for DWARF2 and ptr_size 8)). */
+ size_t import_size
+ = (die_cu (arr[i])->cu_version == 2 ? 1 + ptr_size : 5);
+ /* For DW_TAG_namespace or DW_TAG_module needed as
parents of the DIEs conservatively assume 10 bytes
for the abbrev index, DW_AT_name attribute and
DW_AT_sibling attribute and child end. */
- new_size = size + 21
- + (die_cu (arr[i])->cu_version == 2
- ? 1 + ptr_size : 5) * cnt + 10 * namespaces;
+ size_t namespace_size = 10;
+ new_size = (/* Size of DIEs. */
+ size
+ /* Size of PU. */
+ + pu_size
+ /* Size of imports. */
+ + import_size * cnt
+ /* Size of namespace DIEs. */
+ + namespace_size * namespaces);
if (!second_phase)
force = ignore_size || orig_size > new_size;
if (force)
reply other threads:[~2020-02-13 14:11 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=20200213141135.GA14380@delia \
--to=tdevries@suse.de \
--cc=dwz@sourceware.org \
--cc=jakub@redhat.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).