Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH v3 2/5] Introduce frame_info_ptr smart pointer class
Date: Wed, 24 Aug 2022 17:49:34 +0200	[thread overview]
Message-ID: <9c6f5fe1-c71a-49df-9537-744209ec061a@redhat.com> (raw)
In-Reply-To: <dd648e71-fdad-0f0e-f91c-104dfd442136@palves.net>

Hi Pedro,

On 24/08/2022 17:20, Pedro Alves wrote:
> Hi Bruno,
>
> On 2022-08-24 3:24 p.m., Bruno Larsen wrote:
>> Hi Pedro,
>>
>> Thanks for the review, and sorry for the delayed response.
>>
>> On 25/07/2022 19:52, Pedro Alves wrote:
>>> On 2022-07-25 6:06 p.m., Bruno Larsen via Gdb-patches wrote:
>>>
>>>> +
>>>> +private:
>>>> +
>>>> +  /* The underlying pointer.  */
>>>> +  frame_info *m_ptr = nullptr;
>>>> +
>>>> +  /* All frame_info_ptr objects are kept on a circular doubly-linked
>>>> +     list.  This keeps their construction and destruction costs
>>>> +     reasonably small.  To make the implementation a little simpler,
>>>> +     we guarantee that there is always at least one object on the list
>>>> +     -- this "root".  */
>>> This comment is stale -- this is no longer a full frame_info object.
>> I'm not sure why you mention it being a full frame_info object.
> I meant frame_info_ptr instead of frame_info, as that's what it was in the
> original version:
>
>   +  /* All frame_info_ptr objects are kept on a circular doubly-linked
>   +     list.  This keeps their construction and destruction costs
>   +     reasonably small.  To make the implementation a little simpler,
>   +     we guarantee that there is always at least one object on the list
>   +     -- this "root".  */
>   +  static frame_info_ptr root;
>
>> root was never a usable frame_info_ptr, it was just used as a pointer to the frame_info_ptr list from the outside, and to make intrusive list operations easy as we don't have to check for an empty list. I did reword the comment to:
>>
>> /* All frame_info_ptr objects are kept on an intrusive list.
>>    This keeps their construction and destruction costs
>>    reasonably small.  To make the implementation a little simpler,
>>    we guarantee that there is always at least one object on the list
>>    - this "root".  It is only used to simplify intrusive_list operations.  */
>>
>> to hopefully explain things better.
> Not really.  The comment was there because the linked list implementation used one
> element type as "root" (aka "head") object, a full frame_info_ptr object, same type as
> all other elements, even if only its m_next/m_prev pointers were used.  This part:
>
>    "To make the implementation a little simpler, we guarantee that there is always
>     at least one object on the list this "root"."
>
> ... with the conversion to intrusive list, that comment no longer makes sense.  We don't
> store a "root" object of element type any more.
>
> In fact, I think you should rename the "root" to frame_list, or some such, like:
>
>   - static intrusive_list<frame_info_ptr> root;
>   + static intrusive_list<frame_info_ptr> frame_list;
>
> ... and don't talk about "root" any longer; however the head node is implemented, it's
> an intrusive_list implementation detail.

Ah, I see what you mean. I guess I still had the old implementation in 
mind when I wrote the comment, and agree with you that renaming the 
variable would avoid a lot of confusion. I'll rethink this bit and send 
a v3 later this week, thanks for the explanation!

-- 
Cheers,
Bruno


  reply	other threads:[~2022-08-24 15:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 17:06 [PATCH v3 0/5] Smart pointer wrapper for frame_info Bruno Larsen via Gdb-patches
2022-07-25 17:06 ` [PATCH v3 1/5] Remove frame_id_eq Bruno Larsen via Gdb-patches
2022-07-25 17:06 ` [PATCH v3 2/5] Introduce frame_info_ptr smart pointer class Bruno Larsen via Gdb-patches
2022-07-25 17:52   ` Pedro Alves
2022-08-24 14:24     ` Bruno Larsen via Gdb-patches
2022-08-24 15:20       ` Pedro Alves
2022-08-24 15:49         ` Bruno Larsen via Gdb-patches [this message]
2022-07-25 17:06 ` [PATCH v3 3/5] Change GDB to use frame_info_ptr Bruno Larsen via Gdb-patches
2022-07-25 17:06 ` [PATCH v3 4/5] Continue making GDB " Bruno Larsen via Gdb-patches
2022-07-28 16:44   ` Andrew Burgess via Gdb-patches
2022-07-25 17:06 ` [PATCH v3 5/5] gdb/frame: Add reinflation method for frame_info_ptr Bruno Larsen via Gdb-patches

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=9c6f5fe1-c71a-49df-9537-744209ec061a@redhat.com \
    --to=gdb-patches@sourceware.org \
    --cc=blarsen@redhat.com \
    --cc=pedro@palves.net \
    --cc=tom@tromey.com \
    /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