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: [PATCH] move many gc hashtab to hash_table


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.

-- 
H.J.
--
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 6b8f706..40d32d8 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3744,7 +3744,7 @@ mangle_conv_op_name_for_type (const tree type)
       char buffer[64];

        /* Create a unique name corresponding to TYPE.  */
-      sprintf (buffer, "operator %lu", conv_type_names->elements ());
+      sprintf (buffer, "operator %lu", (long) conv_type_names->elements ());
       identifier = get_identifier (buffer);
       *slot = identifier;

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 47b5d93..390e63e 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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 ());
 }


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