This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to change hashtab.h hashval_t to size_t
> Date: Wed, 9 Oct 2002 19:00:17 -0400 (EDT)
> From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
> Cc: gcc-patches@gcc.gnu.org
> X-OriginalArrivalTime: 09 Oct 2002 23:00:19.0138 (UTC) FILETIME=[A385D220:01C26FE7]
>
> > From: Geoff Keating <geoffk at geoffk dot org>
> >
> > There's nothing particularly wrong with what hashtab.c already does:
> >
> > /* Returns a hash code for P. */
> >
> > static hashval_t
> > hash_pointer (p)
> > const PTR p;
> > {
> > return (hashval_t) ((long)p >> 3);
> > }
>
> Thanks. :-)
>
> Although `hash_pointer' is static, the external function pointer
> `htab_hash_pointer' is set to that function. So we can use that.
>
> Also I found two places in gcc which already inlined the equivalent
> code manually. I replaced those with calls to the function pointer.
>
> I tested via 3-stage on sparcv9-sun-solaris2.7 and full bootstrap on
> sparc-sun-solaris2.7, testsuite on the latter in progress. On
> sparcv9, the warnings were eliminated. Assuming no regressions, okay
> to install?
Sure, this is OK, although not for mainline (except for the warning fixes).
> Thanks,
> --Kaveh
>
>
> 2002-10-09 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
>
> cp:
> * decl.c (typename_hash): Use htab_hash_pointer.
>
> gcc:
> * fold-const.c (size_htab_hash): Use htab_hash_pointer.
> * function.c (insns_for_mem_hash): Likewise.
> * varasm.c (STRHASH): Likewise.
>
> java:
> * class.c (JAVA_TREEHASHHASH_H): Use htab_hash_pointer.
--
- Geoffrey Keating <geoffk@geoffk.org>