Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Machine > Re: Questions a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 789 of 816
Post > Topic >>

Re: Questions about Java VM spec

by Roedy Green <see_website@[EMAIL PROTECTED] > Sep 21, 2007 at 02:38 AM

On Fri, 21 Sep 2007 01:48:32 GMT, Joshua Cranmer
<Pidgeot18@[EMAIL PROTECTED]
> wrote, quoted or indirectly quoted someone who
said :

>If I am understanding this correctly, then the two opcodes only differ 
>in functionality when it comes to locating the function pointer to call 
>in the vtable structure. That would mean that at logical level, the 
>method resolution lookup is identical.
>
>(Hmmm... trying to put down in words the concept I envision in my head 
>is much more difficult than I thought it would be.)

The implementation is quite different.  For InvokeVirtual, you  take
the method index, index into the vtbl for the current object's class,
and that points you to the method.

For InvokeInterface, you need a cache of class-offset pairs that have
been discovered in past to invoke this method.  You have to do a
miniature HashMap lookup of the class to get the offset. If you don't
find the class, you must examine the class object structure for the
current object, looking for a match for that method, then add it to
the cache. There may be cleverer, faster ways of implementing it, but
it is much hairier operation than InvokeVirtual.

This is why abstract cl***** work faster than interfaces.
-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 




 5 Posts in Topic:
Questions about Java VM spec
Joshua Cranmer <Pidgeo  2007-09-20 01:01:54 
Re: Questions about Java VM spec
Roedy Green <see_websi  2007-09-20 06:52:02 
Re: Questions about Java VM spec
Joshua Cranmer <Pidgeo  2007-09-21 01:48:32 
Re: Questions about Java VM spec
Roedy Green <see_websi  2007-09-21 02:38:51 
Re: Questions about Java VM spec
Roedy Green <see_websi  2007-09-20 06:52:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 23:13:09 CDT 2008.