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 / General / August 2006

Tip: Looking for answers? Try searching our database.

Dynamic Method Lookuip in Java

Thread view: 
dimitrik107@hotmail.com - 27 Aug 2006 02:44 GMT
Does java has vtable and vptr like C++? I try to understand the
mechanism java used for dynamic method lookup, but my books don't say.
Can someone explain? Thank you.
Jim Korman - 27 Aug 2006 04:42 GMT
>Does java has vtable and vptr like C++? I try to understand the
>mechanism java used for dynamic method lookup, but my books don't say.
>Can someone explain? Thank you.

Take  a look at

http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html

start with
http://java.sun.com/docs/books/vmspec/2nd-edition/html/Overview.doc.html#1963

and move on to

http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#1513

and
http://java.sun.com/docs/books/vmspec/2nd-edition/html/Compiling.doc.html#14787

Jim
Chris Uppal - 27 Aug 2006 12:28 GMT
> Does java has vtable and vptr like C++? I try to understand the
> mechanism java used for dynamic method lookup, but my books don't say.

It's implementation dependent (actually it's implementation dependent in C++
too).  The only way you can find out is to read the source for the /particular/
JVM implementation you are interested in.

In point of fact, and as far as I can tell, Sun's current range of JVMs use a
small inline cache at the point-of-call (a type-test and unconditional jump if
the test passes) with a fallback to the horrendously inefficient vtable-based
dispatch if that fails.  (That's for optimised code, I have no idea how "eager"
the implementation is to use that optimisation).

Static method dispatch (invokestatic), interface method dispatch
(invokeinterface), and invocation of private methods and super-sends can be,
and have to be, handled differently.

   -- chris


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.