Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Virtual Machine / September 2007

Tip: Looking for answers? Try searching our database.

Questions about Java VM spec

Thread view: 
Joshua Cranmer - 20 Sep 2007 02:01 GMT
1. Why doesn't the Java 6 link to the VM spec include the addendum to
the class file format that has all of the stack trace information? The
only place I can find it is through the actual JSR...

2. When is the SourceDebugExtension attribute actually used?

3. What is the difference in purpose between invokevirtual and
invokeinterface ?

Answers would be much obliged.

Signature

Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

Roedy Green - 20 Sep 2007 07:52 GMT
On Thu, 20 Sep 2007 01:01:54 GMT, Joshua Cranmer
<Pidgeot18@verizon.net> wrote, quoted or indirectly quoted someone who
said :

>3. What is the difference in purpose between invokevirtual and
>invokeinterface ?

One is used to invoke when you have a reference to an object. The
other is when you have a reference to an interface.

With an object reference the offset of the method in the class is
known.  With an interface it may vary depending on which class is
implementing the interface.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Joshua Cranmer - 21 Sep 2007 02:48 GMT
> On Thu, 20 Sep 2007 01:01:54 GMT, Joshua Cranmer
> <Pidgeot18@verizon.net> wrote, quoted or indirectly quoted someone who
[quoted text clipped - 9 lines]
> known.  With an interface it may vary depending on which class is
> implementing the interface.

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.)

Signature

Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

Roedy Green - 21 Sep 2007 03:38 GMT
On Fri, 21 Sep 2007 01:48:32 GMT, Joshua Cranmer
<Pidgeot18@verizon.net> 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
[quoted text clipped - 3 lines]
>(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 classes work faster than interfaces.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green - 20 Sep 2007 07:52 GMT
On Thu, 20 Sep 2007 01:01:54 GMT, Joshua Cranmer
<Pidgeot18@verizon.net> wrote, quoted or indirectly quoted someone who
said :

>1. Why doesn't the Java 6 link to the VM spec include the addendum to
>the class file format that has all of the stack trace information? The
>only place I can find it is through the actual JSR...

see http://mindprod.com/jgloss/rfe.html

Those kinds of requests usually get satisfied since they require
almost no work on Sun's part.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.