This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] move many gc hashtab to hash_table
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Trevor Saunders <tsaunders at mozilla dot com>
- Cc: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 13 Oct 2014 09:02:44 -0700
- Subject: Re: [PATCH] move many gc hashtab to hash_table
- Authentication-results: sourceware.org; auth=none
- References: <1412652246-20284-1-git-send-email-tsaunders at mozilla dot com> <543840D8 dot 5030409 at redhat dot com> <20141010204433 dot GA8700 at tsaunders-iceball dot corp dot tor1 dot mozilla dot com> <CAMe9rOqewyGPD+-n1yEixiXu16o+oq44r1gnHxwgv=DrrdT2aQ at mail dot gmail dot com>
On Mon, Oct 13, 2014 at 8:33 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Oct 10, 2014 at 1:44 PM, Trevor Saunders <tsaunders@mozilla.com> wrote:
>> On Fri, Oct 10, 2014 at 02:26:00PM -0600, Jeff Law wrote:
>>> On 10/06/14 21:24, tsaunders@mozilla.com wrote:
>>> >From: Trevor Saunders <tsaunders@mozilla.com>
>>> >
>>> >Hi,
>>> >
>>> >This changes almost all of the ggc htab that don't use the if_marked option to
>>> >be hash_tables. I added a for_user gty attribute so that types could be used
>>> >from user marking routines without either using the mangled names or being
>>> >referenced in a template argument which was previously the only way to get
>>> >gengtype to emit user callable marking routines.
>>> >
>>> >bootstrapped + regtested on x86_64-unknown-linux-gnu, ran make all-gcc for
>>> >ppc64-linux, ppc64-apple-darwin, mips-elf, m32c-elf, mep-elf, and
>>> >x86_64-apple-darwin. I haven't heard back yet on my request for a cfarm
>>> >account so I haven't tried bootstrapping on other archs, but more testing is
>>> >most welcome. Ok?
>>> >
>>> >Trev
>>> >
>>> >
>>> >gcc/
>>> >
>>> >* asan.c, cfgloop.c, cfgloop.h, cgraph.c, cgraph.h,
>>> > config/darwin.c, config/m32c/m32c.c, config/mep/mep.c,
>>> > config/mips/mips.c, config/rs6000/rs6000.c, dwarf2out.c,
>>> > function.c, function.h, gimple-ssa.h, libfuncs.h, optabs.c,
>>> > output.h, rtl.h, sese.c, symtab.c, tree-cfg.c, tree-dfa.c,
>>> > tree-ssa.c, varasm.c: Use hash-table instead of hashtab.
>>> > * doc/gty.texi (for_user): Document new option.
>>> > * gengtype.c (create_user_defined_type): Don't try to get a struct for
>>> > char.
>>> > (walk_type): Don't error out on for_user option.
>>> > (write_func_for_structure): Emit user marking routines if requested by
>>> > for_user option.
>>> > (write_local_func_for_structure): Likewise.
>>> > (main): Mark types with for_user option as used.
>>> > * ggc.h (gt_pch_nx): Add overload for unsigned int.
>>> > * hash-map.h (hash_map::hash_entry::pch_nx_helper): AddOverloads.
>>> > * hash-table.h (ggc_hasher): New struct.
>>> > (hash_table::create_ggc): New function.
>>> > (gt_pch_nx): New overload for hash_table.
>>> >
>>> >java/
>>> >
>>> > * class.c, decl.c, except.c, expr.c, java-tree.h, lang.c: Use
>>> > hash_table instead of hashtab.
>>> >
>>> >objc/
>>> >
>>> > * objc-act.c: use hash_table instead of hashtab.
>>> >
>>> >cp/
>>> >
>>> > * cp-gimplify.c, cp-tree.h, decl.c, mangle.c, name-lookup.c,
>>> > pt.c, semantics.c, tree.c, typeck2.c: Use hash_table instead of
>>> > hashtab.
>>> >
>>> >fortran/
>>> >
>>> > * trans-decl.c, trans.c, trans.h: Use hash_table instead of hashtab.
>>> >
>>> >c-family/
>>> >
>>> > * c-common.c: Use hash_table instead of hashtab.
>>> Whee, meaning we no longer have to pass through void * pointers and the
>>> visually ugly casting that requires in the callbacks?!? Yea!
>>
>> yeah, you can even use an iterator now if you like
>>
>>> >- ++*((unsigned HOST_WIDE_INT *) data);
>>> >+ ++* data;
>>> I think coding standards require no space here. Obviously a nit.
>>
>> oops, definitely should be fixed :)
>>
>>> This is obviously a fairly mechanical change. I did some spot checking and
>>> it looks good. I don't expect any fallout.
>>
>> Well, its large enough I expect *something* but I doubt it'll be a big
>> deal.
>>
>>> Good for the trunk.
>>
>> thanks for the review, I know it was rather big.
>
> This breaks bootstrap on Linux/x86:
>
> https://gcc.gnu.org/ml/gcc-regression/2014-10/msg00237.html
>
> This patch fixes it.
This is what I checked in.
--
H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog (revision 216150)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2014-10-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * mangle.c (mangle_conv_op_name_for_type): Cast elements to
+ unsigned long.
+ (print_template_statistics): Cast size and elements to long.
+
2014-10-12 Trevor Saunders <tsaunders@mozilla.com>
* cp-gimplify.c, cp-tree.h, decl.c, mangle.c, name-lookup.c,
Index: mangle.c
===================================================================
--- mangle.c (revision 216150)
+++ mangle.c (working copy)
@@ -3744,7 +3744,8 @@ mangle_conv_op_name_for_type (const tree
char buffer[64];
/* Create a unique name corresponding to TYPE. */
- sprintf (buffer, "operator %lu", conv_type_names->elements ());
+ sprintf (buffer, "operator %lu",
+ (unsigned long) conv_type_names->elements ());
identifier = get_identifier (buffer);
*slot = identifier;
Index: pt.c
===================================================================
--- pt.c (revision 216150)
+++ pt.c (working copy)
@@ -22324,12 +22324,12 @@ void
print_template_statistics (void)
{
fprintf (stderr, "decl_specializations: size %ld, %ld elements, "
- "%f collisions\n", decl_specializations->size (),
- decl_specializations->elements (),
+ "%f collisions\n", (long) decl_specializations->size (),
+ (long) decl_specializations->elements (),
decl_specializations->collisions ());
fprintf (stderr, "type_specializations: size %ld, %ld elements, "
- "%f collisions\n", type_specializations->size (),
- type_specializations->elements (),
+ "%f collisions\n", (long) type_specializations->size (),
+ (long) type_specializations->elements (),
type_specializations->collisions ());
}