public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC] Change last_annotated_node from tree to location_t *
@ 2005-08-02  0:26 Andrew Pinski
  2005-08-29  4:45 ` [PATCH] " Andrew Pinski
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2005-08-02  0:26 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

The problem here is that last_annotated_node keeps the full tree node 
in GC
which means that we can leak the whole function body and all the basic 
blocks
or the whole function tree depending on if the tree was in an unused 
static
function or in a function which goes though optimization.  This fixes 
the
problem by only keep tracking of the location_t instead.  This code 
would
go away when non USE_MAPPED_LOCATION mode goes away but that looks like
it is not going away for 4.1.0 which is sad.  The only thing blocking
USE_MAPPED_LOCATION now is the Ada front-end and has been for now 6 
months.

This was ___not___ bootstrapped as I don't have time right now and I
wanted to double check if this is the correct way to fix this problem.

Thanks,
Andrew Pinski

ChangeLog:

	* tree.c (last_annotated_node): Change type to location_t*.
	(annotate_with_file_line): Reflect the change of
	last_annotated_node type.



[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 1680 bytes --]

Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.498
diff -u -p -r1.498 tree.c
--- tree.c	28 Jul 2005 16:30:00 -0000	1.498
+++ tree.c	2 Aug 2005 00:14:41 -0000
@@ -3079,7 +3079,7 @@ build_block (tree vars, tree subblocks, 
 
 #if 1 /* ! defined(USE_MAPPED_LOCATION) */
 /* ??? gengtype doesn't handle conditionals */
-static GTY(()) tree last_annotated_node;
+static GTY(()) location_t *last_annotated_node;
 #endif
 
 #ifdef USE_MAPPED_LOCATION
@@ -3115,7 +3115,7 @@ annotate_with_file_line (tree node, cons
 	  || ! strcmp (EXPR_FILENAME (node), file))
       && EXPR_LINENO (node) == line)
     {
-      last_annotated_node = node;
+      last_annotated_node = EXPR_LOCUS (node);
       return;
     }
 
@@ -3123,19 +3123,18 @@ annotate_with_file_line (tree node, cons
      entry cache can reduce the number of allocations by more
      than half.  */
   if (last_annotated_node
-      && EXPR_LOCUS (last_annotated_node)
-      && (EXPR_FILENAME (last_annotated_node) == file
-	  || ! strcmp (EXPR_FILENAME (last_annotated_node), file))
-      && EXPR_LINENO (last_annotated_node) == line)
+      && (last_annotated_node->file == file
+	  || ! strcmp (last_annotated_node->file, file))
+      && last_annotated_node->line == line)
     {
-      SET_EXPR_LOCUS (node, EXPR_LOCUS (last_annotated_node));
+      SET_EXPR_LOCUS (node, last_annotated_node);
       return;
     }
 
   SET_EXPR_LOCUS (node, ggc_alloc (sizeof (location_t)));
   EXPR_LINENO (node) = line;
   EXPR_FILENAME (node) = file;
-  last_annotated_node = node;
+  last_annotated_node = EXPR_LOCUS (node);
 }
 
 void

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Change last_annotated_node from tree to location_t *
  2005-08-02  0:26 [RFC] Change last_annotated_node from tree to location_t * Andrew Pinski
@ 2005-08-29  4:45 ` Andrew Pinski
  2005-10-04 13:51   ` Geoff Keating
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2005-08-29  4:45 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]


On Aug 1, 2005, at 8:26 PM, Andrew Pinski wrote:

> The problem here is that last_annotated_node keeps the full tree node 
> in GC
> which means that we can leak the whole function body and all the basic 
> blocks
> or the whole function tree depending on if the tree was in an unused 
> static
> function or in a function which goes though optimization.  This fixes 
> the
> problem by only keep tracking of the location_t instead.  This code 
> would
> go away when non USE_MAPPED_LOCATION mode goes away but that looks like
> it is not going away for 4.1.0 which is sad.  The only thing blocking
> USE_MAPPED_LOCATION now is the Ada front-end and has been for now 6 
> months.

This has now been bootstrapped and tested on x86_64-linux-gnu
with no regressions? OK?

>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
>
> 	* tree.c (last_annotated_node): Change type to location_t*.
> 	(annotate_with_file_line): Reflect the change of
> 	last_annotated_node type.


[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 1680 bytes --]

Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.498
diff -u -p -r1.498 tree.c
--- tree.c	28 Jul 2005 16:30:00 -0000	1.498
+++ tree.c	2 Aug 2005 00:14:41 -0000
@@ -3079,7 +3079,7 @@ build_block (tree vars, tree subblocks, 
 
 #if 1 /* ! defined(USE_MAPPED_LOCATION) */
 /* ??? gengtype doesn't handle conditionals */
-static GTY(()) tree last_annotated_node;
+static GTY(()) location_t *last_annotated_node;
 #endif
 
 #ifdef USE_MAPPED_LOCATION
@@ -3115,7 +3115,7 @@ annotate_with_file_line (tree node, cons
 	  || ! strcmp (EXPR_FILENAME (node), file))
       && EXPR_LINENO (node) == line)
     {
-      last_annotated_node = node;
+      last_annotated_node = EXPR_LOCUS (node);
       return;
     }
 
@@ -3123,19 +3123,18 @@ annotate_with_file_line (tree node, cons
      entry cache can reduce the number of allocations by more
      than half.  */
   if (last_annotated_node
-      && EXPR_LOCUS (last_annotated_node)
-      && (EXPR_FILENAME (last_annotated_node) == file
-	  || ! strcmp (EXPR_FILENAME (last_annotated_node), file))
-      && EXPR_LINENO (last_annotated_node) == line)
+      && (last_annotated_node->file == file
+	  || ! strcmp (last_annotated_node->file, file))
+      && last_annotated_node->line == line)
     {
-      SET_EXPR_LOCUS (node, EXPR_LOCUS (last_annotated_node));
+      SET_EXPR_LOCUS (node, last_annotated_node);
       return;
     }
 
   SET_EXPR_LOCUS (node, ggc_alloc (sizeof (location_t)));
   EXPR_LINENO (node) = line;
   EXPR_FILENAME (node) = file;
-  last_annotated_node = node;
+  last_annotated_node = EXPR_LOCUS (node);
 }
 
 void

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re:[PATCH] Change last_annotated_node from tree to location_t *
  2005-08-29  4:45 ` [PATCH] " Andrew Pinski
@ 2005-10-04 13:51   ` Geoff Keating
  0 siblings, 0 replies; 3+ messages in thread
From: Geoff Keating @ 2005-10-04 13:51 UTC (permalink / raw)
  To: Andrew Pinski, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

>         * tree.c (last_annotated_node): Change type to location_t*.
>         (annotate_with_file_line): Reflect the change of
>         last_annotated_node type.

This is OK.

:REVIEWMAIL:


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2410 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-10-04 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-02  0:26 [RFC] Change last_annotated_node from tree to location_t * Andrew Pinski
2005-08-29  4:45 ` [PATCH] " Andrew Pinski
2005-10-04 13:51   ` Geoff Keating

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).