From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 8F945385840C for ; Fri, 28 Jan 2022 22:40:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F945385840C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: F50l0yq2EpCqy+t03NPA54HV2Wgkb2W+/yjQ2e1jQaaWW3rQ84M96g9qU6OARw2VDotk2QrFnp 1P7R2Uq4Ozp89chj3C1IANsOJI+XZfcG2dsfXKacRtuf3203USQ431zz4uqGmSfVFQlvspYLHd 5F/EuZQ9fZLxswD2cD/91DudcL58Z46FLz5Yb6wJCjZF6Tq5QcSpSEMTFGFsSd9Qhn6RL5Fnry R3hzufjj9ZPCnaEzuCI2CfpFiSQX001Ff4WwohhL2O5gam3jMbJzyngmetCSogUfF7zGcbcXuj zO54uTnYJNAYKngnRRfDYT3E X-IronPort-AV: E=Sophos;i="5.88,325,1635235200"; d="scan'208";a="71310816" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 28 Jan 2022 14:39:59 -0800 IronPort-SDR: HY5wnbAhSEqbd/y3qHR6rcUNZt0+yvCcr6+H/oUzjm037xw/kEpXSo//ZD7Lh5lT+6l2RoK5jc ahERTyufKHjWhI+fQaw06LqGERTsuLcDCTFLdTsxN7Jrrjb5peiF6O3gaNwJd4LkxDQVcBnIiM Rv+SV65InmLkoPL7qXlzZJxgQCwxf0S1H6OJrcdGqgdiWP2gIuoEiUiyocDvIZ2hGitDMShBlX le2nw0+uwh4rRfsgZ3G6DC7ZYLbtpnFuxQmwDzBIR0+iIZCUpEvxvc9ugzAbFMIWufUzQ4IIFN FUo= From: Thomas Schwinge To: CC: Dodji Seketeli , Mark Wielaard Subject: 'src/abg-dwarf-reader.cc:compare_dies_string_attribute_value' optimization User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/27.1 (i686-pc-linux-gnu) Date: Fri, 28 Jan 2022 23:39:49 +0100 Message-ID: <87wnijv616.fsf@dirichlet.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2022 22:40:04 -0000 Hi! It's late on a Friday evening, and very well this may just be me not understanding libabigail/DWARF ;-) -- in context of or , I did a simple experiment to disable the 'src/abg-dwarf-reader.cc:compare_dies_string_attribute_value' optimization: --- src/abg-dwarf-reader.cc +++ src/abg-dwarf-reader.cc [...] /// This function is a fast routine (optimization) to compare the /// values of two string attributes of two DIEs. /// /// @param l the first DIE to consider. /// /// @param r the second DIE to consider. /// /// @param attr_name the name of the attribute to compare, on the two /// DIEs above. /// /// @param result out parameter. This is set to the result of the /// comparison. If the value of attribute @p attr_name on DIE @p l /// equals the value of attribute @p attr_name on DIE @p r, then the /// the argument of this parameter is set to true. Otherwise, it's /// set to false. Note that the argument of this parameter is set iff /// the function returned true. /// /// @return true iff the comparison could be performed. There are /// cases in which the comparison cannot be performed. For instance, /// if one of the DIEs does not have the attribute @p attr_name. In /// any case, if this function returns true, then the parameter @p /// result is set to the result of the comparison. static bool compare_dies_string_attribute_value(const Dwarf_Die *l, const Dwarf_Di= e *r, unsigned attr_name, bool &result) { Dwarf_Attribute l_attr, r_attr; if (!dwarf_attr_integrate(const_cast(l), attr_name, &l_a= ttr) || !dwarf_attr_integrate(const_cast(r), attr_name, &= r_attr)) return false; ABG_ASSERT(l_attr.form =3D=3D DW_FORM_strp || l_attr.form =3D=3D DW_FORM_string || l_attr.form =3D=3D DW_FORM_GNU_strp_alt || form_is_DW_FORM_strx(l_attr.form) || form_is_DW_FORM_line_strp(l_attr.form)); ABG_ASSERT(r_attr.form =3D=3D DW_FORM_strp || r_attr.form =3D=3D DW_FORM_string || r_attr.form =3D=3D DW_FORM_GNU_strp_alt || form_is_DW_FORM_strx(r_attr.form) || form_is_DW_FORM_line_strp(r_attr.form)); +#if 0 if ((l_attr.form =3D=3D DW_FORM_strp && r_attr.form =3D=3D DW_FORM_strp) || (l_attr.form =3D=3D DW_FORM_GNU_strp_alt && r_attr.form =3D=3D DW_FORM_GNU_strp_alt) || (form_is_DW_FORM_strx(l_attr.form) && form_is_DW_FORM_strx(r_attr.form)) || (form_is_DW_FORM_line_strp(l_attr.form) && form_is_DW_FORM_line_strp(r_attr.form))) { // So these string attributes are actually pointers into a // string table. The string table is most likely de-duplicated // so comparing the *values* of the pointers should be enough. // // This is the fast path. if (l_attr.valp =3D=3D r_attr.valp) result =3D true; else if (l_attr.valp && r_attr.valp) result =3D *l_attr.valp =3D=3D *r_attr.valp; else result =3D false; return true; } +#endif // If we reached this point it means we couldn't use the fast path // because the string atttributes are strings that are "inline" in // the debug info section. Let's just compare them the slow and // obvious way. string l_str =3D die_string_attribute(l, attr_name), r_str =3D die_string_attribute(r, attr_name); result =3D l_str =3D=3D r_str; return true; } My assumption was that this shouldn't change anything other than possibly regress performance. However: [-PASS:-]{+FAIL:+} runtestreaddwarf --- build-libabigail/tests/runtestreaddwarf.log +++ build-libabigail/tests/runtestreaddwarf.log [...] -PASS runtestreaddwarf (exit status: 0) +--- [...]/source-libabigail/tests/data/test-read-dwarf/PR25007-sdhci.k= o.abi 2022-01-28 22:48:07.049805043 +0100 ++++ [...]/build-libabigail/tests/output/test-read-dwarf/PR25007-sdhci.= ko.abi 2022-01-28 23:15:30.261483063 +0100 +@@ -10107,10 +10107,19 @@ + + + ++ ++ ++ ++ ++ + + + + ++ ++ ++ ++ + + + +@@ -10138,6 +10147,10 @@ + + + ++ ++ ++ ++ + + + +@@ -10181,6 +10194,16 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10370,6 +10393,13 @@ + + + ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10519,6 +10549,31 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10531,6 +10586,17 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10591,6 +10657,10 @@ + + + ++ ++ ++ ++ + + + +@@ -10631,6 +10701,22 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10746,6 +10832,10 @@ + + + ++ ++ ++ ++ + + + +@@ -10770,6 +10860,14 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10815,6 +10913,9 @@ + + + ++ ++ ++ + + + +@@ -10859,6 +10960,15 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10885,11 +10995,44 @@ + + + ++ ++ ++ ++ ++ ++ ++ + + + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10923,6 +11066,18 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10936,6 +11091,14 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -10949,6 +11112,10 @@ + + + ++ ++ ++ ++ + + + +@@ -11075,12 +11242,26 @@ + + + ++ ++ ++ ++ + + + + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -11124,6 +11305,15 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +@@ -11192,10 +11382,19 @@ + + + ++ ++ ++ ++ ++ + + + + ++ ++ ++ ++ + + + +@@ -11210,6 +11409,10 @@ + + + ++ ++ ++ ++ + + + +@@ -11224,6 +11427,9 @@ + + + ++ ++ ++ + + + +@@ -11241,223 +11447,6 @@ + + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- + + + +@@ -11477,48 +11466,19 @@ + + + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- + + + +ABIs differ: +[...]/source-libabigail/tests/data/test-read-dwarf/PR25007-sdhci.ko.ab= i +and: +[...]/build-libabigail/tests/output/test-read-dwarf/PR25007-sdhci.ko.a= bi + +FAIL runtestreaddwarf (exit status: 1) Only that one test case. The reordered 'function-type's -- but I've not yet verified whether they're really just reordered -- may hint towards a sorting stability issue, but there are also the disappearing 'class-decl's. Unless somebody points out any misunderstanding on my side, I suppose I shall try to figure out what's going wrong. Gr=C3=BC=C3=9Fe Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955