[rfa] libiberty: splay tree performance improvement

DJ Delorie dj@redhat.com
Mon Jun 28 21:00:00 GMT 2004


New fields must always be added at the end of the structure, and you
must verify that nothing outside of libiberty allocates memory for
this structure (dynamically or statically).  Otherwise, you may bump
into binary compatibility issues.  Probably a good idea to cc gdb too,
as they use splay trees also.

> Index: include/splay-tree.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/include/splay-tree.h,v
> retrieving revision 1.19
> diff -u -p -r1.19 splay-tree.h
> --- include/splay-tree.h	30 Mar 2004 19:23:16 -0000	1.19
> +++ include/splay-tree.h	28 Jun 2004 19:56:09 -0000
> @@ -97,6 +97,11 @@ struct splay_tree_s GTY(())
>    /* The root of the tree.  */
>    splay_tree_node GTY ((use_params)) root;
>  
> +  /* The last key value for which the tree has been splayed, but not
> +     since modified.  */
> +  splay_tree_key GTY ((use_param1)) last_splayed_key;
> +  int last_splayed_key_p;
> +
>    /* The comparision function.  */
>    splay_tree_compare_fn comp;



More information about the Gcc-patches mailing list