This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Speed up dwarf2_frame_find_fde
- From: Tom Tromey <tromey at redhat dot com>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>
- Cc: Andreas Schwab <schwab at redhat dot com>, gdb-patches at sourceware dot org
- Date: Tue, 04 Aug 2009 12:17:58 -0600
- Subject: Re: [patch] Speed up dwarf2_frame_find_fde
- References: <20090721223129.85D1F76BC0@localhost> <m3hbx5gkrq.fsf@hase.home> <8ac60eac0907221324n28e246c1k5e62f79973955ae@mail.gmail.com>
- Reply-to: tromey at redhat dot com
>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:
Paul> 2009-07-22 Paul Pluzhnikov <ppluzhnikov@google.com>
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