aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-09-03 14:38:26 -0700
committerRichard Henderson <rth@gcc.gnu.org>2003-09-03 14:38:26 -0700
commit19a42e516f876e78ab61058534b2412001c98011 (patch)
tree3be2952d521d73dc3b8243747eea71f92e8997eb
parent7dff32e6609b500f53edeb897c993b60e5e59743 (diff)
downloadgcc-19a42e516f876e78ab61058534b2412001c98011.zip
gcc-19a42e516f876e78ab61058534b2412001c98011.tar.gz
gcc-19a42e516f876e78ab61058534b2412001c98011.tar.bz2
optimize.c (optimize_function): Push/pop ggc context around the call to optimize_inline_calls.
* optimize.c (optimize_function): Push/pop ggc context around the call to optimize_inline_calls. From-SVN: r71034
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/optimize.c23
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fbee4d6..4c9a0dae 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-03 Richard Henderson <rth@redhat.com>
+
+ * optimize.c (optimize_function): Push/pop ggc context around
+ the call to optimize_inline_calls.
+
2003-09-02 Scott Brumbaugh <scottb.lists@verizon.net>
PR c++/11553
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 8c604e3..7be410e 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -56,7 +56,30 @@ optimize_function (tree fn)
and (d) TARGET_ASM_OUTPUT_MI_THUNK is there to DTRT anyway. */
&& !DECL_THUNK_P (fn))
{
+ /* ??? Work around GC problem. Call stack is
+
+ -> instantiate_decl
+ -> expand_or_defer_fn
+ -> maybe_clone_body
+ -> expand_body
+ -> tree_rest_of_compilation
+
+ which of course collects. This used to be protected by the
+ "regular" nested call ggc_push_context that now lives in
+ tree_rest_of_compilation.
+
+ Two good fixes:
+ (1) Do inlining in tree_rest_of_compilation. This is good
+ in that this common optimization happens in common code.
+ (2) Don't nest compilation of functions. Instead queue the
+ new function to cgraph, and let it get picked up in the
+ next round of "emit everything that needs emitting".
+
+ For the nonce, just protect things here. */
+
+ ggc_push_context ();
optimize_inline_calls (fn);
+ ggc_pop_context ();
dump_function (TDI_inlined, fn);
}