[rfa] libiberty: splay tree performance improvement
Richard Henderson
rth@redhat.com
Mon Jun 28 23:42:00 GMT 2004
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~
More information about the Gcc-patches
mailing list