[BC] Patch: FYI: direct references to our own static fields

Tom Tromey tromey@redhat.com
Wed Nov 10 21:49:00 GMT 2004


I'm checking this in on the BC branch.

This resurrects the patch to build_static_field_ref that I posted last
week.  The previous attempt was causing compiler crashes; I traced
this down to make_field_value using build_static_field_ref.  I don't
think there's any reason to do that -- when making the fields array we
just want direct references to the field itself.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* class.c (make_field_value): Don't call build_static_field_ref.
	(build_static_field_ref): Don't emit direct references when using
	indirect dispatch.

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.180.2.18
diff -u -r1.180.2.18 class.c
--- class.c 5 Nov 2004 22:45:53 -0000 1.180.2.18
+++ class.c 10 Nov 2004 21:45:41 -0000
@@ -1055,8 +1055,7 @@
      However, currently sometimes gcj is too eager and will end up
      returning the field itself, leading to an incorrect external
      reference being generated.  */
-  if ((is_compiled 
-       && (! flag_indirect_dispatch || current_class == fclass))
+  if ((is_compiled && !flag_indirect_dispatch)
       || (FIELD_FINAL (fdecl) && DECL_INITIAL (fdecl) != NULL_TREE
 	  && (JSTRING_TYPE_P (TREE_TYPE (fdecl))
 	      || JNUMERIC_TYPE_P (TREE_TYPE (fdecl)))
@@ -1275,7 +1274,7 @@
 	      ? TREE_CHAIN (TYPE_FIELDS (field_info_union_node))
 	      : TYPE_FIELDS (field_info_union_node)),
 	     (FIELD_STATIC (fdecl)
-	      ? build_address_of (build_static_field_ref (fdecl))
+	      ? build_address_of (fdecl)
 	      : byte_position (fdecl)))));
 
   FINISH_RECORD_CONSTRUCTOR (finit);



More information about the Java-patches mailing list