Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: suggestion for dictionary representation
@ 2002-09-23 23:50 Jim Blandy
  2002-09-24  6:19 ` Daniel Berlin
  2002-09-24  9:49 ` David Carlton
  0 siblings, 2 replies; 28+ messages in thread
From: Jim Blandy @ 2002-09-23 23:50 UTC (permalink / raw)
  To: david carlton; +Cc: gdb


> Also, for what it's worth, I'm still not ready to completely give up
> on representing members of classes via a dictionary; that would
> provide another place where a linear dictionary environment could be
> useful.

I agree, but it's worth noting that `struct symbol' is 52 bytes long
on a Pentium, whereas `struct field' and `struct fn_field' are 16
bytes long.  

Not that that necessarily matters.  We know GDB does have memory
consumption problems, but I have never seen those problems really
analyzed.  All the memory could be in physnames, for all we know.  But
I'd want to have some sense of the impact before I made the change.
(Perhaps a heavy C++ user could stick a `char foo[52 - 16]' at the end
of `struct field' and `struct fn_field', and tell us how that goes.)

An intermediate step would be to simply add a `struct dictionary *' to
`struct cplus_struct_type'.  We could use that right off the bat for
nested classes, typedefs, and enums.  We could then migrate other
stuff over there incrementally.


^ permalink raw reply	[flat|nested] 28+ messages in thread
* suggestion for dictionary representation
@ 2002-09-22 19:59 Jim Blandy
  2002-09-22 20:11 ` Daniel Jacobowitz
  0 siblings, 1 reply; 28+ messages in thread
From: Jim Blandy @ 2002-09-22 19:59 UTC (permalink / raw)
  To: david carlton; +Cc: gdb


It seems to me that the `skip list' data structure simultaneously
meets a lot of the criteria that we're currently meeting by having
multiple representations.  Skip lists:
- provide (probabalistic) log n access time
- are low overhead ("They can easily be configured to require an
  average of 1 1/3 pointers per element (or even less).")
- are easy to build incrementally, and stay "balanced" automatically
- are obstack-friendly, since they don't involve realloc (as hash
  tables do)
- are an ordered structure, which would support completion nicely (and,
  by the way, make the `_Z' test for the C++ V3 ABI faster too)
- have a trivial iterator (walking the finest level of links)
- are pretty easy to understand

http://www.cs.umd.edu/~pugh points to a paper describing and analyzing
them.

Using skip lists, there'd be no need to distinguish `expandable' from
non-expandable blocks.  This one structure would scale to handle both
local blocks and the global environment (depending on how we handle
lazy symbol reading --- I'd like a more generic and descriptive term
than "partial symbol tables").

The only remaining special case would be function blocks, in which
parameter symbols must to appear in the order they appear in the
source.  I think it's pretty ugly to abuse the name array this way; it
introduces special cases in dumb places.  This kludge could be removed
by changing the `function' member of `struct block' to a pointer to
something like this:

   struct function_info {
       struct symbol *sym;
       int num_params;
       struct symbol **params;
   };

This would require extra space only for function blocks; non-function
blocks would remain the same size.  And this info would only be
consulted when we actually wanted to iterate over the parameters.
This would clean up a bunch of loops in GDB that currently have to
iterate over all the symbols in a function's block and do a switch on
each symbol's address class to find the arguments.  (And would this
also allow us to remove the arg/other distinction in enum
address_class?  Dunno.)

But if we were to remove function blocks as a special case, there
would only need to be a single structure for representing levels of
the namespace.

(Daniel Berlin pointed me at skip lists a long time ago --- thanks!)


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2002-09-27 18:28 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-23 23:50 suggestion for dictionary representation Jim Blandy
2002-09-24  6:19 ` Daniel Berlin
2002-09-24  7:06   ` Daniel Jacobowitz
2002-09-24 21:01   ` Jim Blandy
2002-09-25  5:54     ` Daniel Jacobowitz
2002-09-27 11:23       ` Jim Blandy
2002-09-27 11:28         ` Daniel Jacobowitz
2002-09-24  9:49 ` David Carlton
  -- strict thread matches above, loose matches on Subject: below --
2002-09-22 19:59 Jim Blandy
2002-09-22 20:11 ` Daniel Jacobowitz
2002-09-23 10:38   ` David Carlton
2002-09-23 17:34     ` Daniel Berlin
2002-09-23 18:39       ` Daniel Jacobowitz
2002-09-23 21:28         ` Daniel Berlin
2002-09-23 21:38           ` Eli Zaretskii
2002-09-23 21:44             ` Daniel Berlin
2002-09-23 21:47               ` Eli Zaretskii
2002-09-23 21:54                 ` Daniel Berlin
2002-09-24  9:33       ` David Carlton
2002-09-24 10:42         ` Daniel Berlin
2002-09-24 10:53           ` David Carlton
2002-09-24 20:01         ` Jim Blandy
2002-09-24 20:50           ` Daniel Berlin
2002-09-23 18:28     ` Daniel Jacobowitz
2002-09-24  3:51     ` Paul N. Hilfinger
2002-09-24 19:52     ` Jim Blandy
2002-09-24 20:37       ` Elena Zannoni
2002-09-24 20:53       ` Daniel Berlin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox