From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70213 invoked by alias); 17 Feb 2020 16:33:28 -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 70143 invoked by uid 48); 17 Feb 2020 16:33:24 -0000 From: "vries at gcc dot gnu.org" To: dwz@sourceware.org Subject: [Bug default/25567] New: [dwz] Factor out common parts in different namespaces Date: Wed, 01 Jan 2020 00:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: dwz X-Bugzilla-Component: default X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: nobody at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2020-q1/txt/msg00077.txt https://sourceware.org/bugzilla/show_bug.cgi?id=3D25567 Bug ID: 25567 Summary: [dwz] Factor out common parts in different namespaces Product: dwz Version: unspecified Status: NEW Severity: enhancement Priority: P2 Component: default Assignee: nobody at sourceware dot org Reporter: vries at gcc dot gnu.org CC: dwz at sourceware dot org Target Milestone: --- Consider test.c: ... namespace ns_a { class c { int i; }; }; namespace ns_b { class c { int i; }; }; ns_a::c c1; ns_b::c c2; int main (void) { return 0; } ... Compiled like this: ... $ g++ test.c -g ... we end up with ns_a: ... <1>: Abbrev Number: 2 (DW_TAG_namespace) DW_AT_name : (indirect string, offset: 0x205): ns_a DW_AT_decl_file : 1 DW_AT_decl_line : 1 DW_AT_sibling : <0x111> <2>: Abbrev Number: 3 (DW_TAG_class_type) <100> DW_AT_name : c <102> DW_AT_byte_size : 4 <103> DW_AT_decl_file : 1 <104> DW_AT_decl_line : 2 <3><105>: Abbrev Number: 4 (DW_TAG_member) <106> DW_AT_name : i <108> DW_AT_decl_file : 1 <109> DW_AT_decl_line : 3 <10a> DW_AT_type : <0x111> <10e> DW_AT_data_member_location: 0 ... and ns_b: ... <1><118>: Abbrev Number: 2 (DW_TAG_namespace) <119> DW_AT_name : (indirect string, offset: 0x20a): ns_b <11d> DW_AT_decl_file : 1 <11e> DW_AT_decl_line : 7 <11f> DW_AT_sibling : <0x135> <2><123>: Abbrev Number: 3 (DW_TAG_class_type) <124> DW_AT_name : c <126> DW_AT_byte_size : 4 <127> DW_AT_decl_file : 1 <128> DW_AT_decl_line : 8 <3><129>: Abbrev Number: 4 (DW_TAG_member) <12a> DW_AT_name : i <12c> DW_AT_decl_file : 1 <12d> DW_AT_decl_line : 9 <12e> DW_AT_type : <0x111> <132> DW_AT_data_member_location: 0 ... The class c DIEs of the two namespaces are identical (ignoring location inf= o), but even if we try to force compression: ... $ dwz a.out -o 1 --devel-ignore-size --devel-ignore-loc ... the DIEs in the namespaces stay the same. How so? Dwz currently handles namespaces conservatively: two DIEs in different namespaces will always be considered unequal. And if two DIEs are found to be equal, as well as in identical namespaces, = then the DIE is instantiated in the partial unit embedded in the namespace and imported at top-level. [ As opposed to moving the non-toplevel DIE to the partial unit at top-level, and importing the partial unit into the namespac= es at the non-toplevel use sites. Obviously doing things like this means the partial unit is a non-toplevel one, and we can't move top-level DIEs there,= so this potentially makes things less efficient. ] According to appendix E.1, it's possible to factor out the class c DIEs int= o a partial unit, and import that partial unit into each namespace. --=20 You are receiving this mail because: You are on the CC list for the bug.