This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

--- 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,

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]