From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5339 invoked by alias); 16 May 2013 13:42:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 5310 invoked by uid 89); 16 May 2013 13:42:56 -0000 X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 16 May 2013 13:42:55 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4GDgsHa024122 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 May 2013 09:42:54 -0400 Received: from barimba (ovpn-113-133.phx2.redhat.com [10.3.113.133]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4GDgrV8024464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 16 May 2013 09:42:53 -0400 From: Tom Tromey To: Phil Muldoon Cc: "gdb-patches\@sourceware.org" Subject: Re: [patch] Convert frame_stash to a hash table References: <5194DA88.6020705@redhat.com> Date: Thu, 16 May 2013 13:42:00 -0000 In-Reply-To: <5194DA88.6020705@redhat.com> (Phil Muldoon's message of "Thu, 16 May 2013 14:09:28 +0100") Message-ID: <871u9711nn.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-05/txt/msg00617.txt.bz2 >>>>> "Phil" == Phil Muldoon writes: Phil> I think this patch improves the frame_stash "with filters" without Phil> affecting "no filters" performance. Phil> Tested on x8664 with no regressions. Phil> What do you think? Thanks, Phil. I appreciate this. A few nits below. Phil> +/* A frame stash used to speed up frame lookups. Create a hash table Phil> + to stash frames previously accessed from the frame cache for Phil> + quicker subsequent retrieval. The hash table is emptied whenever Phil> + the frame cache is invalidated. */ Phil> +static htab_t frame_stash; We use a blank line between the intro comment and the definition now. This applies elsewhere. Phil> + if (! f_id.stack_addr_p && ! f_id.code_addr_p && ! f_id.special_addr) Phil> + gdb_assert ("Cannot calculate hash for frame_id."); This assert will never fail, since its argument is true. You want: gdb_assert (f_id.stack_addr_p || f_id.code_addr_p || f_id.special_addr_p); Also note the missing "_p" from special_addr_p in the patch. Phil> + if (f_id.stack_addr_p == 1) These are booleans so don't compare against 1. Phil> + slot = (struct frame_info **) htab_find_slot (frame_stash, Phil> + frame, Phil> + INSERT); Phil> + if (*slot != frame) Phil> + *slot = frame; I think you might as well assign unconditionally. Otherwise I think readers will wonder when this can happen. But, I think it can't happen. Alternatively, if it can happen, then we need a comment. thanks, Tom