summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/ggc-common.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-05-09 20:02:13 +0000
committerobrien <obrien@FreeBSD.org>2002-05-09 20:02:13 +0000
commitc8f5fc7032940ad6633f932ac40cade82ec4d0cc (patch)
tree29a0f0a6c79a69ecc64f612947a0fe5904311713 /contrib/gcc/ggc-common.c
parentc9ab9ae440a8066b2c2b85b157b1fdadcf09916a (diff)
downloadFreeBSD-src-c8f5fc7032940ad6633f932ac40cade82ec4d0cc.zip
FreeBSD-src-c8f5fc7032940ad6633f932ac40cade82ec4d0cc.tar.gz
Gcc 3.1.0 pre-release from the FSF anoncvs repo on 9-May-2002 15:57:15 EDT.
Diffstat (limited to 'contrib/gcc/ggc-common.c')
-rw-r--r--contrib/gcc/ggc-common.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/contrib/gcc/ggc-common.c b/contrib/gcc/ggc-common.c
index 77614ff..b0676b2 100644
--- a/contrib/gcc/ggc-common.c
+++ b/contrib/gcc/ggc-common.c
@@ -43,6 +43,7 @@ void (*lang_mark_false_label_stack) PARAMS ((struct label_node *));
/* Trees that have been marked, but whose children still need marking. */
varray_type ggc_pending_trees;
+static void ggc_mark_rtx_children_1 PARAMS ((rtx));
static void ggc_mark_rtx_ptr PARAMS ((void *));
static void ggc_mark_tree_ptr PARAMS ((void *));
static void ggc_mark_rtx_varray_ptr PARAMS ((void *));
@@ -277,6 +278,43 @@ void
ggc_mark_rtx_children (r)
rtx r;
{
+ rtx i, last;
+
+ /* Special case the instruction chain. This is a data structure whose
+ chain length is potentially unbounded, and which contain references
+ within the chain (e.g. label_ref and insn_list). If do nothing here,
+ we risk blowing the stack recursing through a long chain of insns.
+
+ Combat this by marking all of the instructions in the chain before
+ marking the contents of those instructions. */
+
+ switch (GET_CODE (r))
+ {
+ case INSN:
+ case JUMP_INSN:
+ case CALL_INSN:
+ case NOTE:
+ case CODE_LABEL:
+ case BARRIER:
+ for (i = NEXT_INSN (r); ; i = NEXT_INSN (i))
+ if (! ggc_test_and_set_mark (i))
+ break;
+ last = i;
+
+ for (i = NEXT_INSN (r); i != last; i = NEXT_INSN (i))
+ ggc_mark_rtx_children_1 (i);
+
+ default:
+ break;
+ }
+
+ ggc_mark_rtx_children_1 (r);
+}
+
+static void
+ggc_mark_rtx_children_1 (r)
+ rtx r;
+{
const char *fmt;
int i;
rtx next_rtx;
OpenPOWER on IntegriCloud