Re: [patch] Speed up find_pc_section

Tom Tromey
2009-07-21T17:09:25Z

>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:

Paul> Hmm, this one is trickier (I don't want to make objfiles_updated_p
Paul> global).

Yeah, good call.

Paul> I moved the 'objfiles_updated_p += 1' from free_objfile() into
Paul> clear_objfile_data() -- that's called from reread_symbols() as well.

I don't like this so much. clear_objfile_data is a clear,
single-purpose function. I'm reluctant to add unrelated code to it.

Perhaps a new function would be better. Or, maybe there is a way to do
this by registering some observers.

Paul> 2009-07-17 Paul Pluzhnikov <ppluzhnikov@google.com>
Paul> * objfiles.c (objfiles_updated_p): New variable.
Paul> (qsort_cmp, bsearch_cmp, update_section_map): New functions.
Paul> (find_pc_section): Use bsearch.

This should mention the modified functions: add_to_objfile_sections,
objfile_relocate, and clear_objfile_data.

+ objfiles_updated_p += 1; /* Rebuild section map next time we need it. */

Since this is just a boolean flag I think a plain assignment is clearer.
An increment leads me to wonder what the count means.

Tom