diff mbox

[C++] Fix GC ICEs with too long pending_templates list (PR c++/47833)

Message ID 20110222081718.GZ30899@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Feb. 22, 2011, 8:17 a.m. UTC
Hi!

Testcases for this are in the PR, but they are IMHO too slow to be put
into the testsuite.  The problem is that if there are many thousands
of pending templates in pending_template linked list, GC recurses on it
and therefore it may run out of stuck during GC.  Fixed by adding
chain_next GTY option, which will DTRT (instead of recursing on next
it will iterate through the list).
In decl.c I've noticed another candidate for such option, but
probably less urgent, so if you want I can take that out.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2011-02-22  Jakub Jelinek  <jakub@redhat.com>

	PR c++/47833
	* pt.c (struct pending_template): Add chain_next GTY option.
	* decl.c (struct named_label_use_entry): Likewise.


	Jakub

Comments

Jason Merrill Feb. 23, 2011, 12:15 a.m. UTC | #1
OK.

Jason
diff mbox

Patch

--- gcc/cp/pt.c.jj	2011-02-18 08:49:29.000000000 +0100
+++ gcc/cp/pt.c	2011-02-21 12:21:37.000000000 +0100
@@ -53,7 +53,7 @@  typedef int (*tree_fn_t) (tree, void*);
 /* The PENDING_TEMPLATES is a TREE_LIST of templates whose
    instantiations have been deferred, either because their definitions
    were not yet available, or because we were putting off doing the work.  */
-struct GTY (()) pending_template {
+struct GTY ((chain_next ("%h.next"))) pending_template {
   struct pending_template *next;
   struct tinst_level *tinst;
 };
--- gcc/cp/decl.c.jj	2011-02-15 15:42:18.000000000 +0100
+++ gcc/cp/decl.c	2011-02-21 12:08:25.000000000 +0100
@@ -178,7 +178,7 @@  tree integer_two_node;
 /* Used only for jumps to as-yet undefined labels, since jumps to
    defined labels can have their validity checked immediately.  */
 
-struct GTY(()) named_label_use_entry {
+struct GTY((chain_next ("%h.next"))) named_label_use_entry {
   struct named_label_use_entry *next;
   /* The binding level to which this entry is *currently* attached.
      This is initially the binding level in which the goto appeared,