This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Name mangling once again
- To: Jeff Sturm <jeff dot sturm at commerceone dot com>
- Subject: Re: Name mangling once again
- From: Alexandre Petit-Bianco <apbianco at cygnus dot com>
- Date: Mon, 5 Feb 2001 16:04:05 -0800 (PST)
- Cc: martin dot kahlert at infineon dot com, java at gcc dot gnu dot org
- References: <3A7F3078.2ACC05B9@commerceone.com>
- Reply-To: apbianco at cygnus dot com
Jeff Sturm writes:
> Fields with names like class$foo$bar$Baz are synthensized by javac
> when you use the `.class' operator in Java source.
Yes. I forgot about that. javac generates code that caches already
computed `.class' values.
The source of the problem seems that I introduced a change to handle
the `Synthetic' attribute for things we read from classfiles. But it
looks like this shouldn't be used on fields as it will prevent them
from being generated properly. The incriminate code is in
java/class.c:make_class_data:
1267 for ( ; field != NULL_TREE; field = TREE_CHAIN (field))
1268 {
1269 if (! DECL_ARTIFICIAL (field))
1270 {
1271 tree init = make_field_value (field);
1272 if (FIELD_STATIC (field))
Which should be read in conjunction with java-tree.h:PUSH_FIELD:
1440 We set DECL_ARTIFICIAL so these fields get skipped by make_class_data
1441 if compiling java.lang.Object or java.lang.Class. */
1442
1443 #define PUSH_FIELD(RTYPE, FIELD, NAME, FTYPE) \
I don't feel like changing this setup now. So I'll revert part of the
patch I wrote to fix a bogus error report because we weren't taking
into account the `Synthetic' attribute in method names (only.) This
patch should fix your problem, let me know.
./A
Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/jcf-parse.c,v
retrieving revision 1.74
diff -u -p -r1.74 jcf-parse.c
--- jcf-parse.c 2001/02/01 10:35:50 1.74
+++ jcf-parse.c 2001/02/06 00:01:03
@@ -224,11 +224,12 @@ set_source_filename (jcf, index)
#define HANDLE_SYNTHETIC_ATTRIBUTE() \
{ \
- /* Irrelevant decls should have been nullified by the END macros. */ \
+ /* Irrelevant decls should have been nullified by the END macros. \
+ We only handle the `Synthetic' attribute on method DECLs. \
+ DECL_ARTIFICIAL is used for something else (See PUSH_FIELD in \
+ java-tree.h) */ \
if (current_method) \
DECL_ARTIFICIAL (current_method) = 1; \
- else \
- DECL_ARTIFICIAL (current_field) = 1; \
}
#include "jcf-reader.c"