spew.c (pending_inlines, [...]): Make static.

* spew.c (pending_inlines, pending_inlines_tail,
	processing_these_inlines): Make static.
	(mark_pending_inlines): Remove static.
	(begin_parsing_inclass_inline): If in function, save pi
	for GC to cp_function_chain->unparsed_inlines instead.
	(process_next_inline): Likewise.
	* cp-tree.h (struct cp_language_function): Add unparsed_inlines.
	(mark_pending_inlines): Add prototype.
	* decl.c (spew_debug): Remove unused extern.
	(mark_lang_function): Call mark_pending_inlines.

	* g++.dg/other/gc1.C: New test.

From-SVN: r49147
This commit is contained in:
Jakub Jelinek 2002-01-23 19:52:08 +01:00 committed by Jakub Jelinek
parent 1398974cb3
commit 0a01c261ff
6 changed files with 84 additions and 14 deletions

View File

@ -1,3 +1,16 @@
2002-01-23 Jakub Jelinek <jakub@redhat.com>
* spew.c (pending_inlines, pending_inlines_tail,
processing_these_inlines): Make static.
(mark_pending_inlines): Remove static.
(begin_parsing_inclass_inline): If in function, save pi
for GC to cp_function_chain->unparsed_inlines instead.
(process_next_inline): Likewise.
* cp-tree.h (struct cp_language_function): Add unparsed_inlines.
(mark_pending_inlines): Add prototype.
* decl.c (spew_debug): Remove unused extern.
(mark_lang_function): Call mark_pending_inlines.
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,

View File

@ -801,6 +801,8 @@ struct saved_scope
extern struct saved_scope *scope_chain;
struct unparsed_text;
/* Global state pertinent to the current function. */
struct cp_language_function
@ -828,6 +830,7 @@ struct cp_language_function
varray_type x_local_names;
const char *cannot_inline;
struct unparsed_text *unparsed_inlines;
};
/* The current C++-specific per-function global variables. */
@ -1781,8 +1784,6 @@ struct lang_decl_flags
} u2;
};
struct unparsed_text;
struct lang_decl
{
struct lang_decl_flags decl_flags;
@ -4193,6 +4194,7 @@ extern tree finish_global_stmt_expr PARAMS ((tree));
/* in spew.c */
extern void init_spew PARAMS ((void));
extern void mark_pending_inlines PARAMS ((PTR));
extern int peekyylex PARAMS ((void));
extern tree arbitrate_lookup PARAMS ((tree, tree, tree));
extern tree frob_opname PARAMS ((tree));

View File

@ -288,10 +288,6 @@ extern int flag_conserve_space;
/* C and C++ flags are in decl2.c. */
/* Flag used when debugging spew.c */
extern int spew_debug;
/* A expression of value 0 with the same precision as a sizetype
node, but signed. */
tree signed_size_zero_node;
@ -14607,6 +14603,7 @@ mark_lang_function (p)
mark_named_label_lists (&p->x_named_labels, &p->x_named_label_uses);
mark_binding_level (&p->bindings);
mark_pending_inlines (&p->unparsed_inlines);
}
/* Mark the language-specific data in F for GC. */

View File

@ -119,15 +119,14 @@ static int frob_id PARAMS ((int, int, tree *));
/* The list of inline functions being held off until we reach the end of
the current class declaration. */
struct unparsed_text *pending_inlines;
struct unparsed_text *pending_inlines_tail;
static struct unparsed_text *pending_inlines;
static struct unparsed_text *pending_inlines_tail;
/* The list of previously-deferred inline functions currently being parsed.
This exists solely to be a GC root. */
struct unparsed_text *processing_these_inlines;
static struct unparsed_text *processing_these_inlines;
static void begin_parsing_inclass_inline PARAMS ((struct unparsed_text *));
static void mark_pending_inlines PARAMS ((PTR));
#ifdef SPEW_DEBUG
int spew_debug = 0;
@ -416,7 +415,7 @@ end_input ()
}
/* GC callback to mark memory pointed to by the pending inline queue. */
static void
void
mark_pending_inlines (pi)
PTR pi;
{
@ -950,8 +949,11 @@ begin_parsing_inclass_inline (pi)
tree context;
/* Record that we are processing the chain of inlines starting at
PI in a special GC root. */
processing_these_inlines = pi;
PI for GC. */
if (cfun)
cp_function_chain->unparsed_inlines = pi;
else
processing_these_inlines = pi;
ggc_collect ();
@ -1025,7 +1027,10 @@ process_next_inline (i)
begin_parsing_inclass_inline (i);
else
{
processing_these_inlines = 0;
if (cfun)
cp_function_chain->unparsed_inlines = 0;
else
processing_these_inlines = 0;
extract_interface_info ();
}
}

View File

@ -1,3 +1,7 @@
2002-01-23 Jakub Jelinek <jakub@redhat.com>
* g++.dg/other/gc1.C: New test.
2002-01-23 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/c99-intconst-1.c: Mark XFAIL.

View File

@ -0,0 +1,49 @@
// This test failed with GGC_ALWAYS_COLLECT because not all unparsed
// inline methods were registered with GC.
// { dg-do compile }
const char *foo ()
{
struct A
{
const char *a1 ()
{
return "a1";
}
const char *a2 ()
{
struct B
{
const char *b1 ()
{
return "b1";
}
const char *b2 ()
{
struct C
{
const char *c1 ()
{
return "c1";
}
const char *c2 ()
{
return "c2";
}
};
return "b2";
}
const char *b3 ()
{
return "b3";
}
};
return "a2";
}
const char *a3 ()
{
return "a3";
}
};
return "foo";
}