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]
Other format: [Raw text]

Re: Patch: PR java/20338 - Call _Jv_InitClass for private static methods in an inner class


>>>>> "Bryce" == Bryce McKinlay <mckinlay@redhat.com> writes:

Bryce> There should be no reason to initialize the class when calling a
Bryce> private method, because private methods can (usually) only be called
Bryce> within the same class, thus the class must already be initialized.

It depends on the ABI.  The scenario that matters is calling a private
method in another class.  This can happen whenever the two classes in
question are in the same top-level class.

In the C++ ABI, the caller is already linked to the private method of
the callee.  In this situation, the callee has to initialize its
class.

In the BC ABI, we must emit an accessor method, just as if we were
compiling to bytecode.  The reason for this is that the runtime linker
does access checks.  In this situation, a private static method need
*not* initialize its class, because the private method itself will
only ever be called from its own class -- either directly or via the
accessor (which must initialize the class; but this "ought to" happen
automatically as the accessor will simply be another non-private
static method).

There are several bugs in bugzilla about not creating accessor methods
when required.  One or two have titles about generating invalid
bytecode or having verification fail or something like that.

Tom


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