Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Klee Dienes <kdienes@apple.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Cached function lookup
Date: Sat, 09 Mar 2002 21:42:00 -0000	[thread overview]
Message-ID: <3C8AF245.7060504@cygnus.com> (raw)
In-Reply-To: <8A9ABA76-1A1B-11D6-BA6D-0030653FA4C6@apple.com>

> (This is basically the same patch I sent last week, just updated
> to the latest source base.)
> 
> This patch allows functions in the target used by GDB ("malloc",
> "scm_lookup_cstr", and later a ton of Objective-C functions) to have
> their values cached and re-used unless the symbol table has changed
> in-between calls.  This is a performance win overall, and a particular
> win when dispatching Objective-C method calls and looking up
> Objective-C type information from the runtime.

Klee, I think there are three changes in this:

o 
a change to the signature of the function
	find_function_in_inferior().  I guess this is
	either connected the print (float) f(3.0) change
	or something related to an ObjectiveC patch.

	I'll skip that for now.

o 
a change to breakpoint.c so it can more efficiently
	handle symbol table updates (defering things until
	when breakpoint_update is called).

	I'll comment on that separatly - if it is separated
	out there is a much better chance of MichaelS approving
	it :-)

o 
a change add a function value cache

I'll comment on the third, I think with that resolved and committed, it 
should be possible for the second to just fall out.

The patch to breakpoint.c introduced the global variable 
symbol_generation.  I don't think it is a good idea for the function 
cache code to be depending on a global variable controlled by breakpoint.c.

Have a look at the target_new_objfile_hook() chain as a way of notifying 
the function-cache code of symtab updates updates?  (I'm getting the 
feeling that the hook may have been wrongly named (?)).

Can I suggest changing ``struct cached_value { ... }'' in value.h to the 
opaque (and hopefully better named):
	struct cached_function;  /* or cached_function_value???? */

 > +  if (cval->generation != symbol_generation)
 > +    {
 > +      val = find_function_in_inferior (cval->name, cval->type);
 > +      cval->val = *val;
 > +      cval->val.next = NULL;
 > +      cval->generation = symbol_generation;
 > +    }

I think:
	free_value(cval->val)
	cval->val = find.....()
	release_value(cval->val)
is more correct.

cvsl->val would need to become a ``struct value *'' but that is a good 
as as ``struct value'' should be treated as an opaque.

 > +  val = allocate_value (cval->val.type);
 > +  next = val->next;
 > +  *val = cval->val;
 > +  val->next = next;

I think value_copy() is more correct.

enjoy,
Andrew



  parent reply	other threads:[~2002-03-10  5:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-05  1:34 Klee Dienes
2002-02-06 10:58 ` Jim Blandy
2002-02-28  7:22 ` Andrew Cagney
2002-03-09 21:42 ` Andrew Cagney [this message]
2002-03-09 21:54 ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C8AF245.7060504@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kdienes@apple.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox