From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id DkuAM6lIBmO0oCwAWB0awg (envelope-from ) for ; Wed, 24 Aug 2022 11:50:01 -0400 Received: by simark.ca (Postfix, from userid 112) id C0A081E4A7; Wed, 24 Aug 2022 11:50:01 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Dlu5LIYP; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 462151E21F for ; Wed, 24 Aug 2022 11:50:01 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CE58F385C41B for ; Wed, 24 Aug 2022 15:50:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE58F385C41B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661356200; bh=z++B5DTA8g4F10+L/WtayN5y1fxoZ1r9ImiM1M4hG9Y=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Dlu5LIYP3nT2mx16CW0zkXShK757RmTRmEMR0++svHH+2ipsfC4IYQcykw4e0QVd4 VG/JzJxrqqOOblWfkakiHOxIYN7RveA13taj1N7iOvb01MgzMiptgjebHOGBDs2qkY K9aI/d80IzLYCA9Wl78SvJsIORjNyvldkQCzzm44= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 937353854148 for ; Wed, 24 Aug 2022 15:49:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 937353854148 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-590-H3vThNkRNnay0U1MDjVThA-1; Wed, 24 Aug 2022 11:49:38 -0400 X-MC-Unique: H3vThNkRNnay0U1MDjVThA-1 Received: by mail-ej1-f71.google.com with SMTP id sb14-20020a1709076d8e00b0073d48a10e10so4271943ejc.16 for ; Wed, 24 Aug 2022 08:49:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=z++B5DTA8g4F10+L/WtayN5y1fxoZ1r9ImiM1M4hG9Y=; b=Me5yG62rxYorV0k6dLgNnAOOgb67TnzqA3187f81zDBIKvo4eQB3aaBOM22oegMW9O daWkgX+jaWWe5x88TtDcbEXhBG0hoo3u8z87qrUjIL8mF+/+s/kK+oNvfqfQng03PdtW PAC/jXgxiivfrHSVGwWZ08PWygMTqg0fFroX9uSaSUewYjdee6ImL/foHP+INzdfvwwX sizi41IYkyvPOOJaHbRmw6W87viB4DwZbRkMc/0eWW70sijsqbhftWH8UqSJgCWLogCk 7V2Tp79uqjEz+mH1/3zEnsz1YUDzD9Z0/h9UAATDTxqdPhbeO5iylWC33idoxTDC1LYR v+KQ== X-Gm-Message-State: ACgBeo0z35p28Li0WaFKznd2AWgeURFuH5meWbiSrmmYYEV+wICSVyZ2 muzTXuFrqpRWItGbgxMheao6N2kskwaqw5mT0y5aTKiH1Y8HDg0w8RQDr2tzLQgxi3nbmuuqLVw cv5N5tUABK75e+2RGMFpIRQ== X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr3362008ejb.426.1661356177519; Wed, 24 Aug 2022 08:49:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR4L2Qjn8G2a9MCXPucoYip0YwLJeFEmNayf1/qO8wmRL9z+p/W+x8wrxpbP4djM/6wC0HZ/IQ== X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr3362001ejb.426.1661356177284; Wed, 24 Aug 2022 08:49:37 -0700 (PDT) Received: from [10.43.2.105] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id ec43-20020a0564020d6b00b0043d5c9281a3sm3196537edb.96.2022.08.24.08.49.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Aug 2022 08:49:35 -0700 (PDT) Message-ID: <9c6f5fe1-c71a-49df-9537-744209ec061a@redhat.com> Date: Wed, 24 Aug 2022 17:49:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v3 2/5] Introduce frame_info_ptr smart pointer class To: Pedro Alves , gdb-patches@sourceware.org References: <20220725170637.79699-1-blarsen@redhat.com> <20220725170637.79699-3-blarsen@redhat.com> <67e2626e-e20c-00a2-3d6b-d58c613060af@palves.net> <1bd52cbc-71ce-672b-9815-7a485e98475a@redhat.com> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Bruno Larsen via Gdb-patches Reply-To: Bruno Larsen Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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 root; > + static intrusive_list 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