This is the mail archive of the gdb-cvs@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]

src/gdb ChangeLog ada-lang.c dictionary.c dict ...


CVSROOT:	/cvs/src
Module name:	src
Changes by:	hilfingr@sourceware.org	2010-10-07 06:53:44

Modified files:
	gdb            : ChangeLog ada-lang.c dictionary.c dictionary.h 

Log message:
	Extend hashed symbol dictionaries to work with Ada
	
	This patch allows Ada to speed up symbol lookup by using the facilities
	in dictionary.[ch] for hashed lookups.  First, we generalize dictionary
	search to allow clients to specify any matching function compatible with
	the hashing function. Next, we modify the hashing algorithm so that symbols
	that wild-match a name hash to the same value.  Finally, we modify Ada
	symbol lookup to use these facilities.
	
	Because this patch touches on a hashing algorithm used by other
	languages, I took the precaution of doing a speed test on a list of
	about 12000 identifiers (repeatedly inserting all of them into a table
	and then doing a lookup on a million names at random, thus testing the
	speed of the hashing algorithm and how well it distributed names).
	There was actually a slight speedup, probably as a result of open-
	coding some of the tests in msymbol_hash_iw.  By design, the revised
	hashing algorithm produces the same results as the original on most
	"normal" C identifiers.
	
	We considered augmenting the dictionary interface still further by allowing
	different hashing algorithms for different dictionaries, based on the
	(supposed) language of the symbols in that dictionary.  While this produced
	better isolation of the changes to Ada programs, the additional flexibility
	also complicated the dictionary interface.  I'd prefer to keep things
	simple for now.
	
	Tested w/o regressions on Linux i686.
	
	ChangeLog:
	
	gdb/
	* ada-lang.c (ada_match_name): Use new API for wild_match.
	(wild_match): Change API to be consistent with that of strcmp_iw;
	return 0 for a match, and switch operand order.
	(full_match): New function.
	(ada_add_block_symbols): Use dict_iter_match_{first,next} for
	matching to allow use of hashing.
	* dictionary.c (struct dict_vector): Generalize iter_name_first,
	iter_name_next ot iter_match_first, iter_match_next.
	(iter_name_first_hashed): Replace with iter_match_first_hashed.
	(iter_name_next_hashed): Replace with iter_match_next_hashed.
	(iter_name_first_linear): Replace with iter_match_first_linear.
	(iter_name_next_linear): Replace with iter_match_next_linear.
	(dict_iter_name_first): Re-implement to use dict_iter_match_first.
	(dict_iter_name_next): Re-implement to use dict_iter_match_next.
	(dict_iter_match_first): New function.
	(dict_iter_match_next): New function.
	(dict_hash): New function.
	* dictionary.h (dict_iter_match_first, dict_iter_match_next): Declare.
	* psymtab.c (ada_lookup_partial_symbol): Use new wild_match API.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.12238&r2=1.12239
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.c.diff?cvsroot=src&r1=1.272&r2=1.273
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dictionary.c.diff?cvsroot=src&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dictionary.h.diff?cvsroot=src&r1=1.9&r2=1.10


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