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:
>>So if hash synchronization is in use then clearly the problem is that
>>
>class-> name is null. Inspection with GDB reveals that the class name is
>
>>actually at class->name+4. But I'm not sure how my patch would have
>>caused this to happen!
>>
>
>Ah... that explains the crash at least.
>
OK, duh. Class types are made up with a field_decls for their
superclasses, so for example java.lang.Object is just a static field
inside java.lang.Class. Setting TYPE_ALIGN on every class type results
in the java.lang.Object fields being aligned as well within the
java.lang.Class object. Since C++ doesn't know about this it crashes.
Could you take this one for a spin?
regards
Bryce.
2002-04-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* class.c (make_class_data): Set DECL_ALIGN on static class data,
for hash synchronization.
* expr.c (java_expand_expr): Set DECL_ALIGN on static array objects.
* decl.c (java_init_decl_processing): Don't set TYPE_ALIGN for
class_type_node.
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 13 Apr 2002 03:44:35 -0000
@@ -1736,6 +1740,11 @@
FINISH_RECORD_CONSTRUCTOR (cons);
DECL_INITIAL (decl) = cons;
+
+ /* Hash synchronization requires at least 64-bit alignment. */
+ if (flag_hash_synchronization && POINTER_SIZE < 64)
+ DECL_ALIGN (decl) = 64;
+
rest_of_decl_compilation (decl, (char*) 0, 1, 0);
}
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 13 Apr 2002 03:44:49 -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);
Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/expr.c,v
retrieving revision 1.143
diff -u -r1.143 expr.c
--- expr.c 4 Apr 2002 22:19:55 -0000 1.143
+++ expr.c 13 Apr 2002 03:44:59 -0000
@@ -2526,6 +2548,9 @@
DECL_INITIAL (init_decl) = value;
DECL_IGNORED_P (init_decl) = 1;
TREE_READONLY (init_decl) = 1;
+ /* Hash synchronization requires at least 64-bit alignment. */
+ if (flag_hash_synchronization && POINTER_SIZE < 64)
+ DECL_ALIGN (init_decl) = 64;
rest_of_decl_compilation (init_decl, NULL, 1, 0);
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (init_decl)) = 1;
init = build1 (ADDR_EXPR, TREE_TYPE (exp), init_decl);