From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76793 invoked by alias); 20 Nov 2019 06:43:59 -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 76782 invoked by uid 89); 20 Nov 2019 06:43:59 -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=Vries, vries 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: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Use off_hash (die) instead of die->die_offset Message-ID: <20191120064351.GA19811@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: 2019-q4/txt/msg00060.txt.bz2 Hi, When using htab_find_slot_with_hash for off_htab (or any other htab using off_hash), a manually inlined version of off_htab is used: ... slot = htab_find_slot_with_hash (off_htab, die, die->die_offset, INSERT); ... Instead, make all occurrences use off_hash: ... slot = htab_find_slot_with_hash (off_htab, die, off_hash (die), INSERT); ... allowing modification of the implementation of off_hash in a single location. Committed to trunk. Thanks, - Tom Use off_hash (die) instead of die->die_offset 2019-11-19 Tom de Vries * dwz.c (off_htab_add_die, off_htab_lookup, add_dummy_die) (expand_child, remove_dies, collapse_child, read_debug_info): Use off_hash. --- dwz.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/dwz.c b/dwz.c index 500ac1a..44e745a 100644 --- a/dwz.c +++ b/dwz.c @@ -1244,7 +1244,7 @@ off_htab_add_die (dw_cu_ref cu, dw_die_ref die) alt_off_htab = off_htab; } - slot = htab_find_slot_with_hash (off_htab, die, die->die_offset, INSERT); + slot = htab_find_slot_with_hash (off_htab, die, off_hash (die), INSERT); if (slot == NULL) dwz_oom (); assert (*slot == NULL); @@ -1260,12 +1260,14 @@ off_htab_lookup (dw_cu_ref cu, unsigned int die_offset) struct dw_die die; die.die_offset = die_offset; if (cu == NULL) - return (dw_die_ref) htab_find_with_hash (off_htab, &die, die_offset); + return (dw_die_ref) htab_find_with_hash (off_htab, &die, off_hash (&die)); if (unlikely (cu->cu_kind == CU_ALT)) - return (dw_die_ref) htab_find_with_hash (alt_off_htab, &die, die_offset); + return (dw_die_ref) htab_find_with_hash (alt_off_htab, &die, + off_hash (&die)); if (unlikely (cu->cu_kind == CU_TYPES)) - return (dw_die_ref) htab_find_with_hash (types_off_htab, &die, die_offset); - return (dw_die_ref) htab_find_with_hash (off_htab, &die, die_offset); + return (dw_die_ref) htab_find_with_hash (types_off_htab, &die, + off_hash (&die)); + return (dw_die_ref) htab_find_with_hash (off_htab, &die, off_hash (&die)); } /* For a die attribute with form FORM starting at PTR, with the die in CU, @@ -1733,7 +1735,8 @@ add_dummy_die (dw_cu_ref cu, unsigned int offset) } slot - = htab_find_slot_with_hash (off_htab, &ref_buf, ref_buf.die_offset, INSERT); + = htab_find_slot_with_hash (off_htab, &ref_buf, off_hash (&ref_buf), + INSERT); if (slot == NULL) dwz_oom (); if (*slot != NULL) @@ -3176,7 +3179,7 @@ expand_child (dw_die_ref top_die, bool checksum) diebuf.die_offset = die_offset; slot = htab_find_slot_with_hash (cu->cu_kind == CU_TYPES ? types_off_htab : off_htab, - &diebuf, die_offset, NO_INSERT); + &diebuf, off_hash (&diebuf), NO_INSERT); if (slot == NULL) die = NULL; else @@ -4633,7 +4636,7 @@ remove_dies (dw_cu_ref cu, dw_die_ref die, bool remove) if (die->die_referenced == 0) { htab_t h = cu->cu_kind == CU_TYPES ? types_off_htab : off_htab; - void **slot = htab_find_slot_with_hash (h, die, die->die_offset, + void **slot = htab_find_slot_with_hash (h, die, off_hash (die), NO_INSERT); if (slot != NULL) htab_clear_slot (h, slot); @@ -4769,7 +4772,7 @@ collapse_child (dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die, ref->die_tag = tick_diff; slot = htab_find_slot_with_hash (cu->cu_kind == CU_TYPES ? types_off_htab : off_htab, - ref, ref->die_offset, NO_INSERT); + ref, off_hash (ref), NO_INSERT); assert (slot != NULL); *slot = (void *) ref; memset (die, '\0', offsetof (struct dw_die, die_dup)); @@ -5292,7 +5295,7 @@ read_debug_info (DSO *dso, int kind) if (off_htab != NULL && kind == DEBUG_INFO) { void **slot - = htab_find_slot_with_hash (off_htab, die, die->die_offset, + = htab_find_slot_with_hash (off_htab, die, off_hash (die), INSERT); if (slot == NULL) dwz_oom ();