This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [rfa] libiberty: splay tree performance improvement
- From: Richard Henderson <rth at redhat dot com>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, DJ Delorie <dj at redhat dot com>
- Date: Mon, 28 Jun 2004 14:43:42 -0700
- Subject: Re: [rfa] libiberty: splay tree performance improvement
- References: <20040628200754.GA10938@redhat.com>
On Mon, Jun 28, 2004 at 04:07:55PM -0400, Frank Ch. Eigler wrote:
> + /* If we just splayed the tree with the same key, do nothing. */
> + if (sp->last_splayed_key_p &&
> + (*sp->comp)(sp->last_splayed_key, key) == 0)
> + return;
> +
> splay_tree_splay_helper (sp, key, &sp->root,
> /*grandparent=*/0, /*parent=*/0);
> +
> + /* Cache this splay key. */
> + sp->last_splayed_key = key;
> + sp->last_splayed_key_p = 1;
How can you cache this value across calls without knowing the form
of the key? It could be a pointer located in stack memory that isn't
valid after the caller returns.
r~