This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [cxx-conversion] New Hash Table (issue6244048)


On 5/24/12, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
> On May 24, 2012 Lawrence Crowl <crowl@google.com> wrote:
> > Add a type-safe hash table, typed_htab.  Uses of this table
> > replace uses of libiberty's htab_t.  The benefits include less
> > boiler-plate code, full type safety, and improved performance.
>
> Lawrence, is there any chance you could just call it hash_table<>?
> After the conversion, we will be living most of the time in a
> typed world, so the "typed_" prefix will be redundant if not
> confusing :-)

I agree that the name is not great, and have no love of it.
I'd like to get all the name suggestions on the table before I to
a renaming pass.

> > [...]
> >
> > The type-safe hash table is a template, taking the element
> > type and the operational functions as template parameters.
> > Passing the operational functions as template parameters, rather
> > than function pointers, exposes the calls to inlining at -O2.
> > A side effect is that declarations of hash tables move to after
> > the declarations of those functions.  A further side effect
> > is that the control block shrinks from 108 bytes to 44 bytes.
> > There is otherwise no effect on data size.
>
> Nice.
>
> Do you anticipate that at some point we could just pass function
> object classes as template arguments as opposed to functions?
> That of course would retain the nice property of inlining, but
> it would remove the need to make the function have an external
> linkage.  The downside is that change would touch more places
> than your current patch does.

Yes, we could do that.  I'm a little reluctant to make too many
steps in any one patch.

As an example, we could move the control block into the variable for
most uses of the table, but not all.  Doing so would complicate this
patch, and so I thought it best to make that change a separate issue.

That said, I'll let y'all decide how much to put in any one piece.

-- 
Lawrence Crowl


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]