This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Weird Code in parse.y (java_layout_seen_class_methods)
- From: Ranjit Mathew <rmathew at gmail dot com>
- To: Bryce McKinlay <mckinlay at redhat dot com>
- Cc: java at gcc dot gnu dot org
- Date: Tue, 15 Jun 2004 23:34:36 +0530
- Subject: Re: Weird Code in parse.y (java_layout_seen_class_methods)
- References: <ca9nvn$cmf$1@sea.gmane.org> <40CF1A44.3030903@redhat.com>
On Tue, 15 Jun 2004 11:48:20 -0400, Bryce McKinlay <mckinlay@redhat.com> wrote:
>
> Hi Ranjit,
>
> Ranjit Mathew wrote:
>
> > Consider the body of java_layout_seen_class_methods()
> >in parse.y:
> >-------------------------- 8< --------------------------
> > 7577 void java_layout_seen_class_methods (void)
> > 7578 {
> > 7579 tree previous_list = all_class_list;
> > 7580 tree end = NULL_TREE;
> > 7581 tree current;
> > 7582
> > 7583 while (1)
> > 7584 {
> > 7585 for (current = previous_list;
> > 7586 current != end; current = TREE_CHAIN (current))
> > 7587 layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
> > 7588
> > 7589 if (previous_list != all_class_list)
> > 7590 {
> > 7591 end = previous_list;
> > 7592 previous_list = all_class_list;
> > 7593 }
> > 7594 else
> > 7595 break;
> > 7596 }
> > 7597 }
> >-------------------------- 8< --------------------------
> >
> >How can code between 7590-7593 ever execute?
> >And why is there a while(1) around the for loop?
> >
> >Is this some vestigial code that should have been
> >removed?
> >
> >
>
> I suspect that layout_class_methods can end up adding things to
> all_class_list, because new classes may be added/resolved during method
> layout. This changes the value of all_class_list. The while(1) is
> presumably there so that the for-loop gets re-run on any new classes
> which appear in the list.
Aaahh! That makes sense. My bad.
Thanks a lot Bryce!
Ranjit