This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Speed up dwarf2_frame_find_fde


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]