S
Scott Balmos
Hi all,
This is more for morbid curiosity, but I'm reading up on the internals
of the JVM and how the bytecode is interpreted. I plan on writing a JVM
emulator, more just for academic sake. But I have a few questions.
In classloading, what is generally meant by defining a class? I
understand that you transfer the .class file bytestream into a Class
object. But is that really it? Are Class objects stored on the stack
(or heap) just like all other objects? And I'm guessing resolution
during classloading means translating the textual string references in
the classfile's pools into actual references to Class objects.
If I were writing a JVM, with no JIT functionality (e.g. nothing in
java.lang.compiler), I'm assuming that each opcode is "run" at JVM
runtime independently of other opcodes. Thus, if I were being really
stupid and writing this academic JVM in PHP or Perl (yeah, I know, real
stupid), I could have a global array as my opcode stack, and then
separate individual functions that implement each opcode.
Are Class and Object implemented "natively", inside the JVM? I'm
guessing ClassLoader also. I guess a more general question is how much
of the Java library, or really java.lang, is implemented "natively" by
the JVM, and not just as normal .class files that are loaded & executed
as normal code.
That might do it for now. I'm sure to come up with other questions
later. I just need reassurance I'm on the right path, after reading the
JVM spec, jNode source code, and some of the Sun JVM community code
(that *really* made my head spin).
Thanks!
--Scott
This is more for morbid curiosity, but I'm reading up on the internals
of the JVM and how the bytecode is interpreted. I plan on writing a JVM
emulator, more just for academic sake. But I have a few questions.
In classloading, what is generally meant by defining a class? I
understand that you transfer the .class file bytestream into a Class
object. But is that really it? Are Class objects stored on the stack
(or heap) just like all other objects? And I'm guessing resolution
during classloading means translating the textual string references in
the classfile's pools into actual references to Class objects.
If I were writing a JVM, with no JIT functionality (e.g. nothing in
java.lang.compiler), I'm assuming that each opcode is "run" at JVM
runtime independently of other opcodes. Thus, if I were being really
stupid and writing this academic JVM in PHP or Perl (yeah, I know, real
stupid), I could have a global array as my opcode stack, and then
separate individual functions that implement each opcode.
Are Class and Object implemented "natively", inside the JVM? I'm
guessing ClassLoader also. I guess a more general question is how much
of the Java library, or really java.lang, is implemented "natively" by
the JVM, and not just as normal .class files that are loaded & executed
as normal code.
That might do it for now. I'm sure to come up with other questions
later. I just need reassurance I'm on the right path, after reading the
JVM spec, jNode source code, and some of the Sun JVM community code
(that *really* made my head spin).
Thanks!
--Scott