Patch for correctly intializing interface class on Method.invoke() (Was: Line number support for interpreter)

Mark Wielaard mark@klomp.org
Fri May 21 15:38:00 GMT 2004


Hi,

On Thu, 2004-05-20 at 16:35, Bryce McKinlay wrote:
> Mark Wielaard wrote:
> 
> >The following patch adds explicit initialization of interface classes to
> >Method.invoke() and also does the test whether the declaringClass is an
> >interface only when the method involved isn't a static method since
> >interfaces cannot contain static methods.
> 
> If other implementations initialize interfaces during Method.invoke(), 
> which apparently from our discussions on IRC, they do, then we should do 
> the same for compatibility - so your patch is fine.  However, an 
> interface should not have to be initialized in order to call 
> Method.invoke() on it, assuming the method being invoked is not static. 

This is the behavior of kaffe. But it seems your reading of the spec is
correct. My new mauve test seems to strict (also in the other direction,
it seems the VM spec actually allows initializing an interface as soon
as a object that implements the interface is created, but it does not
need to). I'll relax my mauve test.

> So, I think the real bug here is that we layout the interface methods at 
> the wrong time, ie during initialization when it should be done during 
> linking/preparation. So, I suggest the following patch (untested):

If that works then I think that is better then my patch.
Maybe only keep the part of the patch that moves the isInterface() and
iface assignment into the else branch of the Modifier::isStatic() (as
micro optimization).

Cheers,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20040521/8b24ce76/attachment.sig>


More information about the Java-patches mailing list