From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74702 invoked by alias); 14 Feb 2020 14:27:45 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 74687 invoked by uid 89); 14 Feb 2020 14:27:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-25.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx2.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Wed, 01 Jan 2020 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Add --devel-deduplication-mode={none,intra-cu,inter-cu} Message-ID: <20200214142738.GA23594@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2020-q1/txt/msg00071.txt Hi, Add a developer-only option --devel-deduplication-mode with values: - none: No deduplication, - intra-cu: Deduplication of DIEs in the same CU, and - inter-cu: Deduplication of DIEs, also if they're in different CUs. Committed to trunk. Thanks, - Tom Add --devel-deduplication-mode={none,intra-cu,inter-cu} 2020-02-14 Tom de Vries * dwz.c (enum deduplication_mode): New enum. (deduplication_mode): New var. Initialize to dm_inter_cu. (partition_dups_1): Use deduplication_mode. (deduplication_mode_parsed): New var. (dwz_options, usage): Add --devel-deduplication-mode entry. (main): Handle deduplication_mode_parsed. --- dwz.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/dwz.c b/dwz.c index b469264..1c5170c 100644 --- a/dwz.c +++ b/dwz.c @@ -212,6 +212,13 @@ static int partition_dups_opt; static int progress_p; static int import_opt_p = 1; static int force_p = 0; +enum deduplication_mode +{ + dm_none, + dm_intra_cu, + dm_inter_cu +}; +static enum deduplication_mode deduplication_mode = dm_inter_cu; enum die_count_methods { none, @@ -6945,7 +6952,8 @@ partition_dups_1 (dw_die_ref *arr, size_t vec_size, /* Size of namespace DIEs. */ + namespace_size * namespaces); if (!second_phase) - force = ignore_size || orig_size > new_size; + force = ((deduplication_mode == dm_inter_cu) + && (ignore_size || orig_size > new_size)); if (force) { dw_die_ref die, *diep; @@ -7067,7 +7075,8 @@ partition_dups_1 (dw_die_ref *arr, size_t vec_size, (arguably a bug in the DWARF producer), keep them linked together, but don't link DIEs across different CUs. */ - while (next && refcu == die_cu (next)) + while (deduplication_mode != dm_none + && next && refcu == die_cu (next)) { dw_die_ref cur = next; next = cur->die_nextdup; @@ -14504,6 +14513,7 @@ make_temp_file (const char *name) } int die_count_method_parsed; +int deduplication_mode_parsed; /* Options for getopt_long. */ static struct option dwz_options[] = @@ -14542,6 +14552,8 @@ static struct option dwz_options[] = { "devel-die-count-method", required_argument, &die_count_method_parsed, 1 }, { "devel-stats", no_argument, &stats_p, 1 }, + { "devel-deduplication-mode", + required_argument, &deduplication_mode_parsed, 1 }, #endif { "odr", no_argument, &odr, 1 }, { "no-odr", no_argument, &odr, 0 }, @@ -14790,7 +14802,8 @@ usage (void) " --devel-verify-edges\n" " --devel-dump-edges\n" " --devel-partition-dups-opt\n" - " --devel-die-count-method\n"); + " --devel-die-count-method\n" + " --devel-deduplication-mode={none,intra-cu,inter-cu}\n"); fprintf (stderr, "%s", msg); #endif @@ -14858,6 +14871,27 @@ main (int argc, char *argv[]) error (1, 0, "invalid argument --devel-die-count-method %s", optarg); } + if (deduplication_mode_parsed) + { + deduplication_mode_parsed = 0; + if (strcmp (optarg, "none") == 0) + { + deduplication_mode = dm_none; + break; + } + if (strcmp (optarg, "intra-cu") == 0) + { + deduplication_mode = dm_intra_cu; + break; + } + if (strcmp (optarg, "inter-cu") == 0) + { + deduplication_mode = dm_inter_cu; + break; + } + error (1, 0, "invalid argument --devel-deduplication-mode %s", + optarg); + } if (odr_mode_parsed) { odr_mode_parsed = 0;