Questions about JAVA VM spec
5 Message(s) by 2 Author(s) originally posted in java machine
| From: Joshua Cranmer |
Date: Wednesday, September 19, 2007
|
1. Why does not 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'd be much obliged.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E.
Knuth
| From: Roedy Green |
Date: Thursday, September 20, 2007
|
On Thu, 20 Sep 2007 01:01:54 GMT, Joshua Cranmer
wrote in message, 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've a
reference to an
object . The
other is when you've 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.
--
Roedy
Green Canadian Mind Products
The JAVA Glossary
http://mindprod.com
| From: Roedy Green |
Date: Thursday, September 20, 2007
|
On Thu, 20 Sep 2007 01:01:54 GMT, Joshua Cranmer
wrote in message, quoted or indirectly quoted someone who
said :
1. Why does not 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.
--
Roedy Green Canadian Mind Products
The JAVA Glossary
http://mindprod.com
| From: Joshua Cranmer |
Date: Thursday, September 20, 2007
|
wrote in message:
On Thu, 20 Sep 2007 01:01:54 GMT, Joshua Cranmer
wrote in message, 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've a reference to an object. The
other is when you've 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.
If I am understanding this correctly, then the two opcodes only differ
in
function ality when it comes to locating the function
pointer to call
in the vtable structure. That'd 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'd be.)
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
| From: Roedy Green |
Date: Thursday, September 20, 2007
|
On Fri, 21 Sep 2007 01:48:32 GMT, Joshua Cranmer
wrote in message, 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'd 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'd 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've to do a
miniature HashMap lookup of the class to get the offset. If you do not
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.
--
Roedy Green Canadian Mind Products
The JAVA Glossary
http://mindprod.com
Next Message: Synchronized implementations
Blogs related to Questions about JAVA VM spec
Dot Net Interview Questions
Both are virtual machine based architecture having CLR and
Java Virtual Machine (
JVM) as the underlying virtual machine for the management and execution of programs. Both provide memory, security and thread management on behalf of the
...
Java Fundamentals faq, sample, tips, free, download, help ...
They both serve the same purpose and that’s to start a
Java VM, have it run a
Java application, then terminate. The source for jre.exe is provided in the JDK. The source to
java.exe is provided only in the JDK Source distribution.
...
Advanced EJB interview questions
For example, you can use
java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive); What's new in the EJB 2.0
specification? - Following are the main features supported in EJB 2.0: Integration of
...
DOT NET FrameWork Concepts
If you are a
Java programmer, think of the CLR as the .NET equivalent of the
Java Virtual Machine (
JVM). If you don't know
Java, think of the CLR as the heart and soul of the .NET architecture. At a high level, the CLR activates objects
...
I dont know how to ask the question Basically I can write Java for ...
IDEA licenses would easily pay for themselves in improved productivity (or so I hear). "
Java Persistence currently requires that the many-to-one side always be the owner" — why is this? Is this laziness in the
spec?
...
I have an interesting problem I wrote a chat server and client in ...
there are still tons of perl programmers and hundreds of millions of lines of code to support. this sounds a lot like not
java. oh yes forgot. err..not
jvm, but
vm. communities need a bit of babble so they dont fester
...