From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 02132385800F for ; Fri, 26 Mar 2021 15:58:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 02132385800F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 109B5AC6A; Fri, 26 Mar 2021 15:58:55 +0000 (UTC) Date: Fri, 26 Mar 2021 16:58:48 +0100 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org Subject: [committed] Add low_mem_p to struct file_result Message-ID: <20210326155847.GA20930@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2021 15:58:58 -0000 Hi, Keep track of whether files were run in low-mem mode, by adding a new field low_mem_p to struct file_result. Committed to trunk. Thanks, - Tom Add low_mem_p to struct file_result 2021-03-26 Tom de Vries * dwz.c (struct file_result): Add low_mem_p. (dwz_with_low_mem): Drop low_mem_p parameter. (init_file_result): Init low_mem_p. (dwz_one_file): Update call to dwz_with_low_mem. (encode_child_exit_status, decode_child_exit_status): Drop low_mem_p parameter. (dwz_files_1): Update call to dwz_with_low_mem. --- dwz.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/dwz.c b/dwz.c index 5a1dd0f..1be4f2a 100644 --- a/dwz.c +++ b/dwz.c @@ -15055,6 +15055,7 @@ struct file_result size_t hardlink_to; unsigned int die_count; bool skip_multifile; + bool low_mem_p; }; /* Collect potentially shareable DIEs, strings and .debug_macro @@ -16249,12 +16250,11 @@ make_temp_file (const char *name) is hit. */ static int dwz_with_low_mem (const char *file, const char *outfile, - struct file_result *res, bool *low_mem_p) + struct file_result *res) { int ret; - if (low_mem_p) - *low_mem_p = false; + res->low_mem_p = false; ret = (low_mem_die_limit == 0 ? 2 @@ -16263,8 +16263,7 @@ dwz_with_low_mem (const char *file, const char *outfile, if (ret == 2) { multifile_mode = MULTIFILE_MODE_LOW_MEM; - if (low_mem_p) - *low_mem_p = true; + res->low_mem_p = true; ret = dwz (file, outfile, res); } @@ -16279,6 +16278,7 @@ init_file_result (struct file_result *res) res->die_count = 0; res->res = -3; res->skip_multifile = false; + res->low_mem_p = false; } /* Dwarf-compress FILE. If OUTFILE, write to result to OUTFILE, otherwise @@ -16293,7 +16293,7 @@ dwz_one_file (const char *file, const char *outfile) init_file_result (&res); - return dwz_with_low_mem (file, outfile, &res, NULL); + return dwz_with_low_mem (file, outfile, &res); } /* Detect which FILES are hardlinks, and mark those in RESA. */ @@ -16408,9 +16408,9 @@ update_hardlinks (int nr_files, char *files[], struct file_result *resa) /* Encode child process exit status. */ static int -encode_child_exit_status (int thisret, bool low_mem_p, struct file_result *res) +encode_child_exit_status (int thisret, struct file_result *res) { - if (thisret == 0 && low_mem_p) + if (thisret == 0 && res->low_mem_p) thisret = 2; assert (thisret >= 0 && thisret <= 2); assert (res->res >= -3); @@ -16420,17 +16420,17 @@ encode_child_exit_status (int thisret, bool low_mem_p, struct file_result *res) /* Decode child process exit status. */ static int -decode_child_exit_status (int state, bool *low_mem_p, struct file_result *res) +decode_child_exit_status (int state, struct file_result *res) { int ret; if (!WIFEXITED (state)) error (1, 0, "Child dwz process got killed"); ret = WEXITSTATUS (state) & 0x3; - *low_mem_p = false; + res->low_mem_p = false; if (ret == 2) { ret = 0; - *low_mem_p = true; + res->low_mem_p = true; } res->res = (int)((WEXITSTATUS (state) & ~0x3) >> 2) - 3; @@ -16489,9 +16489,8 @@ dwz_files_1 (int nr_files, char *files[], bool hardlink, { int state; pid_t got_pid = waitpid (-1, &state, 0); - bool low_mem_p; int thisret - = decode_child_exit_status (state, &low_mem_p, res); + = decode_child_exit_status (state, res); if (thisret == 1) ret = 1; nr_forks--; @@ -16509,9 +16508,8 @@ dwz_files_1 (int nr_files, char *files[], bool hardlink, assert (fork_res != -1); if (fork_res == 0) { - bool low_mem_p; - thisret = dwz_with_low_mem (file, NULL, res, &low_mem_p); - return encode_child_exit_status (thisret, low_mem_p, res); + thisret = dwz_with_low_mem (file, NULL, res); + return encode_child_exit_status (thisret, res); } else { @@ -16532,8 +16530,7 @@ dwz_files_1 (int nr_files, char *files[], bool hardlink, int state; pid_t got_pid = waitpid (pids[i], &state, 0); assert (got_pid == pids[i]); - bool low_mem_p; - thisret = decode_child_exit_status (state, &low_mem_p, res); + thisret = decode_child_exit_status (state, res); if (thisret == 1) ret = 1; } @@ -16550,11 +16547,10 @@ dwz_files_1 (int nr_files, char *files[], bool hardlink, continue; if (stats_p) init_stats (file); - bool low_mem_p; - thisret = dwz_with_low_mem (file, NULL, res, &low_mem_p); + thisret = dwz_with_low_mem (file, NULL, res); if (thisret == 1) ret = 1; - else if (!low_mem_p && !res->skip_multifile && resa[i].res >= 0) + else if (!res->low_mem_p && !res->skip_multifile && res->res >= 0) successcount++; } }