This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix --enable-detailed-mem-stats
- From: Daniel Jacobowitz <drow at false dot org>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Fri, 15 Apr 2005 15:34:37 -0400
- Subject: Re: Fix --enable-detailed-mem-stats
- References: <20050415145429.GA2315@kam.mff.cuni.cz>
On Fri, Apr 15, 2005 at 04:54:29PM +0200, Jan Hubicka wrote:
>
> Hi,
> --enable-gather-detailed-mem-stats broke with the merge of zone collector (that
> is quite unforutunate as the memory tester stopped for a while and memory
> consumption is up considerably).
> The problem is the trick of passing location info only when declaration is
> enabled like this:
> t = ggc_alloc_zone_stat (length, &tree_id_zone PASS_MEM_STAT);
> When ggc_alloc_zone_stat is a macro, the call still has two arguments so we
> can't throw away the redundant &tree_id_zone while calling ggc_alloc_zone.
>
> Only way to fix it I see is to turn this inline. Problem is that then without
> optimization we end up referencing zone pointers even for non-zone garbage
> collector so we need placeholders.
>
> Does this look resonable? Bootstrapped/regtested i686-pc-gnu-linux
I apologize. I had a patch to fix this but I never got around to
submitting it; I didn't realize you were running an automatic tester...
I think this is a nicer solution. How about you?
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-04-15 Daniel Jacobowitz <dan@codesourcery.com>
* ggc.h (ggc_alloc_zone_pass_stat): New macro.
(ggc_alloc_zone_stat): Don't define.
* ggc-zone.c (ggc_alloc_typed_stat, ggc_alloc_stat): Use
ggc_alloc_zone_pass_stat.
* rtl.c (rtx_alloc_stat, shallow_copy_rtx_stat): Likewise.
* tree.c (make_node_stat, copy_node_stat, make_tree_binfo_stat)
(make_tree_vec_stat, tree_cons_stat, build1_stat): Likewise.
Index: ggc-zone.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc-zone.c,v
retrieving revision 2.23
diff -u -p -r2.23 ggc-zone.c
--- ggc-zone.c 14 Mar 2005 13:10:50 -0000 2.23
+++ ggc-zone.c 15 Apr 2005 19:31:26 -0000
@@ -1274,16 +1274,16 @@ ggc_alloc_typed_stat (enum gt_types_enum
switch (gte)
{
case gt_ggc_e_14lang_tree_node:
- return ggc_alloc_zone_stat (size, &tree_zone PASS_MEM_STAT);
+ return ggc_alloc_zone_pass_stat (size, &tree_zone);
case gt_ggc_e_7rtx_def:
- return ggc_alloc_zone_stat (size, &rtl_zone PASS_MEM_STAT);
+ return ggc_alloc_zone_pass_stat (size, &rtl_zone);
case gt_ggc_e_9rtvec_def:
- return ggc_alloc_zone_stat (size, &rtl_zone PASS_MEM_STAT);
+ return ggc_alloc_zone_pass_stat (size, &rtl_zone);
default:
- return ggc_alloc_zone_stat (size, &main_zone PASS_MEM_STAT);
+ return ggc_alloc_zone_pass_stat (size, &main_zone);
}
}
@@ -1292,7 +1292,7 @@ ggc_alloc_typed_stat (enum gt_types_enum
void *
ggc_alloc_stat (size_t size MEM_STAT_DECL)
{
- return ggc_alloc_zone_stat (size, &main_zone PASS_MEM_STAT);
+ return ggc_alloc_zone_pass_stat (size, &main_zone);
}
/* Poison the chunk. */
Index: ggc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc.h,v
retrieving revision 1.71
diff -u -p -r1.71 ggc.h
--- ggc.h 14 Mar 2005 13:10:51 -0000 1.71
+++ ggc.h 15 Apr 2005 19:31:26 -0000
@@ -313,15 +313,11 @@ extern struct alloc_zone tree_id_zone;
/* Allocate an object into the specified allocation zone. */
extern void *ggc_alloc_zone_stat (size_t, struct alloc_zone * MEM_STAT_DECL);
# define ggc_alloc_zone(s,z) ggc_alloc_zone_stat (s,z MEM_STAT_INFO)
-
+# define ggc_alloc_zone_pass_stat(s,z) ggc_alloc_zone_stat (s,z PASS_MEM_STAT)
#else
# define ggc_alloc_zone(s, z) ggc_alloc (s)
-# ifdef GATHER_STATISTICS
-# define ggc_alloc_zone_stat(s, z, n, l, f) ggc_alloc_stat (s, n, l, f)
-# else
-# define ggc_alloc_zone_stat(s, z) ggc_alloc_stat (s)
-# endif
+# define ggc_alloc_zone_pass_stat(s, z) ggc_alloc_stat (s PASS_MEM_STAT)
#endif
Index: rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.c,v
retrieving revision 1.152
diff -u -p -r1.152 rtl.c
--- rtl.c 13 Mar 2005 18:09:54 -0000 1.152
+++ rtl.c 15 Apr 2005 19:31:27 -0000
@@ -174,7 +174,7 @@ rtx_alloc_stat (RTX_CODE code MEM_STAT_D
{
rtx rt;
- rt = (rtx) ggc_alloc_zone_stat (RTX_SIZE (code), &rtl_zone PASS_MEM_STAT);
+ rt = (rtx) ggc_alloc_zone_pass_stat (RTX_SIZE (code), &rtl_zone);
/* We want to clear everything up to the FLD array. Normally, this
is one int, but we don't want to assume that and it isn't very
@@ -308,8 +308,8 @@ shallow_copy_rtx_stat (rtx orig MEM_STAT
{
rtx copy;
- copy = (rtx) ggc_alloc_zone_stat (RTX_SIZE (GET_CODE (orig)),
- &rtl_zone PASS_MEM_STAT);
+ copy = (rtx) ggc_alloc_zone_pass_stat (RTX_SIZE (GET_CODE (orig)),
+ &rtl_zone);
memcpy (copy, orig, RTX_SIZE (GET_CODE (orig)));
return copy;
}
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.468
diff -u -p -r1.468 tree.c
--- tree.c 13 Mar 2005 22:34:01 -0000 1.468
+++ tree.c 15 Apr 2005 19:31:28 -0000
@@ -342,9 +342,9 @@ make_node_stat (enum tree_code code MEM_
#endif
if (code == IDENTIFIER_NODE)
- t = ggc_alloc_zone_stat (length, &tree_id_zone PASS_MEM_STAT);
+ t = ggc_alloc_zone_pass_stat (length, &tree_id_zone);
else
- t = ggc_alloc_zone_stat (length, &tree_zone PASS_MEM_STAT);
+ t = ggc_alloc_zone_pass_stat (length, &tree_zone);
memset (t, 0, length);
@@ -428,7 +428,7 @@ copy_node_stat (tree node MEM_STAT_DECL)
gcc_assert (code != STATEMENT_LIST);
length = tree_size (node);
- t = ggc_alloc_zone_stat (length, &tree_zone PASS_MEM_STAT);
+ t = ggc_alloc_zone_pass_stat (length, &tree_zone);
memcpy (t, node, length);
TREE_CHAIN (t) = 0;
@@ -913,7 +913,7 @@ make_tree_binfo_stat (unsigned base_binf
tree_node_sizes[(int) binfo_kind] += length;
#endif
- t = ggc_alloc_zone_stat (length, &tree_zone PASS_MEM_STAT);
+ t = ggc_alloc_zone_pass_stat (length, &tree_zone);
memset (t, 0, offsetof (struct tree_binfo, base_binfos));
@@ -938,7 +938,7 @@ make_tree_vec_stat (int len MEM_STAT_DEC
tree_node_sizes[(int) vec_kind] += length;
#endif
- t = ggc_alloc_zone_stat (length, &tree_zone PASS_MEM_STAT);
+ t = ggc_alloc_zone_pass_stat (length, &tree_zone);
memset (t, 0, length);
@@ -1410,8 +1410,7 @@ tree_cons_stat (tree purpose, tree value
{
tree node;
- node = ggc_alloc_zone_stat (sizeof (struct tree_list),
- &tree_zone PASS_MEM_STAT);
+ node = ggc_alloc_zone_pass_stat (sizeof (struct tree_list), &tree_zone);
memset (node, 0, sizeof (struct tree_common));
@@ -2505,7 +2504,7 @@ build1_stat (enum tree_code code, tree t
gcc_assert (TREE_CODE_LENGTH (code) == 1);
- t = ggc_alloc_zone_stat (length, &tree_zone PASS_MEM_STAT);
+ t = ggc_alloc_zone_pass_stat (length, &tree_zone);
memset (t, 0, sizeof (struct tree_common));