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]
Other format: [Raw text]

Binary Compatibility: a couple of bug fixes


This brings the gcj-abi-2-dev-branch into the same "zero failures"
status as mainline.  (Or, at least before mainline was broken...)

In fact, it's a bit better than mainline because we now have some
XPASSes:

XPASS: Where -findirect-dispatch  compilation from source
XPASS: Where -findirect-dispatch -O3 compilation from source

Andrew.


2004-06-22  Andrew Haley  <aph@redhat.com>

        * class.c (gen_indirect_dispatch_tables): Set the DECL_OWNER of
        the otable.
        * check-init.c (get_variable_decl): Teach check-init about
        FIELD_DECLs addressed via the otable.
        * jcf-parse.c (load_class): Check CLASS_LOADED_P, not
        CLASS_PARSED_P.

Index: check-init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/check-init.c,v
retrieving revision 1.53.16.1
diff -p -2 -c -r1.53.16.1 check-init.c
*** check-init.c	20 May 2004 23:32:49 -0000	1.53.16.1
--- check-init.c	22 Jun 2004 17:53:56 -0000
*************** get_variable_decl (tree exp)
*** 192,195 ****
--- 192,239 ----
  	}
      }
+   else if (TREE_CODE (exp) == INDIRECT_REF)
+     {
+       /* For indirect dispatch, look for an expression of the form 
+       (indirect_ref (+ (array_ref otable <N>) this)).  
+       FIXME: it would probably be better to generate a JAVA_FIELD_REF
+       expression that gets converted to OTABLE access at
+       gimplification time.  */
+       exp = TREE_OPERAND (exp, 0);
+       if (TREE_CODE (exp) == PLUS_EXPR)
+ 	{
+ 	  tree op0 = TREE_OPERAND (exp, 0);
+ 	  STRIP_NOPS (op0);
+ 	  if (TREE_CODE (op0) == ARRAY_REF)
+ 	    {
+ 	      tree table = TREE_OPERAND (op0, 0);
+ 	      if (TREE_CODE (table) == VAR_DECL
+ 		  && DECL_LANG_SPECIFIC (table)
+ 		  && DECL_OWNER (table) 
+ 		  && TYPE_OTABLE_DECL (DECL_OWNER (table)) == table)
+ 		{
+ 		  HOST_WIDE_INT index 
+ 		    = TREE_INT_CST_LOW (TREE_OPERAND (op0, 1));
+ 		  tree otable_methods 
+ 		    = TYPE_OTABLE_METHODS (DECL_OWNER (table));
+ 		  tree element;
+ 		  for (element = otable_methods; 
+ 		       element; 
+ 		       element = TREE_CHAIN (element))
+ 		    {
+ 		      if (index == 1)
+ 			{
+ 			  tree purpose = TREE_PURPOSE (element);
+ 			  if (TREE_CODE (purpose) == FIELD_DECL)
+ 			    return purpose;
+ 			  else
+ 			    return NULL_TREE;
+ 			}
+ 		      --index;
+ 		    }
+ 		}
+ 	    }
+ 	}
+     }
+ 
    return NULL_TREE;
  }
Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.180.2.6
diff -p -2 -c -r1.180.2.6 class.c
*** class.c	28 May 2004 16:32:44 -0000	1.180.2.6
--- class.c	22 Jun 2004 17:53:57 -0000
*************** gen_indirect_dispatch_tables (tree type)
*** 390,393 ****
--- 390,395 ----
  	DECL_IGNORED_P (TYPE_OTABLE_DECL (type)) = 1;
  	pushdecl (TYPE_OTABLE_DECL (type));  
+ 	MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (TYPE_OTABLE_DECL (type));
+ 	DECL_OWNER (TYPE_OTABLE_DECL (type)) = type;
  	sprintf (buf, "_otable_syms_%s", typename);
  	TYPE_OTABLE_SYMS_DECL (type) = 
Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-parse.c,v
retrieving revision 1.158.4.3
diff -p -2 -c -r1.158.4.3 jcf-parse.c
*** jcf-parse.c	28 May 2004 16:32:44 -0000	1.158.4.3
--- jcf-parse.c	22 Jun 2004 17:54:00 -0000
*************** load_class (tree class_or_name, int verb
*** 592,596 ****
  	{
  	  tree type_decl = IDENTIFIER_CLASS_VALUE (name);
! 	  if (CLASS_PARSED_P (TREE_TYPE (type_decl)))
  	    break;
  	}
--- 592,596 ----
  	{
  	  tree type_decl = IDENTIFIER_CLASS_VALUE (name);
! 	  if ((class_loaded = CLASS_LOADED_P (TREE_TYPE (type_decl))))
  	    break;
  	}


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