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: gcj: always emit static array data


Tom Tromey <tromey@cygnus.com> writes:

> Is this the only code in gcj that generates ctors?

This does not use ctors at all in the sense you are talking about.
We are talking about three very different things:  a CONSTRUCTOR is a
tree-node for (basically) representing C-style brace-initializers;
a constructor is method that is invoked when an object is
initialized;  a static constructor is run before the class is
inialized;  and ctor/init code is run before main is started (or
when library is dynamically loaded).

Static initailized array data is represented using a CONSTRUCTOR;
the goal of my #ifdef'd code is to alloacte the values in .data
storage, and have it be statically initialized *without* needing
any ctor magic.

The only reason gcj using ctor/init code (that I can think of)
is to call _Jv_RegisterClass.  This is only required so that
Class.forName will work;  class initialization does *not* depend
on ctors.  (However, some part of class start-up, such as interning
String literals, could be done either at either ctor time or at
class initialization time.)

> I'd like to change libgcj so that we don't rely on ctors.  This will
> eliminate problems in some situations (e.g., using shared libs on
> Solaris with the Solaris linker).

I don't think this is the right approach.  Better to fix where the
breakage is - i.e. in libtool.  Gcj depends on working C++, and you
can't have working C++ without working static initializers.

> Would it be sufficient for libgcj to always have these vtables have
> known names?  Then we could simply reference them symbolically from
> gcj.

Yes - that is exactly what I am proposing.  (It doesn't not work so
well for arrays of Objects, but we can handle arrays of primitive
values better easily.)

By the way - could you fix your mailer?  It keeps appending extra
ctrl/Ms.

-- 
	--Per Bothner
bothner@pacbell.net  per@bothner.com   http://home.pacbell.net/bothner/


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