This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: needless deep recursion in gt-c-decl.h
Geoff Keating wrote:
Just insert the loop by hand after the file is generated, then re-run
make.
Using a single loop does appear to solve the problem.
I kludged the Makefile.in to apply the appended patch,
and the compiler made it all the way to building libjava.
There it failed running cc1plus on a .cc file in libjava.
It was the same basic failure, recursing on TREE_CHAIN,
but this time in gtype-cp.h, which I had not patched.
I haven't verified whether the equivalent fix would
work in gtype-cp.h, but I'm guessing so.
So I think we should definitely fix the code that generates
gt-c-decl.h and gtype-cp.h. I can do it if you tell me to
do it.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
--- gt-c-decl.h~ Thu Jul 25 12:42:10 2002
+++ gt-c-decl.h Thu Jul 25 12:45:22 2002
@@ -42,6 +42,8 @@
void *x_p;
{
union lang_tree_node * const x = (union lang_tree_node *)x_p;
+ for(;;)
+ {
if (! ggc_test_and_set_mark (x))
return;
{
@@ -50,44 +52,36 @@
{
unsigned int tag2 = (tree_node_structure (&((*x).generic)));
if (tag2 == (TS_COMMON)) {
- gt_ggc_m_tree_node ((*x).generic.common.chain);
gt_ggc_m_tree_node ((*x).generic.common.type);
}
if (tag2 == (TS_INT_CST)) {
- gt_ggc_m_tree_node ((*x).generic.int_cst.common.chain);
gt_ggc_m_tree_node ((*x).generic.int_cst.common.type);
gt_ggc_m_rtx_def ((*x).generic.int_cst.rtl);
}
if (tag2 == (TS_REAL_CST)) {
- gt_ggc_m_tree_node ((*x).generic.real_cst.common.chain);
gt_ggc_m_tree_node ((*x).generic.real_cst.common.type);
gt_ggc_m_rtx_def ((*x).generic.real_cst.rtl);
gt_ggc_m_realvaluetype ((*x).generic.real_cst.real_cst_ptr);
}
if (tag2 == (TS_VECTOR)) {
- gt_ggc_m_tree_node ((*x).generic.vector.common.chain);
gt_ggc_m_tree_node ((*x).generic.vector.common.type);
gt_ggc_m_rtx_def ((*x).generic.vector.rtl);
gt_ggc_m_tree_node ((*x).generic.vector.elements);
}
if (tag2 == (TS_STRING)) {
- gt_ggc_m_tree_node ((*x).generic.string.common.chain);
gt_ggc_m_tree_node ((*x).generic.string.common.type);
gt_ggc_m_rtx_def ((*x).generic.string.rtl);
}
if (tag2 == (TS_COMPLEX)) {
- gt_ggc_m_tree_node ((*x).generic.complex.common.chain);
gt_ggc_m_tree_node ((*x).generic.complex.common.type);
gt_ggc_m_rtx_def ((*x).generic.complex.rtl);
gt_ggc_m_tree_node ((*x).generic.complex.real);
gt_ggc_m_tree_node ((*x).generic.complex.imag);
}
if (tag2 == (TS_IDENTIFIER)) {
- gt_ggc_m_tree_node ((*x).generic.identifier.common.chain);
gt_ggc_m_tree_node ((*x).generic.identifier.common.type);
}
if (tag2 == (TS_DECL)) {
- gt_ggc_m_tree_node ((*x).generic.decl.common.chain);
gt_ggc_m_tree_node ((*x).generic.decl.common.type);
gt_ggc_m_tree_node ((*x).generic.decl.size);
gt_ggc_m_tree_node ((*x).generic.decl.size_unit);
@@ -120,7 +114,6 @@
gt_ggc_m_lang_decl ((*x).generic.decl.lang_specific);
}
if (tag2 == (TS_TYPE)) {
- gt_ggc_m_tree_node ((*x).generic.type.common.chain);
gt_ggc_m_tree_node ((*x).generic.type.common.type);
gt_ggc_m_tree_node ((*x).generic.type.values);
gt_ggc_m_tree_node ((*x).generic.type.size);
@@ -143,13 +136,11 @@
gt_ggc_m_lang_type ((*x).generic.type.lang_specific);
}
if (tag2 == (TS_LIST)) {
- gt_ggc_m_tree_node ((*x).generic.list.common.chain);
gt_ggc_m_tree_node ((*x).generic.list.common.type);
gt_ggc_m_tree_node ((*x).generic.list.purpose);
gt_ggc_m_tree_node ((*x).generic.list.value);
}
if (tag2 == (TS_VEC)) {
- gt_ggc_m_tree_node ((*x).generic.vec.common.chain);
gt_ggc_m_tree_node ((*x).generic.vec.common.type);
{
size_t i5_0;
@@ -160,7 +151,6 @@
}
}
if (tag2 == (TS_EXP)) {
- gt_ggc_m_tree_node ((*x).generic.exp.common.chain);
gt_ggc_m_tree_node ((*x).generic.exp.common.type);
{
const size_t tree_exp_size = (TREE_CODE_LENGTH (TREE_CODE ((tree) &((*x).generic.exp))));
@@ -174,7 +164,6 @@
}
}
if (tag2 == (TS_BLOCK)) {
- gt_ggc_m_tree_node ((*x).generic.block.common.chain);
gt_ggc_m_tree_node ((*x).generic.block.common.type);
gt_ggc_m_tree_node ((*x).generic.block.vars);
gt_ggc_m_tree_node ((*x).generic.block.subblocks);
@@ -186,7 +175,6 @@
}
}
if (tag1 == (1)) {
- gt_ggc_m_tree_node ((*x).identifier.common_id.common.chain);
gt_ggc_m_tree_node ((*x).identifier.common_id.common.type);
gt_ggc_m_tree_node ((*x).identifier.global_value);
gt_ggc_m_tree_node ((*x).identifier.local_value);
@@ -196,6 +184,11 @@
gt_ggc_m_tree_node ((*x).identifier.limbo_value);
}
}
+ x = (*x).identifier.common_id.common.chain;
+ if (x == NULL_TREE)
+ break;
+
+ }
}
void