Message ID | 20200708095315.948634-1-gprocida@google.com |
---|---|
Headers |
Return-Path: <libabigail-bounces@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5946F386180A; Wed, 8 Jul 2020 09:53:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5946F386180A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594202007; bh=fteoleL+bsc+y9O10q6YfIkGV77ZocH8hSOtU8mWYjE=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:Cc:From; b=i2JzzpU4Ui3vl6qxuY24wrshlLDaxiwyPOkxsmsHvbLQixzc7sfM34tP1cfbEgFHk TMa9RxH18i1sObc/C+DOzQwG/xbxoMl+zHI7aI+jedgrLt4rTbYhNDf/jvIixC6oSt XNRTI1UdZ4KgUCrmviqmzzzouen2X7/2EwdC1bqM= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mail-wr1-x449.google.com (mail-wr1-x449.google.com [IPv6:2a00:1450:4864:20::449]) by sourceware.org (Postfix) with ESMTPS id 0A530386180A for <libabigail@sourceware.org>; Wed, 8 Jul 2020 09:53:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0A530386180A Received: by mail-wr1-x449.google.com with SMTP id j3so31819478wrq.9 for <libabigail@sourceware.org>; Wed, 08 Jul 2020 02:53:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=fteoleL+bsc+y9O10q6YfIkGV77ZocH8hSOtU8mWYjE=; b=euuBrt2eTVMsMFTrIvPmmAaT2XnSKTaDer0TYcm/7WwN0jZq/yRVkXvETrtdh7K0d/ MMZ3oqRYhI8WOGn+kd+v/S/wCKIJAZuQ609D/3IKv+t7hp6IzgJCX+v/A8GAo+5RghQV GAhRsYXsabW0XzIT2jbMbJ130fuykDUmBHecRb5N4/guw3BXyTd9nxMxBJiIpSEIVBeK XF28FmpefSN4qxqwJSFiyUTGrwnOJh8oHDn1srFDCAPAlDQlSnrVj7zsfOQPOiaK+Vyn gx2ufcslpI8QUBBLllzZaQGQHRDSkWlt4KStqbbfDmYy0n5A00C4DUrI/M/4avOGiK7f DEkw== X-Gm-Message-State: AOAM5335Hou45kUEvuY8bU6w/2veW2fBE2hu9Q1LR3pamxKsZvKDkx2v F3vzYN9v9TQ0RkUdodzoAqvYVtVCADFNcgV/vZxEndOcReDduabHTlzVfu0SQJCWAY0zh8mpJHw ZoVj7S+Ti1NGPb4/6//xIF2cHI0YrR4ID2sB9N2u5F5DuFBYw1XDZ+UYukMdUDLE5dOBhDZc= X-Google-Smtp-Source: ABdhPJzU2QnlS2zPj91qY1KYI3aOa3jEG5qwVjNLGgsIKBk8c+L+8hn0g6GxlZDhODc3BM8vYBDZFaqw46FIXA== X-Received: by 2002:a7b:c313:: with SMTP id k19mr8561043wmj.67.1594202003751; Wed, 08 Jul 2020 02:53:23 -0700 (PDT) Date: Wed, 8 Jul 2020 10:53:12 +0100 Message-Id: <20200708095315.948634-1-gprocida@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog Subject: [PATCH 0/3] Type equality refactor and instrumentation To: libabigail@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-18.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL 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: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project <libabigail.sourceware.org> List-Unsubscribe: <http://sourceware.org/mailman/options/libabigail>, <mailto:libabigail-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libabigail/> List-Help: <mailto:libabigail-request@sourceware.org?subject=help> List-Subscribe: <http://sourceware.org/mailman/listinfo/libabigail>, <mailto:libabigail-request@sourceware.org?subject=subscribe> From: Giuliano Procida via Libabigail <libabigail@sourceware.org> Reply-To: Giuliano Procida <gprocida@google.com> Cc: maennich@google.com, kernel-team@android.com Errors-To: libabigail-bounces@sourceware.org Sender: "Libabigail" <libabigail-bounces@sourceware.org> |
Series |
Type equality refactor and instrumentation
|
|
Message
Giuliano Procida
July 8, 2020, 9:53 a.m. UTC
Hi Dodji. This series refactors various operator== methods making their common functionality evident. The first patch is just a prelude to make the second smaller. The second patch does the refactoring. I'm not attached to the name 'equality_helper'. The third patch is not intended for direct inclusion in libabigail but builds on the refactoring to investigate how equality and canonical types work in practice. It identifies some potential discrepancies, but they may be entirely expected. In general, it can be risky to define operator== in a way where reflexivity, symmetry and transitivity do not obviously hold or can be sensitive to small code changes or in way where equality, say for class_decl_sptr, can be affected by something like canonicalisation. More instrumentation could be added to check behaviour. Giuliano Procida (3): abg-ir.cc: Tidy some operator== definitions abg-ir.cc: Refactor operator== methods with helper Add some type equality paranoia. src/abg-ir.cc | 185 +++++++++++++++++++++++++++++--------------------- 1 file changed, 106 insertions(+), 79 deletions(-)
Comments
Hello Giuliano, Giuliano Procida <gprocida@google.com> a écrit: > Hi Dodji. > > This series refactors various operator== methods making their common > functionality evident. > > The first patch is just a prelude to make the second smaller. > > The second patch does the refactoring. I'm not attached to the name > 'equality_helper'. Thank you for working on this. I have looked into these first two patches and they look good to me in general. I'll post their individual review as usual, shortly. > The third patch is not intended for direct inclusion in libabigail but > builds on the refactoring to investigate how equality and canonical > types work in practice. It identifies some potential discrepancies, > but they may be entirely expected. In it's current form, I'd rather hold the inclusion of this one for now. It's super intrusive, clutters the code quite a bit and I am not really sure about its practical use at the moment. > In general, it can be risky to define operator== in a way where > reflexivity, symmetry and transitivity do not obviously hold or can be > sensitive to small code changes or in way where equality, say for > class_decl_sptr, can be affected by something like canonicalisation. > More instrumentation could be added to check behaviour. The comparison code is tricky. The number one reason for this is that it has to be fast. So yes, it's risky. One category of tests that are "simple" to perform and in practise are quite powerful to detect and debug potential comparison issues are "identity tests". That is, comparing a binary against itself and requiring that the result be the empty set. This is why the option "--abidiff" was added to abidw. So I tend to favor schemes that keep the code the less cluttered and the most "debuggable" as possible, as opposed to adding a lot of instrumentation. I guess some balance has to found there. Cheers,
Hi Dodji. On Mon, 27 Jul 2020 at 08:33, Dodji Seketeli <dodji@seketeli.org> wrote: > > Hello Giuliano, > > Giuliano Procida <gprocida@google.com> a écrit: > > > Hi Dodji. > > > > This series refactors various operator== methods making their common > > functionality evident. > > > > The first patch is just a prelude to make the second smaller. > > > > The second patch does the refactoring. I'm not attached to the name > > 'equality_helper'. > > Thank you for working on this. > > I have looked into these first two patches and they look good to me in general. > I'll post their individual review as usual, shortly. > > > The third patch is not intended for direct inclusion in libabigail but > > builds on the refactoring to investigate how equality and canonical > > types work in practice. It identifies some potential discrepancies, > > but they may be entirely expected. > > In it's current form, I'd rather hold the inclusion of this one for now. > It's super intrusive, clutters the code quite a bit and I am not really > sure about its practical use at the moment. The code is absolutely not intended to be committed to master. On top of the obvious impact on the code, tests were still running after 60h with this turned on! > > In general, it can be risky to define operator== in a way where > > reflexivity, symmetry and transitivity do not obviously hold or can be > > sensitive to small code changes or in way where equality, say for > > class_decl_sptr, can be affected by something like canonicalisation. > > More instrumentation could be added to check behaviour. > > The comparison code is tricky. The number one reason for this is that > it has to be fast. So yes, it's risky. > > One category of tests that are "simple" to perform and in practise are > quite powerful to detect and debug potential comparison issues are > "identity tests". That is, comparing a binary against itself and > requiring that the result be the empty set. This is why the option > "--abidiff" was added to abidw. > > So I tend to favor schemes that keep the code the less cluttered and the > most "debuggable" as possible, as opposed to adding a lot of > instrumentation. I guess some balance has to found there. This was intended for one-off (or occasional) instrumentation. Running with the instrumentation, I noticed various places where canonical and structural comparison differ. If the comparisons are happening during canonicalisation then things may be temporarily off. Or I may have a bug in the instrumentation. At any rate, the commit adds code comments showing where certain discrepancies were noted during "make check". For example, function_type nodes sometimes compare as canonically equal but not "structurally" and vice versa. "Structurally" is not really fully structurally as recursive calls attempt canonical comparison first. If there are any you think are of concern, let me know and I can investigate further and open a bug with findings. I've reworked my series to account for your version of the second commit. The instrumentation commit can be found amongst the changes in https://github.com/myxoid/libabigail/commits/type-equality-paranoia Regards, Giuliano. > Cheers, > > -- > Dodji