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 1/4] Fix string pool statistics.


On 11/5/18 10:52 AM, Richard Biener wrote:
> On Mon, Nov 5, 2018 at 9:07 AM marxin <mliska@suse.cz> wrote:
>>
>>
>> libcpp/ChangeLog:
> 
> Hmm, the patch suggests the flag might be instead
> part of cpp_hash_table instead of each individual
> ht_identifier?  Or the patch is confused when it
> sets HT_GGC to 1 even in
> 
>    else
> -    HT_STR (node) = (const unsigned char *) obstack_copy0 (&table->stack,
> -                                                          str, len);
> +    {
> +      HT_STR (node) = (const unsigned char *) obstack_copy0 (&table->stack,
> +                                                            str, len);
> +      HT_GGC (node) = 1;
> +    }
> 
> ?  Do we really support mixed operation here?

No, simplified in attached patch.

Martin

> 
>> 2018-11-02  Martin Liska  <mliska@suse.cz>
>>
>>         * include/symtab.h (ht_identifier):
>>         Make room for ggc flag.
>>         * symtab.c (ht_lookup_with_hash): Mark
>>         GGC and non-GGC allocated strings.
>>         (ht_dump_statistics): Use the information.
>> ---
>>  libcpp/include/symtab.h |  4 +++-
>>  libcpp/symtab.c         | 28 +++++++++++++++++++---------
>>  2 files changed, 22 insertions(+), 10 deletions(-)
>>
>From d615abbe29f0c99801de27533ec69ec63991bf8e Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 2 Nov 2018 10:51:23 +0100
Subject: [PATCH 1/4] Fix string pool statistics.

libcpp/ChangeLog:

2018-11-05  Martin Liska  <mliska@suse.cz>

	* symtab.c (ht_dump_statistics): Make dump conditional
	based on alloc_subobject.
---
 libcpp/symtab.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/libcpp/symtab.c b/libcpp/symtab.c
index fd86c849f7f..e6e5bcb1cef 100644
--- a/libcpp/symtab.c
+++ b/libcpp/symtab.c
@@ -304,7 +304,6 @@ ht_dump_statistics (cpp_hash_table *table)
   while (++p < limit);
 
   nelts = table->nelements;
-  overhead = obstack_memory_used (&table->stack) - total_bytes;
   headers = table->nslots * sizeof (hashnode);
 
   fprintf (stderr, "\nString pool\nentries\t\t%lu\n",
@@ -315,9 +314,16 @@ ht_dump_statistics (cpp_hash_table *table)
 	   (unsigned long) table->nslots);
   fprintf (stderr, "deleted\t\t%lu\n",
 	   (unsigned long) deleted);
-  fprintf (stderr, "bytes\t\t%lu%c (%lu%c overhead)\n",
-	   SCALE (total_bytes), LABEL (total_bytes),
-	   SCALE (overhead), LABEL (overhead));
+
+  if (table->alloc_subobject)
+    fprintf (stderr, "GGC bytes\t%lu%c\n",
+	     SCALE (total_bytes), LABEL (total_bytes));
+  else
+    {
+      overhead = obstack_memory_used (&table->stack) - total_bytes;
+      fprintf (stderr, "obstack bytes\t%lu%c (%lu%c overhead)\n",
+	       SCALE (total_bytes), LABEL (total_bytes));
+    }
   fprintf (stderr, "table size\t%lu%c\n",
 	   SCALE (headers), LABEL (headers));
 
-- 
2.19.1


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