aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorAlexandre Petit-Bianco <apbianco@cygnus.com>1999-03-23 11:20:03 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>1999-03-23 03:20:03 -0800
commitde0b553f86bcb8075ed37ba0529c153a4ade45e5 (patch)
tree6b7b5a8551a6f4c0b7c2122d941ba491f83fd1ac /gcc/java
parentbdeb987972a871db073eec013477400e188ead31 (diff)
downloadgcc-de0b553f86bcb8075ed37ba0529c153a4ade45e5.zip
gcc-de0b553f86bcb8075ed37ba0529c153a4ade45e5.tar.gz
gcc-de0b553f86bcb8075ed37ba0529c153a4ade45e5.tar.bz2
parse.y (find_applicable_accessible_methods_list): When dealing with interface...
Tue Mar 23 10:48:24 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> * parse.y (find_applicable_accessible_methods_list): When dealing with interface: ensure that a given interface or java.lang.Object are searched only once. From-SVN: r25925
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/parse.c43
-rw-r--r--gcc/java/parse.y37
3 files changed, 75 insertions, 11 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index e03ee3e..917b403 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+Tue Mar 23 10:48:24 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
+
+ * parse.y (find_applicable_accessible_methods_list): When dealing
+ with interface: ensure that a given interface or java.lang.Object
+ are searched only once.
+
Tue Mar 23 10:05:27 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gjavah.c (print_c_decl): Remove unused argument `flags'.
diff --git a/gcc/java/parse.c b/gcc/java/parse.c
index 4c6c384..d8e3583 100644
--- a/gcc/java/parse.c
+++ b/gcc/java/parse.c
@@ -2222,7 +2222,7 @@ static const short yycheck[] = { 3,
#define YYPURE 1
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/local/gnu/share/bison.simple"
+#line 3 "/usr/lib/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -2415,7 +2415,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif
#endif
-#line 196 "/usr/local/gnu/share/bison.simple"
+#line 196 "/usr/lib/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
@@ -4680,7 +4680,7 @@ case 493:
break;}
}
/* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/local/gnu/share/bison.simple"
+#line 498 "/usr/lib/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
@@ -9771,20 +9771,49 @@ find_applicable_accessible_methods_list (lc, class, name, arglist)
/* Search interfaces */
if (CLASS_INTERFACE (TYPE_NAME (class)))
{
+ static tree searched_interfaces = NULL_TREE;
+ static int search_not_done = 0;
int i, n;
tree basetype_vec = TYPE_BINFO_BASETYPES (class);
+ /* Have we searched this interface already? */
+ if (searched_interfaces)
+ {
+ tree current;
+ for (current = searched_interfaces;
+ current; current = TREE_CHAIN (current))
+ if (TREE_VALUE (current) == class)
+ return NULL;
+ }
+ searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces);
+
search_applicable_methods_list
(lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
n = TREE_VEC_LENGTH (basetype_vec);
for (i = 0; i < n; i++)
{
- tree rlist =
- find_applicable_accessible_methods_list
- (lc, BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)),
- name, arglist);
+ tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
+ tree rlist;
+
+ /* Skip java.lang.Object (we'll search it once later.) */
+ if (t == object_type_node)
+ continue;
+
+ search_not_done++;
+ rlist = find_applicable_accessible_methods_list (lc, t, name,
+ arglist);
all_list = chainon (rlist, (list ? list : all_list));
+ search_not_done--;
+ }
+
+ /* We're done. Reset the searched interfaces list and finally search
+ java.lang.Object */
+ if (!search_not_done)
+ {
+ searched_interfaces = NULL_TREE;
+ search_applicable_methods_list (lc, TYPE_METHODS (object_type_node),
+ name, arglist, &list, &all_list);
}
}
/* Search classes */
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index f06ee9f..1665f56 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -7170,20 +7170,49 @@ find_applicable_accessible_methods_list (lc, class, name, arglist)
/* Search interfaces */
if (CLASS_INTERFACE (TYPE_NAME (class)))
{
+ static tree searched_interfaces = NULL_TREE;
+ static int search_not_done = 0;
int i, n;
tree basetype_vec = TYPE_BINFO_BASETYPES (class);
+ /* Have we searched this interface already? */
+ if (searched_interfaces)
+ {
+ tree current;
+ for (current = searched_interfaces;
+ current; current = TREE_CHAIN (current))
+ if (TREE_VALUE (current) == class)
+ return NULL;
+ }
+ searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces);
+
search_applicable_methods_list
(lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
n = TREE_VEC_LENGTH (basetype_vec);
for (i = 0; i < n; i++)
{
- tree rlist =
- find_applicable_accessible_methods_list
- (lc, BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)),
- name, arglist);
+ tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
+ tree rlist;
+
+ /* Skip java.lang.Object (we'll search it once later.) */
+ if (t == object_type_node)
+ continue;
+
+ search_not_done++;
+ rlist = find_applicable_accessible_methods_list (lc, t, name,
+ arglist);
all_list = chainon (rlist, (list ? list : all_list));
+ search_not_done--;
+ }
+
+ /* We're done. Reset the searched interfaces list and finally search
+ java.lang.Object */
+ if (!search_not_done)
+ {
+ searched_interfaces = NULL_TREE;
+ search_applicable_methods_list (lc, TYPE_METHODS (object_type_node),
+ name, arglist, &list, &all_list);
}
}
/* Search classes */