This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] delay garbage collection when -fdump-translation-unit flag is used
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH] delay garbage collection when -fdump-translation-unit flag is used
- From: Devang Patel <dpatel at apple dot com>
- Date: Mon, 7 May 2001 10:40:13 -0700
Description:
Function body is allowed to be garbage collected after RTL is
generated for the function. If the dump-translation-unit flag
is used, function body is not available at later stage during
translation unit dump. This patch fixes the problem by delaying
the garbage collection until the function body is dumped
(only if -fdump-translation-unit flag is used).
Successfully, bootstrapped on powerpc-apple-darwin
Devang
2001-05-07 Devang Patel <dpatel@apple.com>
* gcc/c-decl.c (c_expand_body): Delay garbase collection until the
tree is
dumped (when -fdump-translation-unit flag is used).
* gcc/c-dump.c (dequeue_and_dump): Garbage collect the saved tree.
Index: gcc/c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.207.2.8
diff -c -3 -p -r1.207.2.8 c-decl.c
*** c-decl.c 2001/05/01 00:09:48 1.207.2.8
--- c-decl.c 2001/05/07 17:25:33
*************** c_expand_body (fndecl, nested_p)
*** 6718,6725 ****
/* Generate the RTL for this function. */
expand_stmt (DECL_SAVED_TREE (fndecl));
/* Allow the body of the function to be garbage collected. */
! DECL_SAVED_TREE (fndecl) = NULL_TREE;
/* We hard-wired immediate_size_expand to zero in start_function.
expand_function_end will decrement this variable. So, we set the
--- 6718,6727 ----
/* Generate the RTL for this function. */
expand_stmt (DECL_SAVED_TREE (fndecl));
+
/* Allow the body of the function to be garbage collected. */
! if (!flag_dump_translation_unit)
! DECL_SAVED_TREE (fndecl) = NULL_TREE;
/* We hard-wired immediate_size_expand to zero in start_function.
expand_function_end will decrement this variable. So, we set the
Index: gcc/c-dump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-dump.c,v
retrieving revision 1.2.4.1
diff -c -3 -p -r1.2.4.1 c-dump.c
*** c-dump.c 2001/04/16 00:31:44 1.2.4.1
--- c-dump.c 2001/05/07 17:25:34
*************** dequeue_and_dump (di)
*** 505,511 ****
else
dump_string (di, "static");
if (DECL_LANG_SPECIFIC (t))
! dump_child ("body", DECL_SAVED_TREE (t));
break;
case ASM_STMT:
--- 505,515 ----
else
dump_string (di, "static");
if (DECL_LANG_SPECIFIC (t))
! {
! dump_child ("body", DECL_SAVED_TREE (t));
! /* Garbage collect language specific saved_tree */
! DECL_SAVED_TREE (t) = NULL_TREE;
! }
break;