From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22135 invoked by alias); 4 Aug 2009 18:18:12 -0000 Received: (qmail 22125 invoked by uid 22791); 4 Aug 2009 18:18:12 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Aug 2009 18:18:05 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n74II0m2021885; Tue, 4 Aug 2009 14:18:00 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n74IHx0s023210; Tue, 4 Aug 2009 14:17:59 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n74IHwaX032716; Tue, 4 Aug 2009 14:17:59 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 9FC1B3784EC; Tue, 4 Aug 2009 12:17:58 -0600 (MDT) To: Paul Pluzhnikov Cc: Andreas Schwab , gdb-patches@sourceware.org Subject: Re: [patch] Speed up dwarf2_frame_find_fde References: <20090721223129.85D1F76BC0@localhost> <8ac60eac0907221324n28e246c1k5e62f79973955ae@mail.gmail.com> From: Tom Tromey Reply-To: tromey@redhat.com Date: Tue, 04 Aug 2009 18:18:00 -0000 In-Reply-To: <8ac60eac0907221324n28e246c1k5e62f79973955ae@mail.gmail.com> (Paul Pluzhnikov's message of "Wed\, 22 Jul 2009 13\:24\:45 -0700") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 X-SW-Source: 2009-08/txt/msg00057.txt.bz2 >>>>> "Paul" == Paul Pluzhnikov writes: Paul> 2009-07-22 Paul Pluzhnikov Paul> * dwarf2-frame.c (struct dwarf2_cie): Remove 'next'. Paul> (struct dwarf2_cie_table): New. Paul> (struct dwarf2_fde): Remove 'next'. Paul> (struct dwarf2_fde_table): New. Paul> (struct comp_unit): Remove 'cie'. Paul> (bsearch_cie_cmp, bsearch_fde_cmp): New function. Paul> (find_cie, dwarf2_frame_find_fde): Use bsearch. Paul> (add_cie, add_fde): Use array instead of linked list. Paul> (decode_frame_entry, decode_frame_entry_1): New parameters. Paul> (qsort_fde_cmp): New function. Paul> (dwarf2_build_frame_info): Adjust. Overall this seems reasonable to me. Paul> +static int Paul> +qsort_fde_cmp (const void *a, const void *b) Paul> +{ Paul> + struct dwarf2_fde *aa = *(struct dwarf2_fde **)a; Paul> + struct dwarf2_fde *bb = *(struct dwarf2_fde **)b; Paul> + if (aa->initial_location == bb->initial_location) Paul> + /* Put eh_frame entries after debug_frame ones. */ Paul> + return aa->eh_frame_p - bb->eh_frame_p; I don't understand this comment. I thought perhaps there would be some reason to do this -- but then it seems like the bsearch comparison function ought to have similar logic. Could you explain it? Tom