public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: "dodji at seketeli dot org" <sourceware-bugzilla@sourceware.org>
To: libabigail@sourceware.org
Subject: [Bug default/26646] unexpected declaration-only types
Date: Wed, 02 Mar 2022 13:34:14 +0000	[thread overview]
Message-ID: <bug-26646-9487-00KTDpQnZP@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26646-9487@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26646

--- Comment #31 from dodji at seketeli dot org ---
Dodji Seketeli via Libabigail <libabigail@sourceware.org> a écrit:

[...]


> This addresses https://sourceware.org/bugzilla/show_bug.cgi?id=26646#c21.
>
> 	* src/abg-dwarf-reader.cc (compare_dies): Do not propagate
> 	canonical type when aggregate redundancy is detected.
>

[...]

gprocida at google dot com via Libabigail <libabigail@sourceware.org> a
écrit:

[...]

> I've thought a little bit more about this one.
>
> The current check is "local", recursion prevention at *this* DIE
> prevents it from being canonicalised, but it could still depend on
> child DIEs that are actually also parent DIEs and whose processing has
> not yet been completed.

You are right.  The current state is an improvement, but it's not
"complete".  Some DIEs might still wrongly considered as being
equivalent just because they depend on a "recursive DIE" that was
detected as such.  The canonical DIE propagation might have happened
during the window of time where the recursive DIE was comparing equal to
its counterpart.

This is addressed in the IR type canonicalization algorithm in
abg-ir.cc.
To learn more about this, look for
/// @defgroup OnTheFlyCanonicalization On-the-fly Canonicalization

and that comment.

The implementation is scattered in the functions
return_comparison_result, maybe_propagate_canonical_type and in the
macro RETURN_TRUE_IF_COMPARISON_CYCLE_DETECTED.

More on this below ...

> Would it be safer (more precise) to inhibit on-the-fly
> canonicalisation whenever the set (stack) of aggregates being compared
> is non-empty?

Right, that is the obvious thing to do, as I thought.  But then the
problem I encountered, when doing this for IR types, was that things
were too slow.  Really really slow.  In the time window where the
canonical type DIE is inhibited, the amount of (quadratic) structural
DIE comparisons goes through the roof.  That is why I came up with the
canonical type propagation in the first place.

So, the other (harder) approach I've taken is to not disable the
on-the-fly canonicalization when the stack of aggregates being compared
is non-empty, but rather, keep track of the types which are resolved as
being equivalent, but that depend on recursive aggregate that were
detected as such.

I call these types "dependent types".  Let's consider one such dependent
type D.  D's canonical type is the result of canonical propagation that
happened as the recursive type (that D depends on) was on the stack of
aggregates being compared.  D is labelled as having a "non-confirmed"
canonical type.  If the recursive type it depends on is later considered
not being equivalent to its counterpart, then the non-confirmed
canonical of D is going to be "cancelled" and then D is going to be
considered as being non canonicalized.

This is done for D and all the types that depends on it.

By doing this, the number of non canonicalized types is reduced to its
absolute minimum and so comparisons are reasonably fast, even for an
applications like the Kernel or Gimp.  Libraries usually have smaller
type graphs so we don't usually see the speed issue there.  Unless it's
llvm.so or libwebkit.so ;-)

So, I wasn't going to get into doing this for DIEs right away because it
takes a lot of time doing careful coding/debugging/profiling cycles.

But I definitely think we'll need to do this to have perfectly precise
canonicalizer.  My point was to get this in as it's an improvement
already and then work on the subsequent patch with a cooler head.

Does that make any sense?

Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-03-02 13:34 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 11:35 [Bug default/26646] New: unexpectedly " gprocida+abigail at google dot com
2020-09-22 12:15 ` [Bug default/26646] " dodji at redhat dot com
2020-10-06 21:02 ` gprocida+abigail at google dot com
2020-10-07  9:33 ` gprocida+abigail at google dot com
2020-11-23 17:06 ` gprocida+abigail at google dot com
2022-01-17 17:46 ` gprocida at google dot com
2022-01-18  9:37 ` gprocida at google dot com
2022-01-18 11:20 ` gprocida at google dot com
2022-01-18 11:20 ` gprocida at google dot com
2022-01-18 11:32 ` gprocida at google dot com
2022-01-24 15:07 ` dodji at redhat dot com
2022-01-24 17:29 ` gprocida at google dot com
2022-02-07 10:40 ` gprocida at google dot com
2022-02-07 11:19 ` dodji at redhat dot com
2022-02-07 17:10 ` [Bug default/26646] unexpected " dodji at redhat dot com
2022-02-07 17:47 ` gprocida at google dot com
2022-02-07 21:15 ` gprocida at google dot com
2022-02-10 16:45 ` dodji at redhat dot com
2022-02-10 16:46 ` gprocida at google dot com
2022-02-10 17:21 ` gprocida at google dot com
2022-02-10 17:33 ` dodji at redhat dot com
2022-02-10 17:36 ` dodji at redhat dot com
2022-02-10 18:53 ` gprocida at google dot com
2022-02-11 12:51 ` gprocida at google dot com
2022-02-11 13:00 ` gprocida at google dot com
2022-02-24 11:09 ` dodji at redhat dot com
2022-02-24 12:16 ` gprocida at google dot com
2022-02-24 15:54 ` dodji at redhat dot com
2022-02-24 16:05 ` gprocida at google dot com
2022-02-28  9:59 ` dodji at redhat dot com
2022-02-28 10:01 ` dodji at redhat dot com
2022-03-01 14:34 ` gprocida at google dot com
2022-03-01 14:40 ` gprocida at google dot com
2022-03-02 13:34   ` Dodji Seketeli
2022-03-02 13:34 ` dodji at seketeli dot org [this message]
2022-03-02 22:36 ` gprocida at google dot com
2022-03-03 11:43 ` dodji at seketeli dot org
2022-03-03 13:32 ` gprocida at google dot com
2022-06-08 15:43 ` gprocida at google dot com
     [not found] <bug-26646-12616@http.sourceware.org/bugzilla/>
     [not found] ` <bug-26646-12616-6R4shWHsRy@http.sourceware.org/bugzilla/>
2022-03-02 22:35   ` Giuliano Procida
2022-03-03 11:43     ` Dodji Seketeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-26646-9487-00KTDpQnZP@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).