This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: gcj and UDP datagrams under freebsd
Loren James Rittle wrote:
>Here is the static (non-heap, non-stack) object declaration for that
>object in libjava/java/net/InetAddress.java:
>
> private static final byte[] localhostAddress = { 127, 0, 0, 1 };
>
>Does gcj force any alignment of static byte arrays such as this? Or,
>rather, is it suppose to do so and failing to do so here?
>
Exactly - good catch. We are forcing alignment for class objects but I
forgot about static array objects. Please try this patch.
regards
Bryce.
2002-04-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* class.c (make_class): Set TYPE_ALIGN here to ensure double alignment
for all class types with hash synchronization.
* decl.c (java_init_decl_processing): Don't set TYPE_ALIGN here.
Index: class.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/class.c,v
retrieving revision 1.130
diff -u -r1.130 class.c
--- class.c 3 Mar 2002 14:07:32 -0000 1.130
+++ class.c 9 Apr 2002 11:48:24 -0000
@@ -303,6 +303,10 @@
#endif
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
+ /* Hash synchronization requires at least double-word alignment. */
+ if (flag_hash_synchronization && POINTER_SIZE < 64)
+ TYPE_ALIGN (type) = 64;
+
return type;
}
Index: decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/decl.c,v
retrieving revision 1.125
diff -u -r1.125 decl.c
--- decl.c 29 Mar 2002 21:46:26 -0000 1.125
+++ decl.c 9 Apr 2002 11:48:29 -0000
@@ -682,10 +682,6 @@
FIELD_PRIVATE (t) = 1;
push_super_field (class_type_node, object_type_node);
- /* Hash synchronization requires at least double-word alignment. */
- if (flag_hash_synchronization && POINTER_SIZE < 64)
- TYPE_ALIGN (class_type_node) = 64;
-
FINISH_RECORD (class_type_node);
build_decl (TYPE_DECL, get_identifier ("Class"), class_type_node);