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


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

java/parse.y patch removing


(This is logically three changes, but I'm being lazy ...)
I've checked this into the trunnk, and will check it into the
gcc3 branch.

The removal of obtain_incomplete_type is the only one that fixes an
actual bug.  In general, I think the implementation of name->class
resolution is overly complicated.  Worse, it appears that it is too
eager - it should not bother resolving names inside classes we are not
generating code for, except for names that define the method and
field types we need (plus inlined constants and methods).

2001-03-17  Per Bothner  <per@bothner.com>

	* parse.h (JDEP_SOLV):  Removed.
	* parse.y (incomplete_class_list):  Removed.
	(register_incomplete_type):  Use JDEP_TO_RESOLVE instead of JDEP_SOLV.

	* parse.y (obtain_incomplete_type): Removed.  It doesn't work if
	resolve_class changes the name of an array type that is on the list
	and then someone else looks for the modified name.  Also, seems liable
	to break when compiling multiple source files at once.  So the simplest
	is to just remove incomplete_class_list - it is only a minor
	space win and it is not even clear it saves time.

	* parse.y (resolve_class):  Remove unneeded promote_type.

Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.93
diff -u -r1.93 decl.c
--- decl.c	2001/03/16 05:31:51	1.93
+++ decl.c	2001/03/17 20:15:50
@@ -311,7 +311,7 @@
 
 static struct binding_level clear_binding_level
   = {NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE,
-       NULL_BINDING_LEVEL, 0, LARGEST_PC};
+       NULL_BINDING_LEVEL, LARGEST_PC, 0};
 
 #if 0
 /* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function
Index: parse.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.h,v
retrieving revision 1.66
diff -u -r1.66 parse.h
--- parse.h	2001/03/16 06:30:27	1.66
+++ parse.h	2001/03/17 20:15:51
@@ -494,7 +494,6 @@
 #define JDEP_DECL(J)          ((J)->decl)
 #define JDEP_DECL_WFL(J)      ((J)->decl)
 #define JDEP_KIND(J)          ((J)->kind)
-#define JDEP_SOLV(J)          ((J)->solv)
 #define JDEP_WFL(J)           ((J)->wfl)
 #define JDEP_MISC(J)          ((J)->misc)
 #define JDEP_ENCLOSING(J)     ((J)->enclosing)
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.261
diff -u -r1.261 parse.y
--- parse.y	2001/03/16 06:30:27	1.261
+++ parse.y	2001/03/17 20:16:00
@@ -409,14 +409,11 @@
    the list of the catch clauses of the currently analysed try block. */
 static tree currently_caught_type_list;
 
-static tree src_parse_roots[2] = { NULL_TREE, NULL_TREE };
+static tree src_parse_roots[1] = { NULL_TREE };
 
 /* All classes seen from source code */
 #define gclass_list src_parse_roots[0]
 
-/* List of non-complete classes */
-#define incomplete_class_list src_parse_roots[1]
-
 /* Check modifiers. If one doesn't fit, retrieve it in its declaration
    line and point it out.  */
 /* Should point out the one that don't fit. ASCII/unicode, going
@@ -4979,7 +4976,7 @@
 obtain_incomplete_type (type_name)
      tree type_name;
 {
-  tree ptr, name;
+  tree ptr = NULL_TREE, name;
 
   if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION)
     name = EXPR_WFL_NODE (type_name);
@@ -4987,18 +4984,9 @@
     name = TYPE_NAME (type_name);
   else
     abort ();
-
-  for (ptr = incomplete_class_list; ptr; ptr = TREE_CHAIN (ptr))
-    if (TYPE_NAME (ptr) == name)
-      break;
 
-  if (!ptr)
-    {
-      BUILD_PTR_FROM_NAME (ptr, name);
-      layout_type (ptr);
-      TREE_CHAIN (ptr) = incomplete_class_list;
-      incomplete_class_list = ptr;
-    }
+  BUILD_PTR_FROM_NAME (ptr, name);
+  layout_type (ptr);
 
   return ptr;
 }
@@ -5020,7 +5008,7 @@
 
   JDEP_KIND (new) = kind;
   JDEP_DECL (new) = decl;
-  JDEP_SOLV (new) = ptr;
+  JDEP_TO_RESOLVE (new) = ptr;
   JDEP_WFL (new) = wfl;
   JDEP_CHAIN (new) = NULL;
   JDEP_MISC (new) = NULL_TREE;
@@ -5476,8 +5464,6 @@
     {
       while (base != name)
 	{
-	  if (TREE_CODE (resolved_type) == RECORD_TYPE)
-	    resolved_type  = promote_type (resolved_type);
 	  resolved_type = build_java_array_type (resolved_type, -1);
 	  CLASS_LOADED_P (resolved_type) = 1;
 	  name--;
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/


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