PATCH: java.util.Collections and java.util.Vector

Alexandre Petit-Bianco apbianco@cygnus.com
Wed Nov 22 16:14:00 GMT 2000


Bryce McKinlay writes:

> I am confident that AbstractList/ArrayList/LinkedList/Vector are now
> pretty good implementations - the only known problems with them are
> due to inner class miscompilation bugs ;-(

If you're talking about gcj/367, I believe this patch fixes it. I was
just working on it and I'm thoroughly testing it as I speak.

With this, gcj/367's testcase prints `two'. I've been debugging calls
to LinkedList.add and ListIterator.{next,remove} and they all seem to
behave rationally.

./A

Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.229
diff -u -p -r1.229 parse.y
--- parse.y	2000/11/22 05:25:15	1.229
+++ parse.y	2000/11/23 00:10:45
@@ -7841,7 +7841,8 @@ build_outer_field_access (id, decl)
   /* If decl's class is the direct outer class of the current_class,
      build the access as `this$<n>.<field>'. Note that we will break
      the `private' barrier if we're not emitting bytecodes. */
-  if (ctx == DECL_CONTEXT (decl) 
+  if ((ctx == DECL_CONTEXT (decl)
+       || inherits_from_p (ctx, DECL_CONTEXT (decl)))
       && (!FIELD_PRIVATE (decl) || !flag_emit_class_files ))
     {
       tree thisn = build_current_thisn (current_class);
@@ -7899,7 +7900,11 @@ outer_field_access_p (type, decl)
       if (type == DECL_CONTEXT (decl))
 	return 1;
       if (!DECL_CONTEXT (TYPE_NAME (type)))
-	break;
+        {
+	  if (inherits_from_p (type, DECL_CONTEXT (decl)))
+	    return 1;
+	  break;
+         }
     }
 
   return 0;
@@ -8221,8 +8226,13 @@ build_access_to_thisn (from, to, lc)
 	  access = build_method_invocation (access0_wfl, access);
 	  access = make_qualified_primary (cn, access, lc);
 	}
-      
-      from = TREE_TYPE (DECL_CONTEXT (TYPE_NAME (from)));
+
+      /* if FROM isn't an inter class, that's fine, we've done
+         enough. What we're looking for can be accessed from there. */
+      from = DECL_CONTEXT (TYPE_NAME (from));
+      if (!from)
+	break;
+      from = TREE_TYPE (from);
     }
   return access;
 }


More information about the Java-patches mailing list