This is the mail archive of the java@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]
Other format: [Raw text]

Re: Class.h and Class.java both define zero-arg constructor


>>>>> "Adam" == Adam Megacz <gcj@lists.megacz.com> writes:

Adam> Class.h:
Adam>   // This constructor is used to create Class object for the primitive
Adam>   // types. See prims.cc.
Adam>   Class ()
Adam>   {
Adam> [ ... ]
Adam>   }

Adam> Class.java:
Adam>   // Don't allow new classes to be made.
Adam>   private Class ()
Adam>   {
Adam>   }


While investigating PR 5088, I ended up looking into this a bit more.

First, the current approach seems wrong on two counts.  First,
declaring a single function with two different implementations is
invalid.  Second, we currently can't have a constructor for a Java
class written in C++.  We were cheating on this for Class, but really
it isn't valid.

For PR 5088 I changed how the Object constructor's name is mangled.
It turns out that the C++ Class() constructor will call the `C2'
Object constructor (obvious once you dig into the problem), but with
my renaming patch there is only a `C1' constructor.

However, at the same time if I turn the constructor in Class.h into a
declaration, the vtable ends up wrong.  I don't understand why :-(.
My fix for that is to move the vtable hackery into _Jv_InitPrimClass.

Even more unfortunately, this doesn't seem to work either.  More
debugging is required.  But I think I'm on the right track here: get
rid of the C++ implementation.

Tom


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