This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Class name mangling


The problem was inconsistent mangling conventions.
One fix is attached - it changes field (and variable)
names to be consistently mangled using the "reversible"
mangling scheme.

Of course it is not obvious this is the best fix.  An
alternative fix would be to use the *non*-reversible
mangling scheme more consistently.  More specifically,
in ClassMemberConstraint when importing a value that
doesn't have a "name" property.  But that solution
doesn't guarantee that we'd get the same name back.
So my inclination is to use the reversible mangling.

See http://www.gnu.org/software/kawa/Mangling.html
for what the manual says about mangling -  that would
of course need to be updated.

Comments, everyone:  What are your thoughts about changing
the mangling for field names (not method names, at least at
this point) to a less natural but reversible mangling?
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/
Index: Declaration.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/Declaration.java,v
retrieving revision 1.43
diff -u -r1.43 Declaration.java
--- Declaration.java	12 Nov 2002 19:03:29 -0000	1.43
+++ Declaration.java	30 Nov 2002 19:07:27 -0000
@@ -399,7 +399,7 @@
 	args[0] = Type.pointer_type;
 	args[1] = Type.string_type;
 	makeSymbolMethod
-	  = Compilation.typeSymbol.addMethod("make", args,
+	  = Compilation.typeSymbol.addMethod("makeUninterned", args,
 					      Compilation.typeSymbol,
 					      Access.PUBLIC|Access.STATIC);
       }
@@ -414,7 +414,7 @@
       {
         String vname = null;
         if (symbol != null)
-          vname = Compilation.mangleName(getName());
+          vname = Compilation.mangleNameIfNeeded(getName());
 	if (isAlias() && getValue() instanceof ReferenceExp)
 	  {
 	    Declaration base = followAliases(this);
@@ -510,7 +510,7 @@
     String fname = getName();
     boolean external_access = (flags & EXTERNAL_ACCESS+PRIVATE)
       == EXTERNAL_ACCESS+PRIVATE;
-    fname = Compilation.mangleName(fname);
+    fname = Compilation.mangleNameIfNeeded(fname);
     if (getFlag(IS_UNKNOWN))
       fname = UNKNOWN_PREFIX + fname;
     if (external_access)
@@ -586,7 +586,7 @@
         if (procClass != null)
           {
             ClassType procType = (ClassType) Type.make(procClass);
-            String fname = Compilation.mangleName(name);
+            String fname = Compilation.mangleNameIfNeeded(name);
             gnu.bytecode.Field procField = procType.getDeclaredField(fname);
             if (procField != null)
               {

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