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]

Patch: change mangling for utf8consts


This patch changes how utf8const names are mangled by gcj.  Before
this patch we generated a symbol by mangling the name of the
utf8const.  However, this has caused a couple problems with the
demangler.  When you hit one of these problems the typical symptom is
that you can't run gdb on your gcj-built program.

Instead of fixing the demangler, which is very hairy, I think it is
simpler if we just generate simpler symbols.  This patch does that.
I've never had a use for the longer names.

I rebuilt libjava using this patch on x86 and ran `make
check-target-libjava' with no problems.

Ok for trunk and branch?

2001-05-02  Tom Tromey  <tromey@redhat.com>

	* class.c (build_utf8_ref): Don't generate identifier based on
	utf8const contents.

Tom

Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.88.2.7
diff -u -r1.88.2.7 class.c
--- class.c	2001/03/22 22:34:15	1.88.2.7
+++ class.c	2001/05/03 20:35:13
@@ -807,7 +807,6 @@
   const char * name_ptr = IDENTIFIER_POINTER(name);
   int name_len = IDENTIFIER_LENGTH(name);
   char buf[60];
-  char *buf_ptr;
   tree ctype, field = NULL_TREE, str_type, cinit, string;
   static int utf8_count = 0;
   int name_hash;
@@ -833,23 +832,8 @@
   FINISH_RECORD_CONSTRUCTOR (cinit);
   TREE_CONSTANT (cinit) = 1;
 
-  /* Build a unique identifier based on buf. */
+  /* Generate a unique-enough identifier.  */
   sprintf(buf, "_Utf%d", ++utf8_count);
-  buf_ptr = &buf[strlen (buf)];
-  if (name_len > 0 && name_ptr[0] >= '0' && name_ptr[0] <= '9')
-    *buf_ptr++ = '_';
-  while (--name_len >= 0)
-    {
-      unsigned char c = *name_ptr++;
-      if (c & 0x80)
-	continue;
-      if (!ISALPHA(c) && !ISDIGIT(c))
-	c = '_';
-      *buf_ptr++ = c;
-      if (buf_ptr >= buf + 50)
-	break;
-    }
-  *buf_ptr = '\0';
 
   decl = build_decl (VAR_DECL, get_identifier (buf), utf8const_type);
   /* FIXME get some way to force this into .text, not .data. */


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