This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Patch for g++


>>>>> "Richard" == Richard Henderson <rth@cygnus.com> writes:

>> One fix would be to mangle `$' as though it were a non-ascii character
>> on systems that define NO_DOLLAR_IN_LABEL.  I don't know whether this
>> is acceptable however.

Richard> Another might be to substitute "." on systems that do not
Richard> define NO_DOT_IN_LABEL.  For systems that cannot support
Richard> either.. well, mangling them somehow is probably the best you
Richard> can do.

This won't work for us.  Explaining why requires a bit of background.

In Java each class is represented by an object of type java.lang.Class.
You can manipulate these objects just like any other object.

In Java you can refer to a class object using the syntax `TYPE.class',
eg `Class.class' refers to the class object representing
java.lang.Class itself.

It turns out that when writing native methods you often want to refer
to these class objects from C++ as well.  Current we do this by
encoding knowledge of the name mangling scheme.  Actual snippet from,
eg, prims.cc (there are tons of these):

    #define ObjectClass _CL_Q34java4lang6Object
    extern java::lang::Class ObjectClass;

Obviously this is evil.

We generate a C++ header file from every Java `.class' file.  This
lets the native C++ compiler know how Java objects are to be laid out.
So our idea was to represent the class object as a static field of the
Java class.  Of course, we can't use the name `class' for this,
because this is a C++ reserved word.  So I chose `class$' instead.

So the reason we can't use `.' instead is that this name will be user
visible.

Is fixing this mangling a prerequisite to getting the patch in?
If so I will try to get time scheduled so I can do this.
Alex, are you handling making things work with the new abi?
Or 

Tom

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