INVOKEVIRTUAL and INVOKEINTERFACE

Artur Biesiadowski abies at pg.gda.pl
Sun Sep 27 04:08:55 PDT 1998


Senthil Kumar wrote:
> 
> >From the VM point of view, what are the diferences
> in implementing them?
> 
> I am asking this, because I see no difference whatsoever.

In invokevirtual you are referring to single inheritance - and you can
just fetch adress of method with one or two  indirect memory accesses
(method adress is something like obj->class.methods[method_number] )

In invokeinterface you have to look up correct interface in object
first. So, method adress is something like
i =0;
while( id != obj->class.interface_id[i] )
	i++;
adress is obj->class.interface_dispatch[i]

So, invokevirtual is a lot faster and simplier.

Artur


More information about the kaffe mailing list